build(docs-infra): support building the local `angular-in-memory-web-api` package in `NgPackagesInstaller` (#41313)
In some cases, we want to test the AIO app or docs examples against the locally built `angular-in-memory-web-api` for example to ensure that the changes in a commit do not introduce a breaking changes. PR Close #41313
This commit is contained in:
parent
e0028e5741
commit
300d6d1e38
|
@ -15,6 +15,7 @@ const LOCAL_MARKER_PATH = 'node_modules/_local_.json';
|
|||
const ANGULAR_ROOT_DIR = path.resolve(__dirname, '../../..');
|
||||
const ANGULAR_DIST_PACKAGES_DIR = path.join(ANGULAR_ROOT_DIR, 'dist/packages-dist');
|
||||
const ZONEJS_DIST_PACKAGES_DIR = path.join(ANGULAR_ROOT_DIR, 'dist/zone.js-dist');
|
||||
const ANGULAR_MISC_DIST_PACKAGES = path.join(ANGULAR_ROOT_DIR, 'dist/packages-dist/misc');
|
||||
const DIST_PACKAGES_BUILD_SCRIPT = path.join(ANGULAR_ROOT_DIR, 'scripts/build/build-packages-dist.js');
|
||||
const DIST_PACKAGES_BUILD_CMD = `"${process.execPath}" "${DIST_PACKAGES_BUILD_SCRIPT}"`;
|
||||
|
||||
|
@ -183,7 +184,7 @@ class NgPackagesInstaller {
|
|||
} else {
|
||||
this._warn([
|
||||
'Automatically building the local Angular/Zone.js packages is currently not supported on Windows.',
|
||||
`Please, ensure '${ANGULAR_DIST_PACKAGES_DIR}' and '${ZONEJS_DIST_PACKAGES_DIR}' exist and are up-to-date ` +
|
||||
`Please, ensure '${ANGULAR_DIST_PACKAGES_DIR}', ${ZONEJS_DIST_PACKAGES_DIR} and '${ANGULAR_MISC_DIST_PACKAGES}' exist and are up-to-date ` +
|
||||
`(e.g. by running '${DIST_PACKAGES_BUILD_SCRIPT}' in Git Bash for Windows, Windows Subsystem for Linux or ` +
|
||||
'a Linux docker container or VM).',
|
||||
'',
|
||||
|
@ -222,6 +223,7 @@ class NgPackagesInstaller {
|
|||
_getDistPackages() {
|
||||
this._log(`Angular distributable directory: ${ANGULAR_DIST_PACKAGES_DIR}.`);
|
||||
this._log(`Zone.js distributable directory: ${ZONEJS_DIST_PACKAGES_DIR}.`);
|
||||
this._log(`angular-in-memory-web-api distributable directory: ${ANGULAR_MISC_DIST_PACKAGES}.`);
|
||||
|
||||
if (this.buildPackages) {
|
||||
this._buildDistPackages();
|
||||
|
@ -260,6 +262,7 @@ class NgPackagesInstaller {
|
|||
const packageConfigs = {
|
||||
...collectPackages(ANGULAR_DIST_PACKAGES_DIR),
|
||||
...collectPackages(ZONEJS_DIST_PACKAGES_DIR),
|
||||
...collectPackages(ANGULAR_MISC_DIST_PACKAGES),
|
||||
};
|
||||
|
||||
this._log('Found the following Angular distributables:', Object.keys(packageConfigs).map(key => `\n - ${key}`));
|
||||
|
|
|
@ -5,10 +5,12 @@
|
|||
"author": "angular",
|
||||
"license": "MIT",
|
||||
"peerDependencies": {
|
||||
"@angular/core": "^8.0.0",
|
||||
"@angular/common": "^8.0.0",
|
||||
"rxjs": "^6.5.3",
|
||||
"tslib": "^1.10.0"
|
||||
"@angular/core": "^12.0.0-next.6",
|
||||
"@angular/common": "^12.0.0-next.6",
|
||||
"rxjs": "^6.5.3"
|
||||
},
|
||||
"dependencies": {
|
||||
"tslib": "^2.1.0"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
|
|
|
@ -0,0 +1,36 @@
|
|||
/**
|
||||
* @license
|
||||
* Copyright Google LLC All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by an MIT-style license that can be
|
||||
* found in the LICENSE file at https://angular.io/license
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
const {chmod, cp, mkdir, rm} = require('shelljs');
|
||||
const {baseDir, bazelBin, bazelCmd, exec, scriptPath} = require('./package-builder');
|
||||
|
||||
/**
|
||||
* Build the `angular-in-memory-web-api` npm package and copy it to `dist/packages-dist/misc`.
|
||||
*/
|
||||
function buildAngularInMemoryWebAPIPackage() {
|
||||
console.info('##############################');
|
||||
console.info(`${scriptPath}:`);
|
||||
console.info(' Building angular-in-memory-web-api npm package');
|
||||
console.info('##############################');
|
||||
exec(`${bazelCmd} build //packages/misc/angular-in-memory-web-api:npm_package`);
|
||||
|
||||
const buildOutputDir = `${bazelBin}/packages/misc/angular-in-memory-web-api/npm_package`;
|
||||
const distTargetDir = `${baseDir}/dist/packages-dist/misc/angular-in-memory-web-api`;
|
||||
|
||||
console.info(`# Copy artifacts to ${distTargetDir}`);
|
||||
mkdir('-p', distTargetDir);
|
||||
rm('-rf', distTargetDir);
|
||||
cp('-R', buildOutputDir, distTargetDir);
|
||||
chmod('-R', 'u+w', distTargetDir);
|
||||
|
||||
console.info('');
|
||||
}
|
||||
|
||||
module.exports = {buildAngularInMemoryWebAPIPackage};
|
|
@ -12,6 +12,7 @@
|
|||
const {buildZoneJsPackage} = require('./zone-js-builder');
|
||||
const {buildDevInfraPackage} = require('./dev-infra-builder');
|
||||
const {buildTargetPackages} = require('./package-builder');
|
||||
const {buildAngularInMemoryWebAPIPackage} = require('./angular-in-memory-web-api');
|
||||
|
||||
|
||||
// Build the legacy (view engine) npm packages into `dist/packages-dist/`.
|
||||
|
@ -23,3 +24,7 @@ buildZoneJsPackage('dist/zone.js-dist');
|
|||
|
||||
// Build the `angular-dev-infra` npm package into `dist/packages-dist/@angular/dev-infra-private`
|
||||
buildDevInfraPackage();
|
||||
|
||||
// Build the `angular-in-memory-web-api` npm package into
|
||||
// `dist/packages-dist/misc/angular-in-memory-web-api`
|
||||
buildAngularInMemoryWebAPIPackage();
|
||||
|
|
Loading…
Reference in New Issue