|
1 | 1 | import { createProjectFromAsset } from '../../utils/assets';
|
2 | 2 | import { expectFileMatchToExist } from '../../utils/fs';
|
3 |
| -import { installWorkspacePackages } from '../../utils/packages'; |
4 |
| -import { ng, noSilentNg, silentNpm } from '../../utils/process'; |
5 |
| -import { isPrereleaseCli, useBuiltPackages, useCIChrome, useCIDefaults } from '../../utils/project'; |
| 3 | +import { installPackage, installWorkspacePackages, setRegistry } from '../../utils/packages'; |
| 4 | +import { ng, noSilentNg } from '../../utils/process'; |
| 5 | +import { isPrereleaseCli, useCIChrome, useCIDefaults } from '../../utils/project'; |
6 | 6 |
|
7 |
| -export default async function() { |
8 |
| - await createProjectFromAsset('8.0-project'); |
9 |
| - await ng('update', '@angular/cli', '--migrate-only', '--from=8'); |
| 7 | +export default async function () { |
| 8 | + // We need to use the public registry because in the local NPM server we don't have |
| 9 | + // older versions @angular/cli packages which would cause `npm install` during `ng update` to fail. |
| 10 | + try { |
| 11 | + await createProjectFromAsset('8.0-project', true, true); |
10 | 12 |
|
11 |
| - // Use the packages we are building in this commit, and CI Chrome. |
12 |
| - await useBuiltPackages(); |
| 13 | + await setRegistry(false); |
| 14 | + await installWorkspacePackages(); |
| 15 | + |
| 16 | + // Update Angular to 9 |
| 17 | + await installPackage('@angular/cli@8'); |
| 18 | + const { stdout } = await ng('update', '@angular/[email protected]', '@angular/[email protected]'); |
| 19 | + if (!stdout.includes("Executing migrations of package '@angular/cli'")) { |
| 20 | + throw new Error('Update did not execute migrations. OUTPUT: \n' + stdout); |
| 21 | + } |
| 22 | + |
| 23 | + // Update Angular to 10 |
| 24 | + await ng('update', '@angular/cli@10', '@angular/core@10'); |
| 25 | + } finally { |
| 26 | + await setRegistry(true); |
| 27 | + } |
| 28 | + |
| 29 | + // Update Angular current build |
| 30 | + const extraUpdateArgs = isPrereleaseCli() ? ['--next', '--force'] : ['--force']; |
| 31 | + // For the latest/next release we purposely don't add `@angular/core`. |
| 32 | + // This is due to our bumping strategy, which causes a period were `@angular/cli@latest` (v12.0.0) `@angular/core@latest` (v11.2.x) |
| 33 | + // are of different major/minor version on the local NPM server. This causes `ng update` to fail. |
| 34 | + // NB: `ng update @angula/cli` will still cause `@angular/core` packages to be updated. |
| 35 | + await ng('update', '@angular/cli', ...extraUpdateArgs); |
| 36 | + |
| 37 | + // Setup testing to use CI Chrome. |
13 | 38 | await useCIChrome('./');
|
14 | 39 | await useCIChrome('./e2e/');
|
15 | 40 | await useCIDefaults('eight-project');
|
16 |
| - await installWorkspacePackages(); |
17 |
| - |
18 |
| - // Update Angular. |
19 |
| - const extraUpdateArgs = await isPrereleaseCli() ? ['--next', '--force'] : []; |
20 |
| - await ng('update', '@angular/core', ...extraUpdateArgs); |
21 | 41 |
|
22 | 42 | // Run CLI commands.
|
23 | 43 | await ng('generate', 'component', 'my-comp');
|
|
0 commit comments