Skip to content

Commit a418bf8

Browse files
committed
build: update to typescript 4.5 and angular 13.1
Bumps the versions of TypeScript and Angular to 4.5 and 13.1 respectively, and accounts for some breaking changes.
1 parent 8ae41b0 commit a418bf8

File tree

9 files changed

+940
-948
lines changed

9 files changed

+940
-948
lines changed

integration/ts-compat/BUILD.bazel

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ write_file(
1313
# List of TypeScript packages that we want to run the compatibility test against.
1414
# The list contains NPM module names that resolve to the desired TypeScript version.
1515
typescript_version_packages = [
16+
"typescript-4.4",
1617
"typescript",
1718
]
1819

package.json

Lines changed: 21 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -50,12 +50,12 @@
5050
},
5151
"version": "13.1.0-next.3",
5252
"dependencies": {
53-
"@angular/animations": "13.0.1",
54-
"@angular/common": "13.0.1",
55-
"@angular/compiler": "13.0.1",
56-
"@angular/core": "13.0.1",
57-
"@angular/forms": "13.0.1",
58-
"@angular/platform-browser": "13.0.1",
53+
"@angular/animations": "^13.1.0-next.3",
54+
"@angular/common": "^13.1.0-next.3",
55+
"@angular/compiler": "^13.1.0-next.3",
56+
"@angular/core": "^13.1.0-next.3",
57+
"@angular/forms": "^13.1.0-next.3",
58+
"@angular/platform-browser": "^13.1.0-next.3",
5959
"@types/google.maps": "^3.45.6",
6060
"@types/youtube": "^0.0.42",
6161
"core-js-bundle": "^3.8.2",
@@ -66,17 +66,17 @@
6666
"zone.js": "~0.11.3"
6767
},
6868
"devDependencies": {
69-
"@angular-devkit/build-angular": "13.0.2",
70-
"@angular-devkit/core": "13.0.2",
71-
"@angular-devkit/schematics": "13.0.2",
72-
"@angular/bazel": "13.0.1",
73-
"@angular/cli": "13.0.2",
74-
"@angular/compiler-cli": "13.0.1",
69+
"@angular-devkit/build-angular": "^13.1.0-next.3",
70+
"@angular-devkit/core": "^13.1.0-next.3",
71+
"@angular-devkit/schematics": "^13.1.0-next.3",
72+
"@angular/bazel": "^13.1.0-next.3",
73+
"@angular/cli": "^13.1.0-next.3",
74+
"@angular/compiler-cli": "^13.1.0-next.3",
7575
"@angular/dev-infra-private": "https://github.com/angular/dev-infra-private-builds.git#c55a3937d45945489714273bfbbe9b803ceff89e",
76-
"@angular/localize": "13.0.1",
77-
"@angular/platform-browser-dynamic": "13.0.1",
78-
"@angular/platform-server": "13.0.1",
79-
"@angular/router": "13.0.1",
76+
"@angular/localize": "^13.1.0-next.3",
77+
"@angular/platform-browser-dynamic": "^13.1.0-next.3",
78+
"@angular/platform-server": "^13.1.0-next.3",
79+
"@angular/router": "^13.1.0-next.3",
8080
"@axe-core/webdriverjs": "^4.1.0",
8181
"@babel/core": "^7.16.0",
8282
"@bazel/bazelisk": "1.10.1",
@@ -141,7 +141,7 @@
141141
"@octokit/rest": "18.3.5",
142142
"@rollup/plugin-commonjs": "^21.0.0",
143143
"@rollup/plugin-node-resolve": "^13.0.5",
144-
"@schematics/angular": "13.0.2",
144+
"@schematics/angular": "^13.1.0-next.3",
145145
"@types/babel__core": "^7.1.16",
146146
"@types/browser-sync": "^2.26.1",
147147
"@types/fs-extra": "^9.0.5",
@@ -213,14 +213,15 @@
213213
"tsickle": "0.39.1",
214214
"tslint": "^6.1.3",
215215
"tsutils": "^3.21.0",
216-
"typescript": "~4.4.2",
216+
"typescript-4.4": "npm:[email protected]",
217+
"typescript": "~4.5.2",
217218
"vrsource-tslint-rules": "6.0.0",
218219
"yaml": "^1.10.0"
219220
},
220221
"resolutions": {
221-
"@angular/dev-infra-private/typescript": "~4.4.2",
222+
"@angular/dev-infra-private/typescript": "~4.5.2",
222223
"browser-sync-client": "2.26.13",
223-
"dgeni-packages/typescript": "4.4.2",
224+
"dgeni-packages/typescript": "4.5.2",
224225
"**/https-proxy-agent": "5.0.0"
225226
}
226227
}

scripts/caretaking/firebase-functions/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
"firebase-functions": "^3.11.0"
1212
},
1313
"devDependencies": {
14-
"typescript": "^4.4.2",
14+
"typescript": "^4.5.2",
1515
"firebase-tools": "^8.6.0"
1616
},
1717
"private": true

scripts/caretaking/firebase-functions/yarn.lock

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3794,10 +3794,10 @@ typedarray@^0.0.6:
37943794
resolved "https://registry.yarnpkg.com/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777"
37953795
integrity sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c=
37963796

3797-
typescript@^4.4.2:
3798-
version "4.4.3"
3799-
resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.4.3.tgz#bdc5407caa2b109efd4f82fe130656f977a29324"
3800-
integrity sha512-4xfscpisVgqqDfPaJo5vkd+Qd/ItkoagnHpufr+i2QCHBsNYp+G7UAoyFl8aPtx879u38wPV65rZ8qbGZijalA==
3797+
typescript@^4.5.2:
3798+
version "4.5.2"
3799+
resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.5.2.tgz#8ac1fba9f52256fdb06fb89e4122fa6a346c2998"
3800+
integrity sha512-5BlMof9H1yGt0P8/WF+wPNw6GfctgGjXp5hkblpyT+8rkASSmkUKMXrxR0Xg8ThVCi/JnHQiKXeBaEwCeQwMFw==
38013801

38023802
unique-string@^1.0.0:
38033803
version "1.0.0"

src/cdk/schematics/ng-add/schema.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
"project": {
88
"type": "string",
99
"description": "The name of the project.",
10+
"pattern": "^(?:@[a-zA-Z0-9-*~][a-zA-Z0-9-*._~]*/)?[a-zA-Z0-9-~][a-zA-Z0-9-._~]*$",
1011
"$default": {
1112
"$source": "projectName"
1213
}

src/cdk/schematics/utils/build-component.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ import {InsertChange} from '@schematics/angular/utility/change';
2727
import {getWorkspace} from '@schematics/angular/utility/workspace';
2828
import {buildRelativePath, findModuleFromOptions} from '@schematics/angular/utility/find-module';
2929
import {parseName} from '@schematics/angular/utility/parse-name';
30-
import {validateHtmlSelector, validateName} from '@schematics/angular/utility/validation';
30+
import {validateHtmlSelector} from '@schematics/angular/utility/validation';
3131
import {ProjectType} from '@schematics/angular/utility/workspace-models';
3232
import {readFileSync, statSync} from 'fs';
3333
import {dirname, join, resolve} from 'path';
@@ -200,7 +200,6 @@ export function buildComponent(
200200
options.path = parsedPath.path;
201201
options.selector = options.selector || buildSelector(options, project.prefix);
202202

203-
validateName(options.name);
204203
validateHtmlSelector(options.selector!);
205204

206205
// In case the specified style extension is not part of the supported CSS supersets,

src/material/schematics/ng-add/schema.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
"project": {
88
"type": "string",
99
"description": "Name of the project.",
10+
"pattern": "^(?:@[a-zA-Z0-9-*~][a-zA-Z0-9-*._~]*/)?[a-zA-Z0-9-~][a-zA-Z0-9-._~]*$",
1011
"$default": {
1112
"$source": "projectName"
1213
}

src/material/schematics/ng-update/migrations/hammer-gestures-v9/import-manager.ts

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,9 @@ interface AnalyzedImport {
3939
/** Checks whether an analyzed import has the given import flag set. */
4040
const hasFlag = (data: AnalyzedImport, flag: ImportState) => (data.state & flag) !== 0;
4141

42+
/** Parsed version of TypeScript that can be used for comparisons. */
43+
const PARSED_TS_VERSION = parseFloat(ts.versionMajorMinor);
44+
4245
/**
4346
* Import manager that can be used to add or remove TypeScript imports within source
4447
* files. The manager ensures that multiple transformations are applied properly
@@ -346,7 +349,7 @@ export class ImportManager {
346349
if (importData.specifiers) {
347350
const namedBindings = importData.node.importClause!.namedBindings as ts.NamedImports;
348351
const importSpecifiers = importData.specifiers.map(s =>
349-
ts.createImportSpecifier(s.propertyName, s.name),
352+
createImportSpecifier(s.propertyName, s.name),
350353
);
351354
const updatedBindings = ts.updateNamedImports(namedBindings, importSpecifiers);
352355

@@ -361,6 +364,7 @@ export class ImportManager {
361364
undefined,
362365
ts.createImportClause(undefined, updatedBindings),
363366
ts.createStringLiteral(importData.moduleName),
367+
undefined,
364368
);
365369
const newImportText = this._printer.printNode(
366370
ts.EmitHint.Unspecified,
@@ -523,3 +527,14 @@ export class ImportManager {
523527
return commentRanges[commentRanges.length - 1]!.end;
524528
}
525529
}
530+
531+
// TODO(crisbeto): backwards-compatibility layer that allows us to support both TS 4.4 and 4.5.
532+
// Should be removed once we don't have to support 4.4 anymore.
533+
function createImportSpecifier(
534+
propertyName: ts.Identifier | undefined,
535+
name: ts.Identifier,
536+
): ts.ImportSpecifier {
537+
return PARSED_TS_VERSION > 4.4
538+
? (ts.createImportSpecifier as any)(false, propertyName, name)
539+
: (ts.createImportSpecifier as any)(propertyName, name);
540+
}

0 commit comments

Comments
 (0)