Skip to content

Commit

Permalink
fix(@angular/cli): improve statues and description logs during update
Browse files Browse the repository at this point in the history
With this change we improve the log messages of migration;

> the migration description
> the outcome of the migration
> we also remove the version of the migration which was misleading (Ex: 9.0.0-beta)
  • Loading branch information
alan-agius4 authored and vikerman committed Oct 30, 2019
1 parent 77714cc commit 94b48d7
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions packages/angular/cli/commands/update-impl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -166,10 +166,12 @@ export class UpdateCommand extends Command<UpdateCommandSchema> {

migrations.sort((a, b) => semver.compare(a.version, b.version) || a.name.localeCompare(b.name));

this.logger.info(
colors.cyan(`** Executing migrations of package '${packageName}' **\n`),
);

for (const migration of migrations) {
this.logger.info(
`** Executing migrations for version ${migration.version} of package '${packageName}' **`,
);
this.logger.info(`${colors.symbols.pointer} ${migration.description.replace(/\. /g, '.\n ')}`);

const result = await this.executeSchematic(migration.collection.name, migration.name);
if (!result.success) {
Expand All @@ -180,6 +182,8 @@ export class UpdateCommand extends Command<UpdateCommandSchema> {
}
}

this.logger.error(`${colors.symbols.cross} Migration failed. See above for further details.\n`);

return false;
}

Expand All @@ -192,6 +196,8 @@ export class UpdateCommand extends Command<UpdateCommandSchema> {
// TODO: Use result.files once package install tasks are accounted
this.createCommit(message, []);
}

this.logger.info(colors.green(`${colors.symbols.check} Migration succeeded.\n`));
}

return true;
Expand Down Expand Up @@ -265,11 +271,11 @@ export class UpdateCommand extends Command<UpdateCommandSchema> {
if (!statusCheck && !this.checkCleanGit()) {
if (options.allowDirty) {
this.logger.warn(
'Repository is not clean. Update changes will be mixed with pre-existing changes.',
'Repository is not clean. Update changes will be mixed with pre-existing changes.',
);
} else {
this.logger.error(
'Repository is not clean. Please commit or stash any changes before updating.',
'Repository is not clean. Please commit or stash any changes before updating.',
);

return 2;
Expand Down

0 comments on commit 94b48d7

Please sign in to comment.