2021-07-02 18:27:01 -04:00
|
|
|
# BEGIN-INTERNAL
|
2020-12-07 13:52:40 -05:00
|
|
|
load("@build_bazel_rules_nodejs//:index.bzl", "pkg_npm")
|
2021-07-06 09:45:55 -04:00
|
|
|
load("//dev-infra:defaults.bzl", "ng_dev_rolled_up_generated_file", "ts_library")
|
2021-07-02 18:27:01 -04:00
|
|
|
# END-INTERNAL
|
2020-03-04 12:42:45 -05:00
|
|
|
|
2021-07-01 15:41:53 -04:00
|
|
|
exports_files(["tsconfig.json"])
|
|
|
|
|
2021-07-02 18:27:01 -04:00
|
|
|
# BEGIN-INTERNAL
|
2020-03-04 12:42:45 -05:00
|
|
|
ts_library(
|
|
|
|
name = "cli",
|
|
|
|
srcs = [
|
|
|
|
"cli.ts",
|
|
|
|
],
|
|
|
|
deps = [
|
2020-08-26 16:49:43 -04:00
|
|
|
"//dev-infra/caretaker",
|
2020-03-10 13:29:44 -04:00
|
|
|
"//dev-infra/commit-message",
|
2020-04-20 16:00:10 -04:00
|
|
|
"//dev-infra/format",
|
2021-05-25 12:44:52 -04:00
|
|
|
"//dev-infra/misc",
|
2020-09-30 17:32:19 -04:00
|
|
|
"//dev-infra/ngbot",
|
2020-05-05 18:37:31 -04:00
|
|
|
"//dev-infra/pr",
|
2020-03-04 17:37:21 -05:00
|
|
|
"//dev-infra/pullapprove",
|
2020-04-20 17:44:25 -04:00
|
|
|
"//dev-infra/release",
|
2020-03-26 13:45:09 -04:00
|
|
|
"//dev-infra/ts-circular-dependencies",
|
2020-04-20 16:00:10 -04:00
|
|
|
"//dev-infra/utils",
|
2020-03-04 12:42:45 -05:00
|
|
|
"@npm//@types/node",
|
2020-03-26 13:45:09 -04:00
|
|
|
"@npm//@types/yargs",
|
|
|
|
"@npm//yargs",
|
2020-03-04 12:42:45 -05:00
|
|
|
],
|
|
|
|
)
|
|
|
|
|
2020-03-17 07:58:17 -04:00
|
|
|
genrule(
|
|
|
|
name = "package-json",
|
|
|
|
srcs = [
|
|
|
|
"tmpl-package.json",
|
|
|
|
"//:package.json",
|
2020-03-04 17:37:21 -05:00
|
|
|
],
|
2020-03-17 07:58:17 -04:00
|
|
|
outs = ["package.json"],
|
|
|
|
cmd = """
|
2020-03-29 16:29:50 -04:00
|
|
|
$(execpath //tools:inline-package-json-deps) $(execpath tmpl-package.json) \
|
|
|
|
$(execpath //:package.json) $@
|
2020-03-17 07:58:17 -04:00
|
|
|
""",
|
|
|
|
tools = ["//tools:inline-package-json-deps"],
|
2020-03-04 17:37:21 -05:00
|
|
|
)
|
|
|
|
|
2020-03-04 12:42:45 -05:00
|
|
|
pkg_npm(
|
|
|
|
name = "npm_package",
|
2020-05-15 13:26:01 -04:00
|
|
|
srcs = [
|
2021-07-06 09:45:55 -04:00
|
|
|
# Main bazel entry-point for the shared `dev-infra` package.
|
2020-07-08 04:06:35 -04:00
|
|
|
"index.bzl",
|
2021-07-02 18:27:01 -04:00
|
|
|
"BUILD.bazel",
|
2021-07-01 15:41:53 -04:00
|
|
|
# Some tools within `dev-infra` which are shipped as Bazel rules might
|
|
|
|
# rely on a tsconfig file. We bring the config into the NPM package.
|
|
|
|
"tsconfig.json",
|
2020-07-02 08:45:23 -04:00
|
|
|
"//dev-infra/bazel:files",
|
2020-05-15 13:26:01 -04:00
|
|
|
"//dev-infra/benchmark:files",
|
|
|
|
],
|
|
|
|
substitutions = {
|
|
|
|
# angular/angular should not consume it's own packages, so we use
|
2020-05-08 15:56:39 -04:00
|
|
|
# substitutions to replace these in the published version of dev-infra.
|
2021-02-10 13:27:59 -05:00
|
|
|
"//dev-infra/": "@npm//@angular/dev-infra-private/",
|
2021-07-02 18:27:01 -04:00
|
|
|
"//dev-infra:": "@npm//@angular/dev-infra-private:",
|
2021-07-06 09:45:55 -04:00
|
|
|
|
|
|
|
# Substitutions needed for `//dev-infra/benchmark`:
|
2020-05-15 13:26:01 -04:00
|
|
|
"//packages/benchpress": "@npm//@angular/benchpress",
|
2020-06-25 04:32:41 -04:00
|
|
|
"//packages/bazel": "@npm//@angular/bazel",
|
2021-02-15 04:09:12 -05:00
|
|
|
"//packages/zone.js/bundles:zone.umd.js": "@npm//zone.js",
|
2020-05-15 13:26:01 -04:00
|
|
|
"//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.
|
2021-01-27 11:19:16 -05:00
|
|
|
"load\\(\"//tools:defaults.bzl\", \"ng_module\"\\)": "load(\"@npm//@angular/bazel:index.bzl\", \"ng_module\")",
|
2020-05-15 13:26:01 -04:00
|
|
|
},
|
2020-03-04 12:42:45 -05:00
|
|
|
visibility = ["//visibility:public"],
|
|
|
|
deps = [
|
2020-03-17 07:58:17 -04:00
|
|
|
":cli",
|
|
|
|
":package-json",
|
2020-05-15 13:26:01 -04:00
|
|
|
"//dev-infra/benchmark/driver-utilities",
|
2020-03-10 13:29:44 -04:00
|
|
|
"//dev-infra/commit-message",
|
2020-03-17 07:58:17 -04:00
|
|
|
"//dev-infra/ts-circular-dependencies",
|
2020-03-04 12:42:45 -05:00
|
|
|
],
|
|
|
|
)
|
2020-12-07 13:52:40 -05:00
|
|
|
|
|
|
|
# Because the angular/angular repository relies on the local repository for running ng-dev commands,
|
|
|
|
# the rollup generated javascript files are committed into the repository to be used as node
|
|
|
|
# scripts. To ensure they stay up to date, they are created using a generated file test.
|
|
|
|
#
|
|
|
|
# Currently there are two generated files which are needed
|
|
|
|
# ng-dev.js - The main script representing ng-dev
|
|
|
|
# build-worker.js - The worker script for the `ng-dev release build` command, allowing it to run
|
|
|
|
# in a forked process.
|
|
|
|
ng_dev_rolled_up_generated_file(
|
|
|
|
name = "ng-dev",
|
|
|
|
entry_point = ":cli.ts",
|
|
|
|
rollup_args = [
|
|
|
|
"--plugin",
|
|
|
|
"rollup-plugin-hashbang",
|
|
|
|
],
|
|
|
|
deps = [
|
|
|
|
":cli",
|
|
|
|
# TODO(josephperrott): Determine if this plugin is the best method for ensuring the hashbang
|
|
|
|
# in both local and published use case.
|
|
|
|
"@npm//rollup-plugin-hashbang",
|
|
|
|
],
|
|
|
|
)
|
|
|
|
|
|
|
|
ng_dev_rolled_up_generated_file(
|
|
|
|
name = "build-worker",
|
|
|
|
entry_point = "//dev-infra/release/build:build-worker.ts",
|
|
|
|
deps = [
|
|
|
|
"//dev-infra/release/build",
|
|
|
|
],
|
|
|
|
)
|
2021-07-02 18:27:01 -04:00
|
|
|
# END-INTERNAL
|