Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(core): undecorated-classes-with-di migration should never use ngtsc #32318

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -12,12 +12,14 @@ import * as ts from 'typescript';

/** Creates an NGC program that can be used to read and parse metadata for files. */
export function createNgcProgram(
createHost: (options: ts.CompilerOptions) => ts.CompilerHost, tsconfigPath: string | null,
parseConfig: () => {
rootNames: readonly string[],
options: ts.CompilerOptions
} = () => readConfiguration(tsconfigPath !)) {
const {rootNames, options} = parseConfig();
createHost: (options: ts.CompilerOptions) => ts.CompilerHost, tsconfigPath: string) {
const {rootNames, options} = readConfiguration(tsconfigPath);

// https://github.com/angular/angular/commit/ec4381dd401f03bded652665b047b6b90f2b425f made Ivy
// the default. This breaks the assumption that "createProgram" from compiler-cli returns the
// NGC program. In order to ensure that the migration runs properly, we set "enableIvy" to false.
options.enableIvy = false;

const host = createHost(options);
const ngcProgram = createProgram({rootNames, options, host});
const program = ngcProgram.getTsProgram();
Expand Down
2 changes: 1 addition & 1 deletion packages/core/schematics/test/BUILD.bazel
Expand Up @@ -25,7 +25,7 @@ ts_library(
)

jasmine_node_test(
name = "google3",
name = "test",
deps = [
":test_lib",
"@npm//shelljs",
Expand Down
2 changes: 1 addition & 1 deletion packages/core/schematics/test/google3/BUILD.bazel
Expand Up @@ -12,7 +12,7 @@ ts_library(
)

jasmine_node_test(
name = "test",
name = "google3",
deps = [
":test_lib",
"@npm//shelljs",
Expand Down
Expand Up @@ -32,7 +32,6 @@ describe('Undecorated classes with DI migration', () => {
compilerOptions: {
lib: ['es2015'],
},
angularCompilerOptions: {enableIvy: false}
}));
writeFile('/angular.json', JSON.stringify({
projects: {t: {architect: {build: {options: {tsConfig: './tsconfig.json'}}}}}
Expand Down