Skip to content

Commit e75eb74

Browse files
committed
feat(core): Add migration for zoneless by default.
This commit adds a migration that updates applications enable Zone change detection when Angular is zoneless by default.
1 parent 1a26fd3 commit e75eb74

File tree

8 files changed

+3204
-2
lines changed

8 files changed

+3204
-2
lines changed

packages/core/schematics/BUILD.bazel

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,10 @@ bundle_entrypoints = [
110110
"router-last-successful-navigation",
111111
"packages/core/schematics/migrations/router-last-successful-navigation/index.js",
112112
],
113+
[
114+
"bootstrap-options-migration",
115+
"packages/core/schematics/migrations/bootstrap-options-migration/index.js",
116+
],
113117
]
114118

115119
rollup.rollup(
@@ -121,6 +125,7 @@ rollup.rollup(
121125
"//:node_modules/magic-string",
122126
"//:node_modules/semver",
123127
"//packages/core/schematics:tsconfig_build",
128+
"//packages/core/schematics/migrations/bootstrap-options-migration",
124129
"//packages/core/schematics/migrations/control-flow-migration",
125130
"//packages/core/schematics/migrations/ngclass-to-class-migration",
126131
"//packages/core/schematics/migrations/router-current-navigation",

packages/core/schematics/migrations.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,11 @@
1616
"version": "21.0.0",
1717
"description": "Ensures that the Router.lastSuccessfulNavigation signal is now invoked",
1818
"factory": "./bundles/router-last-successful-navigation.cjs#migrate"
19+
},
20+
"bootstrap-options-migration": {
21+
"version": "21.0.0",
22+
"description": "Migrates deprecated bootstrap options to providers.",
23+
"factory": "./bundles/bootstrap-options-migration.cjs#migrate"
1924
}
2025
}
2126
}
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
load("//tools:defaults2.bzl", "jasmine_test", "ts_project")
2+
3+
package(
4+
default_visibility = [
5+
"//packages/core/schematics:__pkg__",
6+
"//packages/core/schematics/test:__pkg__",
7+
],
8+
)
9+
10+
ts_project(
11+
name = "bootstrap-options-migration",
12+
srcs = glob(
13+
["**/*.ts"],
14+
exclude = ["*.spec.ts"],
15+
),
16+
deps = [
17+
"//:node_modules/@angular-devkit/schematics",
18+
"//:node_modules/typescript",
19+
"//packages/compiler-cli/private",
20+
"//packages/compiler-cli/src/ngtsc/file_system",
21+
"//packages/core/schematics/utils",
22+
"//packages/core/schematics/utils/tsurge",
23+
"//packages/core/schematics/utils/tsurge/helpers/angular_devkit",
24+
],
25+
)
26+
27+
ts_project(
28+
name = "test_lib",
29+
testonly = True,
30+
srcs = glob(["*.spec.ts"]),
31+
deps = [
32+
":bootstrap-options-migration",
33+
"//:node_modules/typescript",
34+
"//packages/compiler-cli",
35+
"//packages/compiler-cli/src/ngtsc/file_system/testing",
36+
"//packages/core/schematics/utils/tsurge",
37+
],
38+
)
39+
40+
jasmine_test(
41+
name = "test",
42+
data = [":test_lib"],
43+
env = {"FORCE_COLOR": "3"},
44+
)
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
/**
2+
* @license
3+
* Copyright Google LLC All Rights Reserved.
4+
*
5+
* Use of this source code is governed by an MIT-style license that can be
6+
* found in the LICENSE file at https://angular.dev/license
7+
*/
8+
9+
import {Rule} from '@angular-devkit/schematics';
10+
import {runMigrationInDevkit} from '../../utils/tsurge/helpers/angular_devkit';
11+
import {BootstrapOptionsMigration} from './migration';
12+
13+
export function migrate(): Rule {
14+
return async (tree) => {
15+
await runMigrationInDevkit({
16+
tree,
17+
getMigration: () => new BootstrapOptionsMigration(),
18+
});
19+
};
20+
}

0 commit comments

Comments
 (0)