|
1 | 1 | import { createProjectFromAsset } from '../../utils/assets';
|
2 |
| -import { getGlobalVariable } from '../../utils/env'; |
3 |
| -import { expectFileMatchToExist, rimraf, writeFile } from '../../utils/fs'; |
4 |
| -import { installWorkspacePackages, setRegistry } from '../../utils/packages'; |
| 2 | +import { expectFileMatchToExist } from '../../utils/fs'; |
| 3 | +import { installPackage, installWorkspacePackages, setRegistry } from '../../utils/packages'; |
5 | 4 | import { ng, noSilentNg } from '../../utils/process';
|
6 |
| -import { isPrereleaseCli, useBuiltPackages, useCIChrome, useCIDefaults } from '../../utils/project'; |
| 5 | +import { isPrereleaseCli, useCIChrome, useCIDefaults } from '../../utils/project'; |
7 | 6 |
|
8 | 7 | export default async function () {
|
9 |
| - await createProjectFromAsset('8.0-project', true, true); |
| 8 | + const extraUpdateArgs = await isPrereleaseCli() || true ? ['--next', '--force'] : []; |
10 | 9 |
|
11 | 10 | // We need to use the public registry because in the local NPM server we don't have
|
12 | 11 | // older versions @angular/cli packages which would cause `npm install` during `ng update` to fail.
|
13 | 12 | try {
|
14 |
| - await setRegistry(false); |
| 13 | + await createProjectFromAsset('8.0-project', true, true); |
15 | 14 |
|
16 |
| - await useBuiltPackages(); |
| 15 | + await setRegistry(false); |
17 | 16 | await installWorkspacePackages();
|
18 | 17 |
|
19 |
| - // Update Angular CLI. |
20 |
| - await ng('update', '@angular/cli', '--migrate-only', '--from=8'); |
| 18 | + // Update Angular to 9 |
| 19 | + await installPackage('@angular/cli@8'); |
| 20 | + await ng('update', '@angular/[email protected]', '@angular/[email protected]'); |
| 21 | + |
| 22 | + // Update Angular to 10 |
| 23 | + await ng('update', '@angular/cli@10', '@angular/core@10'); |
| 24 | + |
| 25 | + // Update Angular to 11 (force needed due to codelyzer) |
| 26 | + await ng('update', '@angular/cli@11', '@angular/core@11', '--force'); |
21 | 27 | } finally {
|
22 | 28 | await setRegistry(true);
|
23 | 29 | }
|
24 | 30 |
|
25 |
| - if (!getGlobalVariable('ci')) { |
26 |
| - const testRegistry = getGlobalVariable('package-registry'); |
27 |
| - await writeFile('.npmrc', `registry=${testRegistry}`); |
28 |
| - } |
29 |
| - |
30 |
| - // Update Angular. |
31 |
| - const extraUpdateArgs = await isPrereleaseCli() ? ['--next', '--force'] : []; |
32 |
| - await ng('update', '@angular/core', ...extraUpdateArgs); |
| 31 | + // Update Angular current build |
| 32 | + await ng('update', '@angular/cli', '@angular/core', ...extraUpdateArgs); |
33 | 33 |
|
34 |
| - // Use the packages we are building in this commit, and CI Chrome. |
35 |
| - await useBuiltPackages(); |
| 34 | + // Setup testing to use CI Chrome. |
36 | 35 | await useCIChrome('./');
|
37 | 36 | await useCIChrome('./e2e/');
|
38 | 37 | await useCIDefaults('eight-project');
|
39 | 38 |
|
40 |
| - // This is needed as otherwise causes local modules not to override already present modules |
41 |
| - await rimraf('node_modules/@angular-devkit'); |
42 |
| - await rimraf('node_modules/@angular/cli'); |
43 |
| - |
44 |
| - await installWorkspacePackages(); |
45 |
| - |
46 | 39 | // Run CLI commands.
|
47 | 40 | await ng('generate', 'component', 'my-comp');
|
48 | 41 | await ng('test', '--watch=false');
|
|
0 commit comments