|
1 | 1 | import { createProjectFromAsset } from '../../utils/assets';
|
2 |
| -import { expectFileMatchToExist } from '../../utils/fs'; |
3 |
| -import { installWorkspacePackages } from '../../utils/packages'; |
4 |
| -import { ng, noSilentNg, silentNpm } from '../../utils/process'; |
| 2 | +import { getGlobalVariable } from '../../utils/env'; |
| 3 | +import { expectFileMatchToExist, rimraf, writeFile } from '../../utils/fs'; |
| 4 | +import { installWorkspacePackages, setRegistry } from '../../utils/packages'; |
| 5 | +import { ng, noSilentNg } from '../../utils/process'; |
5 | 6 | import { isPrereleaseCli, useBuiltPackages, useCIChrome, useCIDefaults } from '../../utils/project';
|
6 | 7 |
|
7 |
| -export default async function() { |
8 |
| - await createProjectFromAsset('8.0-project'); |
9 |
| - await ng('update', '@angular/cli', '--migrate-only', '--from=8'); |
| 8 | +export default async function () { |
| 9 | + await createProjectFromAsset('8.0-project', true, true); |
| 10 | + |
| 11 | + // We need to use the public registry because in the local NPM server we don't have |
| 12 | + // older versions @angular/cli packages which would cause `npm install` during `ng update` to fail. |
| 13 | + try { |
| 14 | + await setRegistry(false); |
| 15 | + |
| 16 | + await useBuiltPackages(); |
| 17 | + await installWorkspacePackages(); |
| 18 | + |
| 19 | + // Update Angular CLI. |
| 20 | + await ng('update', '@angular/cli', '--migrate-only', '--from=8'); |
| 21 | + } finally { |
| 22 | + await setRegistry(true); |
| 23 | + } |
| 24 | + |
| 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); |
10 | 33 |
|
11 | 34 | // Use the packages we are building in this commit, and CI Chrome.
|
12 | 35 | await useBuiltPackages();
|
13 | 36 | await useCIChrome('./');
|
14 | 37 | await useCIChrome('./e2e/');
|
15 | 38 | await useCIDefaults('eight-project');
|
16 |
| - await installWorkspacePackages(); |
17 | 39 |
|
18 |
| - // Update Angular. |
19 |
| - const extraUpdateArgs = await isPrereleaseCli() ? ['--next', '--force'] : []; |
20 |
| - await ng('update', '@angular/core', ...extraUpdateArgs); |
| 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(); |
21 | 45 |
|
22 | 46 | // Run CLI commands.
|
23 | 47 | await ng('generate', 'component', 'my-comp');
|
|
0 commit comments