Skip to content

Commit

Permalink
fix(@schematics/angular): improve cli migration name and description (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
alan-agius4 authored and mgechev committed Nov 8, 2019
1 parent f1d3201 commit d5fc14e
Show file tree
Hide file tree
Showing 8 changed files with 49 additions and 49 deletions.
2 changes: 1 addition & 1 deletion packages/angular/cli/commands/update-impl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ export class UpdateCommand extends Command<UpdateCommandSchema> {

// Commit migration
if (commit) {
let message = `${packageName} migration - ${migration.name}.`;
let message = `${packageName} migration - ${migration.name}`;
if (migration.description) {
message += '\n' + migration.description;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,15 +40,15 @@
"factory": "./update-8/#updateLazyModulePaths",
"description": "Update an Angular CLI project to version 8."
},
"migration-09": {
"workspace-version-9": {
"version": "9.0.0-beta.0",
"factory": "./update-9",
"description": "Update an Angular CLI project to version 9."
"description": "Angular Workspace migration. Update an Angular CLI workspace to version 9."
},
"migration-10": {
"lazy-loading-syntax": {
"version": "9.0.0-next.6",
"factory": "./update-8/#updateLazyModulePaths",
"description": "Update lazy loading syntax to use dynamic imports."
"description": "Lazy loading syntax migration. Update lazy loading syntax to use dynamic imports."
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ describe('Migration to version 9', () => {

updateWorkspaceTargets(tree, config);

const tree2 = await schematicRunner.runSchematicAsync('migration-09', {}, tree.branch()).toPromise();
const tree2 = await schematicRunner.runSchematicAsync('workspace-version-9', {}, tree.branch()).toPromise();
config = getWorkspaceTargets(tree2).build;
expect(config.configurations.production.tsConfig).toEqual(libProdTsConfig);
expect(tree2.exists(libProdTsConfig)).toBeTruthy();
Expand All @@ -82,7 +82,7 @@ describe('Migration to version 9', () => {

updateWorkspaceTargets(tree, config);

const tree2 = await schematicRunner.runSchematicAsync('migration-09', {}, tree.branch()).toPromise();
const tree2 = await schematicRunner.runSchematicAsync('workspace-version-9', {}, tree.branch()).toPromise();
config = getWorkspaceTargets(tree2).build;
expect(config.configurations.production.tsConfig).toEqual(libProdTsConfig);
expect(tree2.exists(libProdTsConfig)).toBeTruthy();
Expand All @@ -94,7 +94,7 @@ describe('Migration to version 9', () => {

updateWorkspaceTargets(tree, config);

const tree2 = await schematicRunner.runSchematicAsync('migration-09', {}, tree.branch()).toPromise();
const tree2 = await schematicRunner.runSchematicAsync('workspace-version-9', {}, tree.branch()).toPromise();
config = getWorkspaceTargets(tree2).build;
expect(config.configurations.production.tsConfig).toEqual(libProdTsConfig);
expect(tree2.exists(libProdTsConfig)).toBeTruthy();
Expand All @@ -113,7 +113,7 @@ describe('Migration to version 9', () => {

tree.create(prodLibTsConfig, JSON.stringify(tsconfig, undefined, 2));

const tree2 = await schematicRunner.runSchematicAsync('migration-09', {}, tree.branch()).toPromise();
const tree2 = await schematicRunner.runSchematicAsync('workspace-version-9', {}, tree.branch()).toPromise();
config = getWorkspaceTargets(tree2).build;
expect(config.configurations.production.tsConfig).toEqual(prodLibTsConfig);

Expand All @@ -137,7 +137,7 @@ describe('Migration to version 9', () => {

tree.create(prodLibTsConfig, JSON.stringify(tsconfig, undefined, 2));

const tree2 = await schematicRunner.runSchematicAsync('migration-09', {}, tree.branch()).toPromise();
const tree2 = await schematicRunner.runSchematicAsync('workspace-version-9', {}, tree.branch()).toPromise();
config = getWorkspaceTargets(tree2).build;
expect(config.configurations.production.tsConfig).toEqual(prodLibTsConfig);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ describe('Migration to version 9', () => {

tree.create(ngswConfigPath, ngswConfig);

const tree2 = await schematicRunner.runSchematicAsync('migration-09', {}, tree.branch()).toPromise();
const tree2 = await schematicRunner.runSchematicAsync('workspace-version-9', {}, tree.branch()).toPromise();
const { assetGroups } = JSON.parse(tree2.readContent(ngswConfigPath));
expect(assetGroups[0].resources.files).toEqual([
'/favicon.ico',
Expand Down Expand Up @@ -127,7 +127,7 @@ describe('Migration to version 9', () => {

tree.create(ngswConfigPath, ngswConfig);

const tree2 = await schematicRunner.runSchematicAsync('migration-09', {}, tree.branch()).toPromise();
const tree2 = await schematicRunner.runSchematicAsync('workspace-version-9', {}, tree.branch()).toPromise();
const { assetGroups } = JSON.parse(tree2.readContent(ngswConfigPath));
expect(assetGroups[0].resources.files).toEqual([
'/manifest.webmanifest',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ describe('Migration to version 9', () => {

tree.overwrite(libTsConfig, JSON.stringify(tsconfig, undefined, 2));

const tree2 = await schematicRunner.runSchematicAsync('migration-09', {}, tree.branch()).toPromise();
const tree2 = await schematicRunner.runSchematicAsync('workspace-version-9', {}, tree.branch()).toPromise();
const { angularCompilerOptions } = JSON.parse(tree2.readContent(libTsConfig));
expect(angularCompilerOptions).toEqual({ enableIvy: false, skipTemplateCodegen: true });
});
Expand All @@ -75,7 +75,7 @@ describe('Migration to version 9', () => {
};

tree.overwrite('/package.json', JSON.stringify(packageJson, undefined, 2));
const tree2 = await schematicRunner.runSchematicAsync('migration-09', {}, tree.branch()).toPromise();
const tree2 = await schematicRunner.runSchematicAsync('workspace-version-9', {}, tree.branch()).toPromise();
const { dependencies, devDependencies } = JSON.parse(tree2.readContent('/package.json'));
expect(dependencies['tsickle']).toBeUndefined();
expect(devDependencies['tsickle']).toBeUndefined();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ describe('Migration to version 9', () => {

it('should update apps tsConfig with stricter files inclusions', async () => {
overrideJsonFile(tree, 'tsconfig.app.json', defaultTsConfigOptions);
const tree2 = await schematicRunner.runSchematicAsync('migration-09', {}, tree.branch()).toPromise();
const tree2 = await schematicRunner.runSchematicAsync('workspace-version-9', {}, tree.branch()).toPromise();
const { exclude, files } = JSON.parse(tree2.readContent('tsconfig.app.json'));
expect(exclude).toBeUndefined();
expect(files).toEqual(['src/main.ts', 'src/polyfills.ts']);
Expand All @@ -72,7 +72,7 @@ describe('Migration to version 9', () => {

overrideJsonFile(tree, 'tsconfig.app.json', tsConfigContent);

const tree2 = await schematicRunner.runSchematicAsync('migration-09', {}, tree.branch()).toPromise();
const tree2 = await schematicRunner.runSchematicAsync('workspace-version-9', {}, tree.branch()).toPromise();
const { files, include } = JSON.parse(tree2.readContent('tsconfig.app.json'));
expect(files).toEqual(['src/main.ts', 'src/polyfills.ts']);
expect(include).toEqual(['foo.ts']);
Expand All @@ -87,7 +87,7 @@ describe('Migration to version 9', () => {

overrideJsonFile(tree, 'tsconfig.app.json', tsConfigContent);

const tree2 = await schematicRunner.runSchematicAsync('migration-09', {}, tree.branch()).toPromise();
const tree2 = await schematicRunner.runSchematicAsync('workspace-version-9', {}, tree.branch()).toPromise();
const { files, include, exclude } = JSON.parse(tree2.readContent('tsconfig.app.json'));
expect(files).toEqual(['src/main.ts', 'src/polyfills.ts']);
expect(include).toEqual(['src/**/*.d.ts']);
Expand All @@ -102,7 +102,7 @@ describe('Migration to version 9', () => {

overrideJsonFile(tree, 'tsconfig.app.json', tsConfigContent);

const tree2 = await schematicRunner.runSchematicAsync('migration-09', {}, tree.branch()).toPromise();
const tree2 = await schematicRunner.runSchematicAsync('workspace-version-9', {}, tree.branch()).toPromise();
const { files, include, exclude } = JSON.parse(tree2.readContent('tsconfig.app.json'));
expect(files).toEqual(['src/main.ts', 'src/polyfills.ts']);
expect(include).toEqual(['foo.ts', 'src/**/*.d.ts']);
Expand All @@ -111,7 +111,7 @@ describe('Migration to version 9', () => {

it(`should remove angularCompilerOptions when enableIvy is true and it's the only option`, async () => {
overrideJsonFile(tree, 'tsconfig.app.json', defaultTsConfigOptions);
const tree2 = await schematicRunner.runSchematicAsync('migration-09', {}, tree.branch()).toPromise();
const tree2 = await schematicRunner.runSchematicAsync('workspace-version-9', {}, tree.branch()).toPromise();
const { angularCompilerOptions } = JSON.parse(tree2.readContent('tsconfig.app.json'));
expect(angularCompilerOptions).toBeUndefined();
});
Expand All @@ -126,7 +126,7 @@ describe('Migration to version 9', () => {
};

overrideJsonFile(tree, 'tsconfig.app.json', tsConfigContent);
const tree2 = await schematicRunner.runSchematicAsync('migration-09', {}, tree.branch()).toPromise();
const tree2 = await schematicRunner.runSchematicAsync('workspace-version-9', {}, tree.branch()).toPromise();
const { angularCompilerOptions } = JSON.parse(tree2.readContent('tsconfig.app.json'));
expect(angularCompilerOptions.enableIvy).toBeUndefined();
expect(angularCompilerOptions.fullTemplateTypeCheck).toBe(true);
Expand All @@ -142,7 +142,7 @@ describe('Migration to version 9', () => {
};

overrideJsonFile(tree, 'tsconfig.app.json', tsConfigContent);
const tree2 = await schematicRunner.runSchematicAsync('migration-09', {}, tree.branch()).toPromise();
const tree2 = await schematicRunner.runSchematicAsync('workspace-version-9', {}, tree.branch()).toPromise();
const { angularCompilerOptions } = JSON.parse(tree2.readContent('tsconfig.app.json'));
expect(angularCompilerOptions.enableIvy).toBe(false);
expect(angularCompilerOptions.fullTemplateTypeCheck).toBe(true);
Expand All @@ -158,7 +158,7 @@ describe('Migration to version 9', () => {
};

overrideJsonFile(tree, 'tsconfig.app.json', tsConfigContent);
const tree2 = await schematicRunner.runSchematicAsync('migration-09', {}, tree.branch()).toPromise();
const tree2 = await schematicRunner.runSchematicAsync('workspace-version-9', {}, tree.branch()).toPromise();
const { compilerOptions } = JSON.parse(tree2.readContent('tsconfig.app.json'));
expect(compilerOptions.module).toBeUndefined();

Expand All @@ -177,7 +177,7 @@ describe('Migration to version 9', () => {
};

overrideJsonFile(tree, 'tsconfig.app.json', tsConfigContent);
const tree2 = await schematicRunner.runSchematicAsync('migration-09', {}, tree.branch()).toPromise();
const tree2 = await schematicRunner.runSchematicAsync('workspace-version-9', {}, tree.branch()).toPromise();
const { compilerOptions } = JSON.parse(tree2.readContent('tsconfig.app.json'));
expect(compilerOptions.module).toBe('esnext');
});
Expand Down Expand Up @@ -206,7 +206,7 @@ describe('Migration to version 9', () => {
.toPromise();

overrideJsonFile(tree, 'tsconfig.server.json', tsConfigContent);
const tree2 = await schematicRunner.runSchematicAsync('migration-09', {}, tree.branch()).toPromise();
const tree2 = await schematicRunner.runSchematicAsync('workspace-version-9', {}, tree.branch()).toPromise();
const { compilerOptions } = JSON.parse(tree2.readContent('tsconfig.server.json'));
expect(compilerOptions.module).toBe('commonjs');
});
Expand All @@ -218,7 +218,7 @@ describe('Migration to version 9', () => {
};

overrideJsonFile(tree, 'tsconfig.json', tsConfigContent);
const tree2 = await schematicRunner.runSchematicAsync('migration-09', {}, tree.branch()).toPromise();
const tree2 = await schematicRunner.runSchematicAsync('workspace-version-9', {}, tree.branch()).toPromise();
const { compilerOptions } = JSON.parse(tree2.readContent('tsconfig.json'));
expect(compilerOptions.module).toBe('esnext');
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ describe('Migration to version 9', () => {

it(`should add exports from '@angular/platform-server'`, async () => {
tree.overwrite(mainServerFile, mainServerContent);
const tree2 = await schematicRunner.runSchematicAsync('migration-09', {}, tree.branch()).toPromise();
const tree2 = await schematicRunner.runSchematicAsync('workspace-version-9', {}, tree.branch()).toPromise();
expect(tree2.readContent(mainServerFile)).toContain(tags.stripIndents`
export { AppServerModule } from './app/app.server.module';
export { renderModule, renderModuleFactory } from '@angular/platform-server';
Expand All @@ -74,7 +74,7 @@ describe('Migration to version 9', () => {
export { platformDynamicServer } from '@angular/platform-server';
export { PlatformConfig } from '@angular/platform-server';
`);
const tree2 = await schematicRunner.runSchematicAsync('migration-09', {}, tree.branch()).toPromise();
const tree2 = await schematicRunner.runSchematicAsync('workspace-version-9', {}, tree.branch()).toPromise();
expect(tree2.readContent(mainServerFile)).toContain(tags.stripIndents`
export { AppServerModule } from './app/app.server.module';
export { platformDynamicServer, renderModule, renderModuleFactory } from '@angular/platform-server';
Expand All @@ -87,7 +87,7 @@ describe('Migration to version 9', () => {
${mainServerContent}
export { platformDynamicServer, renderModuleFactory } from '@angular/platform-server';
`);
const tree2 = await schematicRunner.runSchematicAsync('migration-09', {}, tree.branch()).toPromise();
const tree2 = await schematicRunner.runSchematicAsync('workspace-version-9', {}, tree.branch()).toPromise();
expect(tree2.readContent(mainServerFile)).toContain(tags.stripIndents`
export { AppServerModule } from './app/app.server.module';
export { platformDynamicServer, renderModuleFactory, renderModule } from '@angular/platform-server';
Expand All @@ -101,7 +101,7 @@ describe('Migration to version 9', () => {
`;

tree.overwrite(mainServerFile, input);
const tree2 = await schematicRunner.runSchematicAsync('migration-09', {}, tree.branch()).toPromise();
const tree2 = await schematicRunner.runSchematicAsync('workspace-version-9', {}, tree.branch()).toPromise();
expect(tree2.readContent(mainServerFile)).toBe(input);
});
});
Expand Down
Loading

0 comments on commit d5fc14e

Please sign in to comment.