11load ("@build_bazel_rules_nodejs//:index.bzl" , "copy_to_bin" )
2- load ("//tools:defaults.bzl" , "jasmine_node_test" , "pkg_npm" , "ts_library" )
2+ load ("//tools:defaults.bzl" , "jasmine_node_test" )
3+ load ("//tools:defaults2.bzl" , "npm_package" , "ts_project" )
4+ load ("@aspect_rules_ts//ts:defs.bzl" , rules_js_tsconfig = "ts_config" )
35
46package (default_visibility = ["//visibility:public" ])
57
68copy_to_bin (
79 name = "schematics_assets" ,
8- srcs = glob ([
9- "**/files/**/*" ,
10- "**/*.json" ,
11- ]),
10+ srcs = glob (
11+ [
12+ "**/files/**/*" ,
13+ "**/*.json" ,
14+ ],
15+ exclude = [
16+ "tsconfig.json" ,
17+ "tsconfig-test.json" ,
18+ "package.json" ,
19+ ],
20+ ),
21+ )
22+
23+ copy_to_bin (
24+ name = "package_json" ,
25+ srcs = ["package.json" ],
1226)
1327
14- ts_library (
28+ rules_js_tsconfig (
29+ name = "tsconfig" ,
30+ src = "tsconfig.json" ,
31+ )
32+
33+ ts_project (
1534 name = "schematics" ,
1635 srcs = glob (
1736 ["**/*.ts" ],
1837 exclude = [
19- "**/files/**/*.ts " ,
38+ "**/files/**/*" ,
2039 "**/*.spec.ts" ,
2140 "testing/**/*.ts" ,
2241 ],
2342 ),
24- # Schematics can not yet run in ESM module. For now we continue to use CommonJS.
25- # TODO(ESM): remove this once the Angular CLI supports ESM schematics.
26- devmode_module = "commonjs" ,
27- prodmode_module = "commonjs" ,
28- tsconfig = ":tsconfig.json" ,
29- deps = [
43+ interop_deps = [
3044 "//src/cdk/schematics/update-tool" ,
31- "@npm//@schematics/angular" ,
32- "@npm//@angular-devkit/core" ,
33- "@npm//@angular-devkit/schematics" ,
34- # TODO(devversion): Only include jasmine for test sources (See: tsconfig types).
35- "@npm//@types/jasmine" ,
36- "@npm//@types/glob" ,
37- "@npm//@types/node" ,
38- "@npm//glob" ,
39- "@npm//parse5" ,
40- "@npm//typescript" ,
4145 ],
42- )
43-
44- # This package is intended to be combined into the main @angular/cdk package as a dep.
45- pkg_npm (
46- name = "npm_package" ,
47- srcs = ["package.json" ],
46+ tsconfig = "tsconfig.json" ,
4847 deps = [
49- ":schematics" ,
50- ":schematics_assets" ,
48+ "//:node_modules/@angular-devkit/core" ,
49+ "//:node_modules/@angular-devkit/schematics" ,
50+ "//:node_modules/@schematics/angular" ,
51+ "//:node_modules/@types/glob" ,
52+ "//:node_modules/@types/node" ,
53+ "//:node_modules/glob" ,
54+ "//:node_modules/parse5" ,
55+ "//:node_modules/typescript" ,
5156 ],
5257)
5358
54- ### Testing rules
55-
56- jasmine_node_test (
57- name = "unit_tests" ,
58- srcs = [":unit_test_sources" ],
59- data = [
59+ # This package is intended to be combined into the main @angular/cdk package as a dep.
60+ npm_package (
61+ name = "npm_package" ,
62+ srcs = [
63+ "package.json" ,
6064 ":schematics_assets" ,
65+ ":schematics_rjs" ,
6166 ],
67+ package = "@angular/cdk/schematics" ,
6268)
6369
64- ts_library (
70+ ts_project (
6571 name = "unit_test_sources" ,
6672 testonly = True ,
6773 srcs = glob (
@@ -71,21 +77,28 @@ ts_library(
7177 "**/files/**/*.spec.ts" ,
7278 ],
7379 ),
74- # Schematics can not yet run in ESM module. For now we continue to use CommonJS.
75- # TODO(ESM): remove this once the Angular CLI supports ESM schematics.
76- devmode_module = "commonjs" ,
77- prodmode_module = "commonjs" ,
78- tsconfig = ":tsconfig.json" ,
79- deps = [
80- ":schematics" ,
80+ extends = "tsconfig.json" ,
81+ interop_deps = [
8182 "//src/cdk/schematics/testing" ,
8283 "//src/cdk/schematics/update-tool" ,
8384 "//src/cdk/testing/private" ,
84- "@npm//@angular-devkit/schematics" ,
85- "@npm//@bazel/runfiles" ,
86- "@npm//@schematics/angular" ,
87- "@npm//@types/jasmine" ,
88- "@npm//@types/node" ,
89- "@npm//typescript" ,
85+ ],
86+ tsconfig = "tsconfig-test.json" ,
87+ deps = [
88+ ":schematics_rjs" ,
89+ "//:node_modules/@angular-devkit/schematics" ,
90+ "//:node_modules/@bazel/runfiles" ,
91+ "//:node_modules/@schematics/angular" ,
92+ "//:node_modules/@types/jasmine" ,
93+ "//:node_modules/@types/node" ,
94+ "//:node_modules/typescript" ,
95+ ],
96+ )
97+
98+ jasmine_node_test (
99+ name = "unit_tests" ,
100+ srcs = [":unit_test_sources" ],
101+ data = [
102+ ":schematics_assets" ,
90103 ],
91104)
0 commit comments