Skip to content

Commit 0f8d529

Browse files
authored
build: prepare framework peer dependency and migration collection for v14 (#24492)
* build: prepare framework peer dependency and migration collection for v14 Prepares the framework peer dependency and migration collection for v14, ensuring the release checks will not fail when we get closer to publishing the first RC. * build: fix chalk runtime errors due to esmodule interop The chalk usages in the `tools/` folder seems to fail at runtime given the `esModuleInterop` flag being enabled for the tools folder. We need to switch the namespace imports to default imports to work with the interop, and to follow the TS language-service recommendation (which actually proposes switching these imports to `import c from 'chalk'`) We should likely turn on the esmoduleinterop flag for the scripts folder as well to have consistent imports, and to prepare for future ESM consumption as the ecosystem moves forward. * build: enable esmoduleinterop option in `scripts` and `.ng-dev` Similar to the `/tsconfig.json` and the `tools/tsconfig.json`, we should enable the `esModuleInterop` from TypeScript in the `scripts/` directory. This is necessary to ensure that scripts part of both compilations. e.g. when a file in `scripts/` imports from `tools/` are compatible without needing two coordinated compilations (using e.g TS project references..). In general enabling the interop means more consistency in the repo. Then only remaining exception are the schematics which we can clean-up in the future when we ship them as ES modules.
1 parent 6c7cc8a commit 0f8d529

32 files changed

+73
-33
lines changed

.ng-dev/tsconfig.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
"strict": true,
44
"target": "es2015",
55
"module": "commonjs",
6+
"esModuleInterop": true,
67
"noEmit": true,
78
"skipLibCheck": true,
89
"types": []

packages.bzl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Each individual package uses a placeholder for the version of Angular to ensure they're
22
# all in-sync. This map is passed to each ng_package rule to stamp out the appropriate
33
# version for the placeholders.
4-
ANGULAR_PACKAGE_VERSION = "^13.0.0 || ^14.0.0"
4+
ANGULAR_PACKAGE_VERSION = "^14.0.0-0 || ^15.0.0"
55
MDC_PACKAGE_VERSION = "14.0.0-canary.9736ddce9.0"
66
TSLIB_PACKAGE_VERSION = "^2.3.0"
77
RXJS_PACKAGE_VERSION = "^6.5.3 || ^7.4.0"

scripts/breaking-changes.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import {join, relative} from 'path';
22
import {readFileSync} from 'fs';
3-
import * as chalk from 'chalk';
4-
import * as ts from 'typescript';
3+
import chalk from 'chalk';
4+
import ts from 'typescript';
55
import * as tsutils from 'tsutils';
66

77
const projectRoot = process.cwd();

scripts/check-mdc-exports.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import {join} from 'path';
22
import {readdirSync, existsSync} from 'fs';
3-
import * as ts from 'typescript';
4-
import * as chalk from 'chalk';
3+
import ts from 'typescript';
4+
import chalk from 'chalk';
55
import {config} from './check-mdc-exports-config';
66

77
// Script which ensures that a particular MDC package exports all of the same symbols as its

scripts/check-mdc-tests.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import {readdirSync, readFileSync} from 'fs';
22
import {join, basename} from 'path';
33
import {sync as glob} from 'glob';
4-
import * as chalk from 'chalk';
5-
import * as ts from 'typescript';
4+
import chalk from 'chalk';
5+
import ts from 'typescript';
66
import {config} from './check-mdc-tests-config';
77

88
const srcDirectory = join(__dirname, '../src');

scripts/check-package-externals.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@
88
* be passed to this script to ensure that the list is up-to-date.
99
*/
1010

11-
import * as chalk from 'chalk';
11+
import chalk from 'chalk';
1212
import {readFileSync} from 'fs';
13-
import * as minimatch from 'minimatch';
13+
import minimatch from 'minimatch';
1414
import {join, relative} from 'path';
15-
import * as ts from 'typescript';
15+
import ts from 'typescript';
1616

1717
const projectRoot = join(__dirname, '../');
1818
const args = process.argv.slice(2);

scripts/ownerslint.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import * as chalk from 'chalk';
1+
import chalk from 'chalk';
22
import {readdirSync, readFileSync, statSync} from 'fs';
33
import {IMinimatch, Minimatch} from 'minimatch';
44
import {join} from 'path';

scripts/tsconfig.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@
88
"strict": true,
99
"noEmit": true,
1010
"skipLibCheck": true,
11-
"downlevelIteration": true
11+
"downlevelIteration": true,
12+
"esModuleInterop": true
1213
},
1314
// The `firebase-functions` folder has its own `package.json` and does
1415
// not pass type-checking. This excludes it from being checked.

src/cdk/schematics/migration.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,11 @@
4141
"description": "Updates the Angular CDK to v13",
4242
"factory": "./ng-update/index#updateToV13"
4343
},
44+
"migration-v14": {
45+
"version": "14.0.0-0",
46+
"description": "Updates the Angular CDK to v14",
47+
"factory": "./ng-update/index#updateToV14"
48+
},
4449
"ng-post-update": {
4550
"description": "Prints out results after ng-update.",
4651
"factory": "./ng-update/index#postUpdate",

src/cdk/schematics/ng-update/index.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,16 @@ export function updateToV13(): Rule {
9494
);
9595
}
9696

97+
/** Entry point for the migration schematics with target of Angular CDK 14.0.0 */
98+
export function updateToV14(): Rule {
99+
return createMigrationSchematicRule(
100+
TargetVersion.V14,
101+
cdkMigrations,
102+
cdkUpgradeData,
103+
onMigrationComplete,
104+
);
105+
}
106+
97107
/** Function that will be called when the migration completed. */
98108
function onMigrationComplete(
99109
context: SchematicContext,

0 commit comments

Comments
 (0)