angular-docs-cn/scripts/build/dev-infra-builder.js
Joey Perrott b42e2e0dff build: create dev-infra-private npm package (#35862)
Creates the scaffolding for an @angular/dev-infra-private package
which will not be published to npm but will be pushed to
https://github.com/angular/dev-infra-private-builds repo for each
commit to master.

The contents of this npm package will then be depended on via
package.json dependency for angular/angular angular/angular-cli and
angular/components.

PR Close #35862
2020-03-05 18:55:40 -05:00

39 lines
1.1 KiB
JavaScript

/**
* @license
* Copyright Google Inc. 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/dev-infra-private` npm package and copies it to `dist/packages-dist`.
*/
function buildDevInfraPackage() {
console.info('##############################');
console.info(`${scriptPath}:`);
console.info(' Building @angular/dev-infra-private npm package');
console.info('##############################');
exec(`${bazelCmd} build //dev-infra:npm_package`);
const buildOutputDir = `${bazelBin}/dev-infra/npm_package`;
const distTargetDir = `${baseDir}/dist/packages-dist/dev-infra-private`;
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 = {
buildDevInfraPackage
};