From d6f6cd0cb17efceacf1da7bf814865bd0608d4c5 Mon Sep 17 00:00:00 2001 From: Wagner Maciel Date: Wed, 22 Apr 2020 09:56:40 -0700 Subject: [PATCH] build(dev-infra): update package.json and :npm_package (#36434) * Set up dev-infra's :npm_package to also contain benchmarking suite * Add benchmarking deps to dev-infra's package.json * Add a bazel workspace to dev-infra's package.json. This is so that when a project wants to use dev-infra's code and macros, they can just import the macros from their node_modules instead of loading it separately PR Close #36434 --- dev-infra/BUILD.bazel | 20 ++++++++++++++++++++ dev-infra/tmpl-package.json | 30 +++++++++++++++++++++++++++++- dev-infra/tools/BUILD.bazel | 12 ------------ 3 files changed, 49 insertions(+), 13 deletions(-) delete mode 100644 dev-infra/tools/BUILD.bazel diff --git a/dev-infra/BUILD.bazel b/dev-infra/BUILD.bazel index 57897870bf..1987db6e2f 100644 --- a/dev-infra/BUILD.bazel +++ b/dev-infra/BUILD.bazel @@ -34,10 +34,30 @@ genrule( pkg_npm( name = "npm_package", + srcs = [ + "BUILD.bazel", + "//dev-infra/benchmark:files", + ], + substitutions = { + # angular/angular should not consume it's own packages, so we use + # substitutions to replace these in the deployed version of dev-infra. + "//dev-infra/": "@npm_dev_infra//", + "//packages/benchpress": "@npm//@angular/benchpress", + "//packages/bazel/src:esm5.bzl": "@npm_angular_bazel//src:esm5.bzl", + "//packages/zone.js/dist:zone.js": "@npm//:node_modules/zone.js/dist/zone.js", + "//packages/core": "@npm//@angular/core", + "//packages/platform-browser": "@npm//@angular/platform-browser", + + # This substitution is particularly verbose because we need to make sure + # that only things available via Angular Bazel are imported from + # tools/defaults.bzl. + "load\(\"//tools:defaults.bzl\", \"ng_module\"\)": "load(\"@npm_angular_bazel//:index.bzl\", \"ng_module\")", + }, visibility = ["//visibility:public"], deps = [ ":cli", ":package-json", + "//dev-infra/benchmark/driver-utilities", "//dev-infra/commit-message", "//dev-infra/ts-circular-dependencies", ], diff --git a/dev-infra/tmpl-package.json b/dev-infra/tmpl-package.json index 44534e250a..55c5430117 100644 --- a/dev-infra/tmpl-package.json +++ b/dev-infra/tmpl-package.json @@ -8,14 +8,42 @@ "ng-dev": "./cli.js", "ts-circular-deps": "./ts-circular-dependencies/index.js" }, + "dependencies": { + "fs-extra": "", + "node-uuid": "" + }, "peerDependencies": { + "@angular/bazel": "^9.0.0", + "@angular/core": "^9.0.0", + "@angular/platform-browser": "^9.0.0", + "@angular/benchpress": "^0.1.0", + "@angular-devkit/build-optimizer": "", + "@bazel/protractor": "", + "@bazel/terser": "", + "@bazel/typescript": "", + "brotli": "", "chalk": "", "glob": "", + "json5": "", "minimatch": "", + "node-uuid": "", + "protractor": "", + "rollup": "", + "rollup-plugin-commonjs": "", + "rollup-plugin-node-resolve": "", + "rollup-plugin-sourcemaps": "", + "selenium-webdriver": "", "shelljs": "", "typescript": "", "yaml": "", "yargs": "", - "tslib": "" + "tslib": "", + "zone.js": "^0.10.3" + }, + "bazelWorkspaces": { + "npm_dev_infra": { + "version": "0.0.0-PLACEHOLDER", + "rootPath": "." + } } } diff --git a/dev-infra/tools/BUILD.bazel b/dev-infra/tools/BUILD.bazel deleted file mode 100644 index 9feb062ead..0000000000 --- a/dev-infra/tools/BUILD.bazel +++ /dev/null @@ -1,12 +0,0 @@ -package(default_visibility = ["//visibility:public"]) - -# Make source files available for distribution via pkg_npm -filegroup( - name = "files", - srcs = glob(["*"]) + [ - "//dev-infra/benchmark/brotli-cli:files", - "//dev-infra/benchmark/browsers:files", - "//dev-infra/benchmark/component_benchmark:files", - "//dev-infra/benchmark/ng_rollup_bundle:files", - ], -)