Skip to content

Commit cdfdc68

Browse files
josephperrottalan-agius4
authored andcommitted
build: migrate @schematics/angular to npm_package
This allows us to use the package in the RJS pnpm workspace.
1 parent 22f75e8 commit cdfdc68

File tree

1 file changed

+32
-28
lines changed

1 file changed

+32
-28
lines changed

packages/schematics/angular/BUILD.bazel

Lines changed: 32 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@
44
# found in the LICENSE file at https://angular.dev/license
55

66
load("@npm//@bazel/jasmine:index.bzl", "jasmine_node_test")
7-
load("//tools:defaults.bzl", "pkg_npm")
8-
load("//tools:interop.bzl", "ts_project")
7+
load("//tools:defaults2.bzl", "npm_package", "ts_project")
98
load("//tools:ts_json_schema.bzl", "ts_json_schema")
109

1110
licenses(["notice"])
@@ -36,6 +35,27 @@ ALL_SCHEMA_TARGETS = [
3635
for (src, name) in ALL_SCHEMA_TARGETS
3736
]
3837

38+
RUNTIME_ASSETS = [
39+
"collection.json",
40+
"migrations/migration-collection.json",
41+
"package.json",
42+
"utility/latest-versions/package.json",
43+
] + glob(
44+
include = [
45+
"*/schema.json",
46+
"*/files/**/*",
47+
"*/other-files/**/*",
48+
"*/implements-files/**/*",
49+
"*/type-files/**/*",
50+
"*/functional-files/**/*",
51+
"*/class-files/**/*",
52+
],
53+
exclude = [
54+
# NB: we need to exclude the nested node_modules that is laid out by yarn workspaces
55+
"node_modules/**",
56+
],
57+
)
58+
3959
ts_project(
4060
name = "angular",
4161
srcs = glob(
@@ -58,26 +78,7 @@ ts_project(
5878
"//packages/schematics/angular:" + src.replace(".json", ".ts")
5979
for (src, _) in ALL_SCHEMA_TARGETS
6080
],
61-
data = [
62-
"collection.json",
63-
"migrations/migration-collection.json",
64-
"package.json",
65-
"utility/latest-versions/package.json",
66-
] + glob(
67-
include = [
68-
"*/schema.json",
69-
"*/files/**/*",
70-
"*/other-files/**/*",
71-
"*/implements-files/**/*",
72-
"*/type-files/**/*",
73-
"*/functional-files/**/*",
74-
"*/class-files/**/*",
75-
],
76-
exclude = [
77-
# NB: we need to exclude the nested node_modules that is laid out by yarn workspaces
78-
"node_modules/**",
79-
],
80-
),
81+
data = RUNTIME_ASSETS,
8182
module_name = "@schematics/angular",
8283
deps = [
8384
"//:root_modules/@inquirer/prompts",
@@ -138,19 +139,22 @@ genrule(
138139
cmd = "cp $(execpath //:LICENSE) $@",
139140
)
140141

141-
pkg_npm(
142-
name = "npm_package",
142+
npm_package(
143+
name = "pkg",
143144
pkg_deps = [
144145
"//packages/angular_devkit/schematics:package.json",
145146
"//packages/angular_devkit/core:package.json",
146147
],
148+
stamp_files = [
149+
"utility/latest-versions.js",
150+
],
147151
tags = ["release-package"],
148-
deps = [
152+
deps = RUNTIME_ASSETS + [
149153
":README.md",
150-
":angular",
154+
":angular_rjs",
151155
":license",
152-
":migrations/migration-collection.json",
153-
":utility/latest-versions/package.json",
154156
"//packages/schematics/angular/third_party/github.com/Microsoft/TypeScript:LICENSE",
157+
# Force typescript library to be included.
158+
"//packages/schematics/angular/third_party/github.com/Microsoft/TypeScript:lib/typescript.js",
155159
],
156160
)

0 commit comments

Comments
 (0)