Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 | 39x 39x 39x 39x 39x 39x 39x 39x 86x 86x 1x 85x 8x 8x 8x 8x 85x 8x 85x 85x 85x | import { Rule, SchematicContext, Tree, callRule } from '@angular-devkit/schematics';
import { Observable, of } from 'rxjs';
import { path } from 'ramda';
import { catchError } from 'rxjs/operators';
import { tags } from '@angular-devkit/core';
import { isMigrationFailed, setMigrationFailed } from './migration';
export const tryRule =
(rule: Rule, manualProcess: string): Rule =>
(tree, context: SchematicContext) => {
if (isMigrationFailed()) {
// Skip rules following a migration.
return tree;
}
const handleError = (err: any): Observable<Tree> => {
context.logger.warn(' ⚠ Some issues were detected but could not be fixed automatically.');
context.logger.warn(wrapErr(err));
setMigrationFailed();
return of(tree);
};
const wrapErr = (error: any) =>
tags.stripIndent`
An error occurred while automatically migrating the project. You will need to perform this stage of the migration manually.
# Manual Process
${manualProcessFormatted}
# Continue Migration
Once this stage of the manual migration is complete, you can continue automatic migration by running
ng update --migrate-only --from=${currentSchematic} @bb-cli/schematics
All of the manual steps can be found in the changelog at http://wa3.backbase.com/foundation/latest/changelogs/schematics
${error}
`;
const currentSchematic = path(['schematic', 'description', 'name'], context);
const manualProcessFormatted = tags.indentBy(6)`${manualProcess}`.trim();
return callRule(rule, tree, context).pipe(catchError(handleError));
};
|