1
1
package (default_visibility = ["//visibility:public" ])
2
2
3
- load ("//:packages.bzl" , "CDK_PACKAGES" , "CDK_TARGETS" , "ROLLUP_GLOBALS" )
3
+ load ("//:packages.bzl" , "CDK_PACKAGES" , "CDK_TARGETS" , "CDK_TARGETS_WITH_STYLES" , " ROLLUP_GLOBALS" )
4
4
load ("//tools:defaults.bzl" , "ng_module" , "ng_package" )
5
5
6
6
# Root "@angular/cdk" entry-point that does not re-export individual entry-points.
@@ -16,6 +16,35 @@ ng_module(
16
16
],
17
17
)
18
18
19
+ # List of style files that need to be copied to the root of the CDK package. This is
20
+ # necessary in order to keep the Bazel NPM package similar to the previous gulp output.
21
+ rerootedStyles = [file for target in CDK_TARGETS_WITH_STYLES for file in [
22
+ [
23
+ "_%s.scss" % target ,
24
+ target ,
25
+ ],
26
+ [
27
+ "%s-prebuilt.css" % target ,
28
+ target ,
29
+ ],
30
+ [
31
+ "%s-prebuilt.css.map" % target ,
32
+ target ,
33
+ ],
34
+ ]]
35
+
36
+ # Copy all stylesheets to the CDK root package. We need to copy these files, as
37
+ # these stylesheets need to be at the root of the NPM package (e.g. "_a11y.scss")
38
+ [genrule (
39
+ name = "%s_rerooted" % file ,
40
+ srcs = ["//src/cdk/%s:%s" % (target , file )],
41
+ outs = [file ],
42
+ cmd = "cp $< $@" ,
43
+ ) for [
44
+ file ,
45
+ target ,
46
+ ] in rerootedStyles ]
47
+
19
48
filegroup (
20
49
name = "overviews" ,
21
50
srcs = ["//src/cdk/%s:overview" % name for name in CDK_PACKAGES ],
@@ -25,11 +54,12 @@ filegroup(
25
54
ng_package (
26
55
name = "npm_package" ,
27
56
srcs = ["package.json" ],
57
+ data = ["%s_rerooted" % file for [
58
+ file ,
59
+ _ ,
60
+ ] in rerootedStyles ],
28
61
entry_point = ":public-api.ts" ,
29
62
globals = ROLLUP_GLOBALS ,
30
- # TODO(devversion): Use the npm package for publishing. Right now this is disabled because
31
- # we build using AOT for serving & testing, but the `ng_package` rule should not include factory
32
- # files.
33
- tags = ["manual" ],
63
+ tags = ["release-package" ],
34
64
deps = CDK_TARGETS ,
35
65
)
0 commit comments