-
Notifications
You must be signed in to change notification settings - Fork 12k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test(@angular-devkit/build-angular): refactor platform server test to…
… use universal schematic Using `@nguniversal/express-engine` requires a lot of maintenance and manual updates to set the correct versions of `@angular-devkit/architect` and `'@angular-devkit/core`. This is because `@nguniversal/express-engine` can rely on different versions of this packages from the local built versions which would cause package installations failure.
- Loading branch information
1 parent
2f2ca78
commit b5218d4
Showing
1 changed file
with
6 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,17 @@ | ||
import { normalize } from 'path'; | ||
import { getGlobalVariable } from '../../utils/env'; | ||
import { appendToFile, expectFileToMatch, writeFile } from '../../utils/fs'; | ||
import { appendToFile, expectFileToMatch, replaceInFile, writeFile } from '../../utils/fs'; | ||
import { installPackage } from '../../utils/packages'; | ||
import { exec, ng, silentNpm } from '../../utils/process'; | ||
import { isPrereleaseCli, updateJsonFile } from '../../utils/project'; | ||
import { exec, ng } from '../../utils/process'; | ||
import { updateJsonFile } from '../../utils/project'; | ||
|
||
const snapshots = require('../../ng-snapshot/package.json'); | ||
|
||
export default async function () { | ||
const argv = getGlobalVariable('argv'); | ||
const veEnabled = argv['ve']; | ||
const tag = (await isPrereleaseCli()) ? 'next' : 'latest'; | ||
|
||
// @nguniversal/express-engine currently relies on ^0.1100.0-rc.2 of @angular-devkit/architect | ||
// which is not present in the local package registry and not semver compatible with ^11.0.0-next.7 | ||
const { stdout: stdout1 } = await silentNpm('pack', '@angular-devkit/[email protected]', '--registry=https://registry.npmjs.org'); | ||
await silentNpm('publish', stdout1.trim(), '--registry=http://localhost:4873', '--tag=minor'); | ||
|
||
// @nguniversal/express-engine currently relies on ^11.0.0-rc.2 of @angular-devkit/core | ||
// which is not present in the local package registry and not semver compatible prerelease version of ^11.0.0-next.7 | ||
const { stdout: stdout2 } = await silentNpm('pack', '@angular-devkit/[email protected]', '--registry=https://registry.npmjs.org'); | ||
await silentNpm('publish', stdout2.trim(), '--registry=http://localhost:4873', '--tag=minor'); | ||
|
||
await ng('add', `@nguniversal/express-engine@${tag}`); | ||
await ng('generate', 'universal', '--client-project', 'test-project'); | ||
|
||
const isSnapshotBuild = getGlobalVariable('argv')['ng-snapshots']; | ||
if (isSnapshotBuild) { | ||
|
@@ -82,6 +71,8 @@ export default async function () { | |
); | ||
} | ||
|
||
await replaceInFile('tsconfig.server.json', 'src/main.server.ts', 'server.ts'); | ||
await replaceInFile('angular.json', 'src/main.server.ts', 'server.ts'); | ||
|
||
await ng('run', 'test-project:server:production', '--optimization', 'false'); | ||
|
||
|