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 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 | 1x 1x 1x 1x 1x 1x 1x 4x 2x 2x 4x 4x 4x 4x 4x 2x 2x 1x 4x 1x 4x | import { Rule, chain, Tree } from '@angular-devkit/schematics';
import * as path from 'path';
import { updateScript, updatePeerDependencyVersionsInLib } from './utils/package-json';
import { tryRule } from './utils/rules';
import { getWorkspace, getLibProjects } from '../utils/backbase/package-utils';
const manualProcess = `
## Ensure dependencies are up to date
Update all important dependencies using \`ng update\`. This will allow any these packages to
perform any migrations that they deem necessary.
ng update @angular/cli@12 @angular/core@12 @bb-cli/bb-ang@6
## Modify the "update" script in package.json
Change the update script from version ^5 to ^6 for @bb-cli/schematics:
"scripts": {
"update": "ng update @bb-cli/schematics@^6",
}
## Make sure the version of @bb-cli/bb-ang is ~6.0.0
$ npm install --save-dev @bb-cli/bb-ang@~6.0.0
## Update peer dependency versions in all public libs
The peerDependencies of all libs in a project should be aligned with the package versions actually
installed in the project. This means that development and tests can be performed against compatible
versions of the target dependencies.
Any peerDependencies in package.json files inside libs packages should be updated to be compatible
with the following versions:
@angular/animations: 12.2.10,
@angular/common: 12.2.10,
@angular/compiler: 12.2.10,
@angular/core: 12.2.10,
@angular/forms: 12.2.10,
@angular/platform-browser: 12.2.10,
@angular/platform-browser-dynamic: 12.2.10,
@angular/router: 12.2.10,
@backbase/foundation-ang: 6.15.1
Note: This *does not* mean that the version must be locked - the semver range should reflect the
most liberal version(s) the library supports.
`;
const updateUpdateScript: Rule = updateScript('update', (oldScript) => {
if (!oldScript) {
return 'ng update @bb-cli/schematics@^6';
}
return oldScript.replace('@bb-cli/schematics@^5', '@bb-cli/schematics@^6');
});
const updatePeerDependencyVersionsInAllLibs: Rule = async (tree: Tree) => {
const targetPackageVersions = {
'@angular/animations': '12.2.10',
'@angular/common': '12.2.10',
'@angular/compiler': '12.2.10',
'@angular/core': '12.2.10',
'@angular/forms': '12.2.10',
'@angular/platform-browser': '12.2.10',
'@angular/platform-browser-dynamic': '12.2.10',
'@angular/router': '12.2.10',
'@backbase/foundation-ang': '6.15.1',
};
const workspace = await getWorkspace(tree);
const packageJsonPaths = getLibProjects(workspace).map((project) => path.join(project.root, 'package.json'));
for (const packageJsonPath of packageJsonPaths) {
try {
updatePeerDependencyVersionsInLib(tree, packageJsonPath, targetPackageVersions);
} catch (e) {
continue;
}
}
return () => tree;
};
export default function (): Rule {
return tryRule(chain([updateUpdateScript, updatePeerDependencyVersionsInAllLibs]), manualProcess);
}
|