build(zone.js): use `npm_package.pack` to build the Zone.js package (#40592)

Previously, we could not use `npm_package.pack` for building the Zone.js
package due to a bug in Windows. This bug has been fixed in version
2.3.0 of `bazelbuild/rules_nodejs`.

Now that we have updated `bazelbuild/rules_nodejs` to version 2.3.3
(in #40581) we can replace `npm pack` with `npm_package.pack`.

PR Close #40592
This commit is contained in:
George Kalpakas 2021-01-27 19:09:36 +02:00 committed by Misko Hevery
parent 94e3d3ab70
commit 9746751603
1 changed files with 1 additions and 7 deletions

View File

@ -35,7 +35,7 @@ function buildZoneJsPackage(destPath) {
console.info(`${scriptPath}:`);
console.info(' Building zone.js npm package');
console.info('##############################');
exec(`${bazelCmd} build //packages/zone.js:npm_package`);
exec(`${bazelCmd} run //packages/zone.js:npm_package.pack`);
// Create the output directory.
const absDestPath = resolve(baseDir, destPath);
@ -46,12 +46,6 @@ function buildZoneJsPackage(destPath) {
const buildOutputDir = `${bazelBin}/packages/zone.js/npm_package`;
const distTargetDir = `${absDestPath}/zone.js`;
// Also create an archive so we can test the package itself.
// Currently, the `npm_package.pack` rule does not work on Windows, so run `npm pack` directly.
//
// TODO: Switch to `npm_package.pack`, once we upgrade to `bazelbuild/rules_nodejs` >=2.3.0.
exec(`npm pack ${buildOutputDir}`, false, {cwd: baseDir});
console.info(`# Copy npm_package artifacts to ${distTargetDir}`);
rm('-rf', distTargetDir);
cp('-R', buildOutputDir, distTargetDir);