|
1 |
| -import { join } from 'path'; |
2 | 1 | import { expectFileToMatch } from '../../utils/fs';
|
3 |
| -import { ng } from '../../utils/process'; |
| 2 | +import { ng, silentNpm } from '../../utils/process'; |
4 | 3 | import { installPackage, uninstallPackage } from '../../utils/packages';
|
5 | 4 | import { isPrereleaseCli } from '../../utils/project';
|
6 | 5 |
|
7 | 6 | export default async function () {
|
8 |
| - const componentDir = join('src', 'app', 'test-component'); |
| 7 | + // Must publish old version to local registry to allow install. This is especially important |
| 8 | + // for release commits as npm will try to request tooling packages that are not on the npm registry yet |
| 9 | + const { stdout: stdoutPack1 } = await silentNpm( |
| 10 | + 'pack', |
| 11 | + '@schematics/angular@7', |
| 12 | + '--registry=https://registry.npmjs.org', |
| 13 | + ); |
| 14 | + await silentNpm('publish', stdoutPack1.trim(), '--registry=http://localhost:4873', '--tag=outdated'); |
| 15 | + const { stdout: stdoutPack2 } = await silentNpm( |
| 16 | + 'pack', |
| 17 | + '@angular-devkit/core@7', |
| 18 | + '--registry=https://registry.npmjs.org', |
| 19 | + ); |
| 20 | + await silentNpm('publish', stdoutPack2.trim(), '--registry=http://localhost:4873', '--tag=outdated'); |
| 21 | + const { stdout: stdoutPack3 } = await silentNpm( |
| 22 | + 'pack', |
| 23 | + '@angular-devkit/schematics@7', |
| 24 | + '--registry=https://registry.npmjs.org', |
| 25 | + ); |
| 26 | + await silentNpm('publish', stdoutPack3.trim(), '--registry=http://localhost:4873', '--tag=outdated'); |
9 | 27 |
|
10 |
| - // Install old and incompatible version |
11 |
| - // Must directly use npm registry since old versions are not hosted locally |
12 |
| - await installPackage('@schematics/angular@7', 'https://registry.npmjs.org') |
| 28 | + // Install outdated and incompatible version |
| 29 | + await installPackage('@schematics/angular@7'); |
13 | 30 |
|
14 |
| - const tag = await isPrereleaseCli() ? '@next' : ''; |
| 31 | + const tag = (await isPrereleaseCli()) ? '@next' : ''; |
15 | 32 | await ng('add', `@angular/material${tag}`);
|
16 | 33 | await expectFileToMatch('package.json', /@angular\/material/);
|
17 | 34 |
|
|
0 commit comments