From d37939623ff756dbd7908db0d39d05ac7920d79a Mon Sep 17 00:00:00 2001 From: JiaLiPassion Date: Mon, 31 Aug 2020 13:48:41 +0900 Subject: [PATCH] test(zone.js): test zone.js package with tgz (#38649) Zone.js 0.11.0 release an empty bundle, and now the npm_package tests all target bazel rule `npm_package`, but not `npm_package.pack`, and these two rules may generate different results, for example, Zone.js 0.11.0's issue is `package.json` define files array which make the bundle only include the files in the files array. So this PR install the zone.js package from the archive generated from `npm_package.pack` rule. PR Close #38649 --- .circleci/config.yml | 3 ++- integration/bazel/package.json | 2 +- .../cli-hello-world-ivy-compat/package.json | 2 +- .../cli-hello-world-ivy-i18n/package.json | 2 +- .../cli-hello-world-ivy-minimal/package.json | 2 +- .../cli-hello-world-lazy-rollup/package.json | 2 +- integration/cli-hello-world-lazy/package.json | 2 +- integration/cli-hello-world/package.json | 2 +- integration/dynamic-compiler/package.json | 2 +- integration/hello_world__closure/package.json | 2 +- .../hello_world__systemjs_umd/package.json | 2 +- integration/i18n/package.json | 2 +- integration/injectable-def/package.json | 2 +- integration/ng_elements/package.json | 2 +- integration/ng_update/package.json | 2 +- integration/ng_update_migrations/package.json | 2 +- integration/ngcc/package.json | 2 +- integration/platform-server/package.json | 2 +- integration/service-worker-schema/package.json | 2 +- integration/terser/package.json | 2 +- integration/typings_test_ts39/package.json | 2 +- integration/typings_test_ts40/package.json | 2 +- scripts/build/zone-js-builder.js | 17 +++++++++++++++-- 23 files changed, 38 insertions(+), 24 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 24b56f788dc..41f927a7ad1 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -553,7 +553,8 @@ jobs: # Publish `zone.js` package. - run: name: Create artifacts for zone.js package - command: ./scripts/ci/create-package-archives.sh $CI_BRANCH $CI_COMMIT $ZONEJS_PACKAGES_DIR $ZONEJS_PACKAGES_ARCHIVES_DIR + # Need to remove the zone.js.tgz before archive + command: rm -rf $ZONEJS_PACKAGES_DIR/archive && ./scripts/ci/create-package-archives.sh $CI_BRANCH $CI_COMMIT $ZONEJS_PACKAGES_DIR $ZONEJS_PACKAGES_ARCHIVES_DIR - store_artifacts: path: *zonejs_packages_archives_dir destination: zone.js diff --git a/integration/bazel/package.json b/integration/bazel/package.json index f2425075996..c7347b3814f 100644 --- a/integration/bazel/package.json +++ b/integration/bazel/package.json @@ -16,7 +16,7 @@ "reflect-metadata": "0.1.12", "rxjs": "file:../../node_modules/rxjs", "tslib": "file:../../node_modules/tslib", - "zone.js": "file:../../dist/zone.js-dist/zone.js" + "zone.js": "file:../../dist/zone.js-dist/archive/zone.js.tgz" }, "devDependencies": { "@angular/bazel": "file:../../dist/packages-dist/bazel", diff --git a/integration/cli-hello-world-ivy-compat/package.json b/integration/cli-hello-world-ivy-compat/package.json index 52b46ebceb0..4508fc6c61a 100644 --- a/integration/cli-hello-world-ivy-compat/package.json +++ b/integration/cli-hello-world-ivy-compat/package.json @@ -24,7 +24,7 @@ "@angular/router": "file:../../dist/packages-dist/router", "rxjs": "file:../../node_modules/rxjs", "tslib": "file:../../node_modules/tslib", - "zone.js": "file:../../dist/zone.js-dist/zone.js" + "zone.js": "file:../../dist/zone.js-dist/archive/zone.js.tgz" }, "devDependencies": { "@angular-devkit/build-angular": "file:../../node_modules/@angular-devkit/build-angular", diff --git a/integration/cli-hello-world-ivy-i18n/package.json b/integration/cli-hello-world-ivy-i18n/package.json index ed8e39797cb..ee8209a540b 100644 --- a/integration/cli-hello-world-ivy-i18n/package.json +++ b/integration/cli-hello-world-ivy-i18n/package.json @@ -28,7 +28,7 @@ "core-js": "file:../../node_modules/core-js", "rxjs": "file:../../node_modules/rxjs", "tslib": "file:../../node_modules/tslib", - "zone.js": "file:../../dist/zone.js-dist/zone.js" + "zone.js": "file:../../dist/zone.js-dist/archive/zone.js.tgz" }, "devDependencies": { "@angular-devkit/build-angular": "file:../../node_modules/@angular-devkit/build-angular", diff --git a/integration/cli-hello-world-ivy-minimal/package.json b/integration/cli-hello-world-ivy-minimal/package.json index 04e1ca01160..59e1df3004a 100644 --- a/integration/cli-hello-world-ivy-minimal/package.json +++ b/integration/cli-hello-world-ivy-minimal/package.json @@ -24,7 +24,7 @@ "@angular/router": "file:../../dist/packages-dist/router", "rxjs": "file:../../node_modules/rxjs", "tslib": "file:../../node_modules/tslib", - "zone.js": "file:../../dist/zone.js-dist/zone.js" + "zone.js": "file:../../dist/zone.js-dist/archive/zone.js.tgz" }, "devDependencies": { "@angular-devkit/build-angular": "file:../../node_modules/@angular-devkit/build-angular", diff --git a/integration/cli-hello-world-lazy-rollup/package.json b/integration/cli-hello-world-lazy-rollup/package.json index bae5154b9cd..143b98cc028 100644 --- a/integration/cli-hello-world-lazy-rollup/package.json +++ b/integration/cli-hello-world-lazy-rollup/package.json @@ -19,7 +19,7 @@ "@angular/router": "file:../../dist/packages-dist/router", "rxjs": "file:../../node_modules/rxjs", "tslib": "file:../../node_modules/tslib", - "zone.js": "file:../../dist/zone.js-dist/zone.js" + "zone.js": "file:../../dist/zone.js-dist/archive/zone.js.tgz" }, "devDependencies": { "@angular-devkit/build-angular": "file:../../node_modules/@angular-devkit/build-angular", diff --git a/integration/cli-hello-world-lazy/package.json b/integration/cli-hello-world-lazy/package.json index f6a9d15506e..135a0d685ff 100644 --- a/integration/cli-hello-world-lazy/package.json +++ b/integration/cli-hello-world-lazy/package.json @@ -19,7 +19,7 @@ "@angular/router": "file:../../dist/packages-dist/router", "rxjs": "file:../../node_modules/rxjs", "tslib": "file:../../node_modules/tslib", - "zone.js": "file:../../dist/zone.js-dist/zone.js" + "zone.js": "file:../../dist/zone.js-dist/archive/zone.js.tgz" }, "devDependencies": { "@angular-devkit/build-angular": "file:../../node_modules/@angular-devkit/build-angular", diff --git a/integration/cli-hello-world/package.json b/integration/cli-hello-world/package.json index 98ec7d4986c..0f9688b90f5 100644 --- a/integration/cli-hello-world/package.json +++ b/integration/cli-hello-world/package.json @@ -23,7 +23,7 @@ "@angular/router": "file:../../dist/packages-dist/router", "rxjs": "file:../../node_modules/rxjs", "tslib": "file:../../node_modules/tslib", - "zone.js": "file:../../dist/zone.js-dist/zone.js" + "zone.js": "file:../../dist/zone.js-dist/archive/zone.js.tgz" }, "devDependencies": { "@angular-devkit/build-angular": "file:../../node_modules/@angular-devkit/build-angular", diff --git a/integration/dynamic-compiler/package.json b/integration/dynamic-compiler/package.json index 82fbe67f780..59cb8d36260 100644 --- a/integration/dynamic-compiler/package.json +++ b/integration/dynamic-compiler/package.json @@ -41,7 +41,7 @@ "core-js": "file:../../node_modules/core-js", "rxjs": "file:../../node_modules/rxjs", "systemjs": "file:../../node_modules/systemjs", - "zone.js": "file:../../dist/zone.js-dist/zone.js" + "zone.js": "file:../../dist/zone.js-dist/archive/zone.js.tgz" }, "//resolutions-comment": "Ensure a single version of webdriver-manager which comes from root node_modules that has already run webdriver-manager update", "resolutions": { diff --git a/integration/hello_world__closure/package.json b/integration/hello_world__closure/package.json index 83cf5530dd2..398b4eb08d9 100644 --- a/integration/hello_world__closure/package.json +++ b/integration/hello_world__closure/package.json @@ -12,7 +12,7 @@ "rxjs": "file:../../node_modules/rxjs", "typescript": "file:../../node_modules/typescript", "tslib": "file:../../node_modules/tslib", - "zone.js": "file:../../dist/zone.js-dist/zone.js" + "zone.js": "file:../../dist/zone.js-dist/archive/zone.js.tgz" }, "devDependencies": { "@types/jasmine": "file:../../node_modules/@types/jasmine", diff --git a/integration/hello_world__systemjs_umd/package.json b/integration/hello_world__systemjs_umd/package.json index 6a8c567b775..54d380fcc92 100644 --- a/integration/hello_world__systemjs_umd/package.json +++ b/integration/hello_world__systemjs_umd/package.json @@ -20,7 +20,7 @@ "rxjs": "file:../../node_modules/rxjs", "systemjs": "0.20.2", "typescript": "file:../../node_modules/typescript", - "zone.js": "file:../../dist/zone.js-dist/zone.js" + "zone.js": "file:../../dist/zone.js-dist/archive/zone.js.tgz" }, "devDependencies": { "@types/jasmine": "file:../../node_modules/@types/jasmine", diff --git a/integration/i18n/package.json b/integration/i18n/package.json index d681893bd50..ad0c9955d02 100644 --- a/integration/i18n/package.json +++ b/integration/i18n/package.json @@ -11,7 +11,7 @@ "rxjs": "file:../../node_modules/rxjs", "typescript": "file:../../node_modules/typescript", "tslib": "file:../../node_modules/tslib", - "zone.js": "file:../../dist/zone.js-dist/zone.js" + "zone.js": "file:../../dist/zone.js-dist/archive/zone.js.tgz" }, "devDependencies": { "@types/jasmine": "file:../../node_modules/@types/jasmine", diff --git a/integration/injectable-def/package.json b/integration/injectable-def/package.json index b2fe57ba6dd..054b482fab5 100644 --- a/integration/injectable-def/package.json +++ b/integration/injectable-def/package.json @@ -14,7 +14,7 @@ "@types/node": "file:../../node_modules/@types/node", "rxjs": "file:../../node_modules/rxjs", "typescript": "file:../../node_modules/typescript", - "zone.js": "file:../../dist/zone.js-dist/zone.js" + "zone.js": "file:../../dist/zone.js-dist/archive/zone.js.tgz" }, "devDependencies": { "@types/jasmine": "file:../../node_modules/@types/jasmine", diff --git a/integration/ng_elements/package.json b/integration/ng_elements/package.json index 783f0580f40..2d99a595e3e 100644 --- a/integration/ng_elements/package.json +++ b/integration/ng_elements/package.json @@ -12,7 +12,7 @@ "rxjs": "file:../../node_modules/rxjs", "typescript": "file:../../node_modules/typescript", "tslib": "file:../../node_modules/tslib", - "zone.js": "file:../../dist/zone.js-dist/zone.js" + "zone.js": "file:../../dist/zone.js-dist/archive/zone.js.tgz" }, "devDependencies": { "@types/jasmine": "file:../../node_modules/@types/jasmine", diff --git a/integration/ng_update/package.json b/integration/ng_update/package.json index 5b85ef275ff..2deba2e6059 100644 --- a/integration/ng_update/package.json +++ b/integration/ng_update/package.json @@ -22,6 +22,6 @@ "@angular/upgrade": "file:../../dist/packages-dist/upgrade", "rxjs": "file:../../node_modules/rxjs", "typescript": "file:../../node_modules/typescript", - "zone.js": "file:../../dist/zone.js-dist/zone.js" + "zone.js": "file:../../dist/zone.js-dist/archive/zone.js.tgz" } } diff --git a/integration/ng_update_migrations/package.json b/integration/ng_update_migrations/package.json index 705d624ce9d..3f832d53ea3 100644 --- a/integration/ng_update_migrations/package.json +++ b/integration/ng_update_migrations/package.json @@ -21,7 +21,7 @@ "@angular/router": "file:../../dist/packages-dist/router", "rxjs": "file:../../node_modules/rxjs", "tslib": "file:../../node_modules/tslib", - "zone.js": "file:../../dist/zone.js-dist/zone.js" + "zone.js": "file:../../dist/zone.js-dist/archive/zone.js.tgz" }, "devDependencies": { "@angular-devkit/build-angular": "file:../../node_modules/@angular-devkit/build-angular", diff --git a/integration/ngcc/package.json b/integration/ngcc/package.json index 4c19e1cbbf7..75a47d83ccb 100644 --- a/integration/ngcc/package.json +++ b/integration/ngcc/package.json @@ -18,7 +18,7 @@ "@types/node": "file:../../node_modules/@types/node", "rxjs": "file:../../node_modules/rxjs", "typescript": "file:../../node_modules/typescript", - "zone.js": "file:../../dist/zone.js-dist/zone.js" + "zone.js": "file:../../dist/zone.js-dist/archive/zone.js.tgz" }, "devDependencies": { "@types/jasmine": "file:../../node_modules/@types/jasmine", diff --git a/integration/platform-server/package.json b/integration/platform-server/package.json index 002eb5065d6..a62d727983c 100644 --- a/integration/platform-server/package.json +++ b/integration/platform-server/package.json @@ -19,7 +19,7 @@ "express": "4.16.4", "rxjs": "file:../../node_modules/rxjs", "typescript": "file:../../node_modules/typescript", - "zone.js": "file:../../dist/zone.js-dist/zone.js" + "zone.js": "file:../../dist/zone.js-dist/archive/zone.js.tgz" }, "devDependencies": { "@types/jasmine": "file:../../node_modules/@types/jasmine", diff --git a/integration/service-worker-schema/package.json b/integration/service-worker-schema/package.json index 26a08141ffb..af3986155e2 100644 --- a/integration/service-worker-schema/package.json +++ b/integration/service-worker-schema/package.json @@ -11,6 +11,6 @@ "@angular/core": "file:../../dist/packages-dist/core", "@angular/service-worker": "file:../../dist/packages-dist/service-worker", "rxjs": "file:../../node_modules/rxjs", - "zone.js": "file:../../dist/zone.js-dist/zone.js" + "zone.js": "file:../../dist/zone.js-dist/archive/zone.js.tgz" } } diff --git a/integration/terser/package.json b/integration/terser/package.json index e585c2c531f..7a8769bc7ef 100644 --- a/integration/terser/package.json +++ b/integration/terser/package.json @@ -12,6 +12,6 @@ "rxjs": "file:../../node_modules/rxjs", "terser": "3.17.0", "typescript": "file:../../node_modules/typescript", - "zone.js": "file:../../dist/zone.js-dist/zone.js" + "zone.js": "file:../../dist/zone.js-dist/archive/zone.js.tgz" } } diff --git a/integration/typings_test_ts39/package.json b/integration/typings_test_ts39/package.json index b0e78470201..6f375da3788 100644 --- a/integration/typings_test_ts39/package.json +++ b/integration/typings_test_ts39/package.json @@ -20,7 +20,7 @@ "@types/jasmine": "file:../../node_modules/@types/jasmine", "rxjs": "file:../../node_modules/rxjs", "typescript": "~3.9.5", - "zone.js": "file:../../dist/zone.js-dist/zone.js" + "zone.js": "file:../../dist/zone.js-dist/archive/zone.js.tgz" }, "scripts": { "test": "tsc" diff --git a/integration/typings_test_ts40/package.json b/integration/typings_test_ts40/package.json index 30cf4c7664e..c4a666ee33a 100644 --- a/integration/typings_test_ts40/package.json +++ b/integration/typings_test_ts40/package.json @@ -20,7 +20,7 @@ "@types/jasmine": "file:../../node_modules/@types/jasmine", "rxjs": "file:../../node_modules/rxjs", "typescript": "4.0.2", - "zone.js": "file:../../dist/zone.js-dist/zone.js" + "zone.js": "file:../../dist/zone.js-dist/archive/zone.js.tgz" }, "scripts": { "test": "tsc" diff --git a/scripts/build/zone-js-builder.js b/scripts/build/zone-js-builder.js index 0883d83a45a..2b88ba0b599 100644 --- a/scripts/build/zone-js-builder.js +++ b/scripts/build/zone-js-builder.js @@ -9,7 +9,8 @@ 'use strict'; const {resolve} = require('path'); -const {chmod, cp, mkdir, rm, test} = require('shelljs'); +const {chmod, cp, mkdir, mv, rm, test} = require('shelljs'); +const zonePackageJson = require('../../packages/zone.js/package.json'); const {baseDir, bazelBin, bazelCmd, exec, scriptPath} = require('./package-builder'); @@ -45,10 +46,22 @@ function buildZoneJsPackage(destPath) { const buildOutputDir = `${bazelBin}/packages/zone.js/npm_package`; const distTargetDir = `${absDestPath}/zone.js`; - console.info(`# Copy artifacts to ${distTargetDir}`); + // 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. + exec(`npm pack ${buildOutputDir}`); + + console.info(`# Copy npm_package artifacts to ${distTargetDir}`); rm('-rf', distTargetDir); cp('-R', buildOutputDir, distTargetDir); chmod('-R', 'u+w', distTargetDir); + // Copy `zone.js.tgz` to `destPath`, so we can test + // the archive generated by the `npm_package.pack` rule. + const distArchiveTargetDir = `${absDestPath}/archive`; + console.info(`# Copy npm_package archive file to ${distArchiveTargetDir}`); + rm('-rf', distArchiveTargetDir); + mkdir('-p', distArchiveTargetDir); + mv(`${baseDir}/zone.js-${zonePackageJson.version}.tgz`, `${distArchiveTargetDir}/zone.js.tgz`); + console.info(''); }