1
1
load ("@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" )
3
5
4
6
package (default_visibility = ["//visibility:public" ])
5
7
6
8
copy_to_bin (
7
9
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" ],
12
26
)
13
27
14
- ts_library (
28
+ rules_js_tsconfig (
29
+ name = "tsconfig" ,
30
+ src = "tsconfig.json" ,
31
+ )
32
+
33
+ ts_project (
15
34
name = "schematics" ,
16
35
srcs = glob (
17
36
["**/*.ts" ],
18
37
exclude = [
19
- "**/files/**/*.ts " ,
38
+ "**/files/**/*" ,
20
39
"**/*.spec.ts" ,
21
40
"testing/**/*.ts" ,
22
41
],
23
42
),
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 = [
30
44
"//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" ,
41
45
],
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" ,
48
47
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" ,
51
56
],
52
57
)
53
58
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" ,
60
64
":schematics_assets" ,
65
+ ":schematics_rjs" ,
61
66
],
67
+ package = "@angular/cdk/schematics" ,
62
68
)
63
69
64
- ts_library (
70
+ ts_project (
65
71
name = "unit_test_sources" ,
66
72
testonly = True ,
67
73
srcs = glob (
@@ -71,21 +77,28 @@ ts_library(
71
77
"**/files/**/*.spec.ts" ,
72
78
],
73
79
),
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 = [
81
82
"//src/cdk/schematics/testing" ,
82
83
"//src/cdk/schematics/update-tool" ,
83
84
"//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" ,
90
103
],
91
104
)
0 commit comments