Skip to content

Commit 809a4ed

Browse files
JeanMechethePunderWoman
authored andcommitted
feat(core): Add migration for zoneless by default. (#63042)
This commit adds a migration that updates applications enable Zone change detection when Angular is zoneless by default. PR Close #63042
1 parent 1352fbd commit 809a4ed

File tree

8 files changed

+3691
-2
lines changed

8 files changed

+3691
-2
lines changed

packages/core/schematics/BUILD.bazel

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,10 @@ bundle_entrypoints = [
123123
"add-bootstrap-context-to-server-main",
124124
"packages/core/schematics/migrations/add-bootstrap-context-to-server-main/index.js",
125125
],
126+
[
127+
"bootstrap-options-migration",
128+
"packages/core/schematics/migrations/bootstrap-options-migration/index.js",
129+
],
126130
]
127131

128132
rollup.rollup(
@@ -136,6 +140,7 @@ rollup.rollup(
136140
"//packages/core/schematics:tsconfig_build",
137141
"//packages/core/schematics/migrations/add-bootstrap-context-to-server-main",
138142
"//packages/core/schematics/migrations/application-config-core",
143+
"//packages/core/schematics/migrations/bootstrap-options-migration",
139144
"//packages/core/schematics/migrations/control-flow-migration",
140145
"//packages/core/schematics/migrations/ngclass-to-class-migration",
141146
"//packages/core/schematics/migrations/ngstyle-to-style-migration",

packages/core/schematics/migrations.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,11 @@
2626
"version": "21.0.0",
2727
"description": "Adds `BootstrapContext` to `bootstrapApplication` calls in `main.server.ts` to support server rendering.",
2828
"factory": "./bundles/add-bootstrap-context-to-server-main.cjs#migrate"
29+
},
30+
"bootstrap-options-migration": {
31+
"version": "21.0.0",
32+
"description": "Migrates deprecated bootstrap options to providers.",
33+
"factory": "./bundles/bootstrap-options-migration.cjs#migrate"
2934
}
3035
}
3136
}
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
load("//tools:defaults.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)