diff --git a/aio/tools/ng-packages-installer/index.js b/aio/tools/ng-packages-installer/index.js index b76d4abd4b..33551acfcf 100644 --- a/aio/tools/ng-packages-installer/index.js +++ b/aio/tools/ng-packages-installer/index.js @@ -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}`)); diff --git a/packages/misc/angular-in-memory-web-api/package.json b/packages/misc/angular-in-memory-web-api/package.json index b0f4c6d5d1..ed1d5afc1d 100644 --- a/packages/misc/angular-in-memory-web-api/package.json +++ b/packages/misc/angular-in-memory-web-api/package.json @@ -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", diff --git a/scripts/build/angular-in-memory-web-api.js b/scripts/build/angular-in-memory-web-api.js new file mode 100644 index 0000000000..db0b247217 --- /dev/null +++ b/scripts/build/angular-in-memory-web-api.js @@ -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}; diff --git a/scripts/build/build-packages-dist.js b/scripts/build/build-packages-dist.js old mode 100755 new mode 100644 index bee8480ce5..8ecda36989 --- a/scripts/build/build-packages-dist.js +++ b/scripts/build/build-packages-dist.js @@ -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();