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:
Paul Gschwendtner 2019-08-27 15:09:09 +02:00 committed by Miško Hevery
parent b4d3468088
commit 3af99a7b4a
5 changed files with 8 additions and 13 deletions

View File

@ -10,6 +10,7 @@ npm_package(
srcs = ["migrations.json"],
visibility = ["//packages/core:__pkg__"],
deps = [
"//packages/core/schematics/migrations/missing-injectable",
"//packages/core/schematics/migrations/move-document",
"//packages/core/schematics/migrations/renderer-to-renderer2",
"//packages/core/schematics/migrations/static-queries",

View File

@ -20,6 +20,11 @@
"description": "Migrates usages of Renderer to Renderer2",
"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": {
"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.",

View File

@ -5,7 +5,6 @@ ts_library(
testonly = True,
srcs = glob(["**/*.ts"]),
data = [
"test-migrations.json",
"//packages/core/schematics:migrations.json",
],
deps = [

View File

@ -21,7 +21,7 @@ describe('Missing injectable migration', () => {
let warnOutput: string[];
beforeEach(() => {
runner = new SchematicTestRunner('test', require.resolve('./test-migrations.json'));
runner = new SchematicTestRunner('test', require.resolve('../migrations.json'));
host = new TempScopedNodeJsSyncHost();
tree = new UnitTestTree(new HostTree(host));
@ -61,7 +61,7 @@ describe('Missing injectable migration', () => {
}
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() => {

View File

@ -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"
}
}
}