refactor(core): wire up missing-injectable migration for ng-update (#32349)
Initially the `missing-injectable` migration was only being used in google3. Wiring the migration up in the CLI migrations was planned to be done in a follow-up. PR Close #32349
This commit is contained in:
parent
b4d3468088
commit
3af99a7b4a
|
@ -10,6 +10,7 @@ npm_package(
|
||||||
srcs = ["migrations.json"],
|
srcs = ["migrations.json"],
|
||||||
visibility = ["//packages/core:__pkg__"],
|
visibility = ["//packages/core:__pkg__"],
|
||||||
deps = [
|
deps = [
|
||||||
|
"//packages/core/schematics/migrations/missing-injectable",
|
||||||
"//packages/core/schematics/migrations/move-document",
|
"//packages/core/schematics/migrations/move-document",
|
||||||
"//packages/core/schematics/migrations/renderer-to-renderer2",
|
"//packages/core/schematics/migrations/renderer-to-renderer2",
|
||||||
"//packages/core/schematics/migrations/static-queries",
|
"//packages/core/schematics/migrations/static-queries",
|
||||||
|
|
|
@ -20,6 +20,11 @@
|
||||||
"description": "Migrates usages of Renderer to Renderer2",
|
"description": "Migrates usages of Renderer to Renderer2",
|
||||||
"factory": "./migrations/renderer-to-renderer2/index"
|
"factory": "./migrations/renderer-to-renderer2/index"
|
||||||
},
|
},
|
||||||
|
"migration-v9-missing-injectable": {
|
||||||
|
"version": "9-beta",
|
||||||
|
"description": "Decorates all declared undecorated provider classes with @Injectable",
|
||||||
|
"factory": "./migrations/missing-injectable/index"
|
||||||
|
},
|
||||||
"migration-v9-undecorated-classes-with-di": {
|
"migration-v9-undecorated-classes-with-di": {
|
||||||
"version": "9-beta",
|
"version": "9-beta",
|
||||||
"description": "Decorates undecorated base classes of directives/components that use dependency injection. Copies metadata from base classes to derived directives/components/pipes that are not decorated.",
|
"description": "Decorates undecorated base classes of directives/components that use dependency injection. Copies metadata from base classes to derived directives/components/pipes that are not decorated.",
|
||||||
|
|
|
@ -5,7 +5,6 @@ ts_library(
|
||||||
testonly = True,
|
testonly = True,
|
||||||
srcs = glob(["**/*.ts"]),
|
srcs = glob(["**/*.ts"]),
|
||||||
data = [
|
data = [
|
||||||
"test-migrations.json",
|
|
||||||
"//packages/core/schematics:migrations.json",
|
"//packages/core/schematics:migrations.json",
|
||||||
],
|
],
|
||||||
deps = [
|
deps = [
|
||||||
|
|
|
@ -21,7 +21,7 @@ describe('Missing injectable migration', () => {
|
||||||
let warnOutput: string[];
|
let warnOutput: string[];
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
runner = new SchematicTestRunner('test', require.resolve('./test-migrations.json'));
|
runner = new SchematicTestRunner('test', require.resolve('../migrations.json'));
|
||||||
host = new TempScopedNodeJsSyncHost();
|
host = new TempScopedNodeJsSyncHost();
|
||||||
tree = new UnitTestTree(new HostTree(host));
|
tree = new UnitTestTree(new HostTree(host));
|
||||||
|
|
||||||
|
@ -61,7 +61,7 @@ describe('Missing injectable migration', () => {
|
||||||
}
|
}
|
||||||
|
|
||||||
async function runMigration() {
|
async function runMigration() {
|
||||||
await runner.runSchematicAsync('migration-missing-injectable', {}, tree).toPromise();
|
await runner.runSchematicAsync('migration-v9-missing-injectable', {}, tree).toPromise();
|
||||||
}
|
}
|
||||||
|
|
||||||
it('should migrate type provider in NgModule', async() => {
|
it('should migrate type provider in NgModule', async() => {
|
||||||
|
|
|
@ -1,10 +0,0 @@
|
||||||
{
|
|
||||||
// Migrations which are not publicly enabled but still run as part of tests need to
|
|
||||||
// be part of a schematic collection in order to be able to run it.
|
|
||||||
"schematics": {
|
|
||||||
"migration-missing-injectable": {
|
|
||||||
"description": "Migrates all declared undecorated providers with the @Injectable decorator",
|
|
||||||
"factory": "../migrations/missing-injectable/index"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
Reference in New Issue