JiaLiPassion 27cc56b359 fix(zone.js): add missing types field in package.json (#38585)
Close #38584

In zone.js 0.11.1, the `types` field is missing in the `package.json`,
the reason is in zone.js 0.11.0, the `files` field is used to specify the
types, but it cause the npm package not contain any bundles issue, so zone.js
0.11.1 remove the `files` field, which cause the `type` definition gone.

This PR concat the `zone.js.d.ts`, `zone.configurations.api.ts`, `zone.api.extensions.ts`
types into a single `zone.d.ts` file.

PR Close #38585
2020-09-11 08:43:53 -07:00

81 lines
2.1 KiB
Python

load("//tools:defaults.bzl", "pkg_npm")
load("//packages/zone.js:bundles.bzl", "BUNDLES_ENTRY_POINTS")
load("//packages/zone.js:tools.bzl", "generate_rollup_bundle")
package(default_visibility = ["//visibility:public"])
exports_files([
"tsconfig.json",
"rollup-es5.config.js",
"rollup-es5_global-es2015.config.js",
])
genrule(
name = "LICENSE_copy",
srcs = ["//:LICENSE"],
outs = ["LICENSE"],
cmd = "cp $< $@",
)
genrule(
name = "LICENSE_wrapped",
srcs = ["//:LICENSE"],
outs = ["LICENSE.wrapped"],
cmd = "(echo '/**\n @license' && cat $< && echo '*/') > $@",
)
# copy this file from //lib to //dist
genrule(
name = "zone_externs",
srcs = ["//packages/zone.js/lib:closure/zone_externs.js"],
outs = ["zone_externs.js"],
cmd = "cp $< $@",
)
genrule(
name = "zone_js_d_ts",
srcs = [
"//packages/zone.js/lib:zone_d_ts",
"//packages/zone.js/lib:zone.api.extensions.ts",
"//packages/zone.js/lib:zone.configurations.api.ts",
],
outs = ["zone.d.ts"],
cmd = "cat $(SRCS) > $@",
)
generate_rollup_bundle(
bundles = BUNDLES_ENTRY_POINTS,
)
pkg_npm(
name = "npm_package",
srcs = [
"CHANGELOG.md",
"README.md",
"package.json",
"//packages/zone.js/mix:package.json",
"//packages/zone.js/node:package.json",
"//packages/zone.js/testing:package.json",
],
visibility = ["//visibility:public"],
deps = [
":LICENSE.wrapped",
":LICENSE_copy",
":zone_externs",
"//packages/zone.js/dist:dist_bundle_group",
"//packages/zone.js/plugins:plugin_bundle_group",
] + [
"//packages/zone.js/bundles:" + b + "-es5.dist"
for b in BUNDLES_ENTRY_POINTS.keys()
] + [
"//packages/zone.js/bundles:" + b + "-es5.min.dist"
for b in BUNDLES_ENTRY_POINTS.keys()
] + [
"//packages/zone.js/fesm2015:" + b + "-es2015.dist"
for b in BUNDLES_ENTRY_POINTS.keys()
] + [
"//packages/zone.js/fesm2015:" + b + "-es2015.min.dist"
for b in BUNDLES_ENTRY_POINTS.keys()
] + [":zone_js_d_ts"],
)