Skip to content

Commit 0e18581

Browse files
authored
[19.2.x]: Third iteration of rules_js migration (#30705)
* build: update `angular-linking` to attempt fix postinstall flakiness This version of `angular-linking` has the new license (MIT), and also disables Babel config lookups. That potentially fixes the flakiness where Babel fails reading some incomplete config file * build: migrate theming tests to `rules_js` Migrates the theming tests to `rules_js`. This also requires us to bring in the Jasmine ruleset, and fix some issues with the test tsconfig. * build: migrate more targets to `ts_project` This commit migrates more targets from `ts_library` to `ts_project`. * build: include `src/cdk` in pnpm workspace This will allow pnpm to identifiy dependencies like `parse5` to be understood as non-dev dependencies, so that they are propagated with `rules_js` even when `cdk` is linked as `npm_package`. This is necessary when using the npm package of CDK in the Material schematic tests. To do this we need to give up on our non-statically readable substitutions for tslib and RxJS but this is acceptable as those don't change often and the benefits of the pnpm workspace are more important. We move `parse5` from `optionalDependencies` to `dependencies` so that pnpm recognizes this as non-dev dependency for the runtime execution of the CDK package. `parse5` doesn't have any native code, so `optionalDependencies` vs `dependencies` doesn't make a difference. Long-term we should consider simply bundling `parse5` here. * build: migrate schematics to `ts_project` Migrates all schematics code to `ts_project` and simplifies complexity/confusion around devmode,prodmode ESM and CommonJS.
1 parent 59ac27d commit 0e18581

File tree

87 files changed

+2756
-2788
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

87 files changed

+2756
-2788
lines changed
Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
# @generated
22
# Input hashes for repository rule npm_translate_lock(name = "npm2", pnpm_lock = "@//:pnpm-lock.yaml").
33
# This file should be checked into version control along with the pnpm-lock.yaml file.
4-
.npmrc=-2023857461
5-
package.json=-857504119
6-
pnpm-lock.yaml=-100482244
7-
pnpm-workspace.yaml=1711114604
8-
yarn.lock=514682322
4+
.npmrc=-1406867100
5+
package.json=453114886
6+
pnpm-lock.yaml=-236543617
7+
pnpm-workspace.yaml=14857322
8+
src/cdk/package.json=-908433069
9+
yarn.lock=-542661817

.bazelignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,5 @@ integration/yarn-pnp-compat/.yarn/cache
1717
integration/yarn-pnp-compat/.yarn/unplugged
1818
integration/yarn-pnp-compat/.yarn/install-state.gz
1919
integration/yarn-pnp-compat/node_modules
20+
21+
src/cdk/node_modules

.bazelrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ common --@aspect_rules_ts//ts:default_to_tsc_transpiler
1111
# https://github.com/bazelbuild/rules_typescript/issues/12 which affects the common case of
1212
# having `tsconfig.json` in the WORKSPACE directory. Instead, you should run
1313
# `bazel info output_base` to find out where the outputs went.
14-
build --symlink_prefix=/
14+
build --symlink_prefix=dist/
1515

1616
# Performance: avoid stat'ing input files
1717
build --watchfs

.npmrc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,8 @@ engine-strict = false
55
# projects using rules_js so that pnpm outside of Bazel lays out a node_modules tree similar to what
66
# rules_js lays out under Bazel (without a hidden node_modules/.pnpm/node_modules)
77
hoist=false
8+
9+
# Avoid pnpm auto-installing peer dependencies. We want to be explicit about our versions used
10+
# for peer dependencies, avoiding potential mismatches. In addition, it ensures we can continue
11+
# to rely on peer dependency placeholders substituted via Bazel.
12+
auto-install-peers=false

WORKSPACE

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,7 @@ yarn_install(
116116
"//:tools/postinstall/patches/@angular+build-tooling+0.0.0-335a273d3eb2a73c51efb97930fc1e0cd72e0d32.patch",
117117
"//:tools/postinstall/patches/@bazel+concatjs+5.8.1.patch",
118118
"//:tools/postinstall/patches/tsec+0.2.2.patch",
119+
"//src/cdk:package.json",
119120
],
120121
# Currently disabled due to:
121122
# 1. Missing Windows support currently.
@@ -175,6 +176,7 @@ npm_translate_lock(
175176
data = [
176177
"//:package.json",
177178
"//:pnpm-workspace.yaml",
179+
"//src/cdk:package.json",
178180
],
179181
npmrc = "//:.npmrc",
180182
pnpm_lock = "//:pnpm-lock.yaml",
@@ -209,6 +211,17 @@ http_archive(
209211
url = "https://github.com/aspect-build/rules_rollup/releases/download/v2.0.0/rules_rollup-v2.0.0.tar.gz",
210212
)
211213

214+
http_archive(
215+
name = "aspect_rules_jasmine",
216+
sha256 = "0d2f9c977842685895020cac721d8cc4f1b37aae15af46128cf619741dc61529",
217+
strip_prefix = "rules_jasmine-2.0.0",
218+
url = "https://github.com/aspect-build/rules_jasmine/releases/download/v2.0.0/rules_jasmine-v2.0.0.tar.gz",
219+
)
220+
221+
load("@aspect_rules_jasmine//jasmine:dependencies.bzl", "rules_jasmine_dependencies")
222+
223+
rules_jasmine_dependencies()
224+
212225
load("@bazel_tools//tools/build_defs/repo:git.bzl", "git_repository")
213226

214227
git_repository(

integration/size-test/BUILD.bazel

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
load("@npm//@bazel/esbuild:index.bzl", "esbuild_config")
2-
load("//tools:defaults.bzl", "ts_library")
2+
load("//tools:defaults2.bzl", "ts_project")
33

44
package(default_visibility = ["//visibility:public"])
55

@@ -19,16 +19,14 @@ esbuild_config(
1919
],
2020
)
2121

22-
ts_library(
22+
ts_project(
2323
name = "check-size",
2424
srcs = ["check-size.ts"],
25-
# TODO(ESM): remove this once the Bazel NodeJS rules can handle ESM with `nodejs_binary`.
26-
devmode_module = "commonjs",
2725
deps = [
28-
"@npm//@bazel/runfiles",
29-
"@npm//@types/node",
30-
"@npm//@types/yaml",
31-
"@npm//chalk",
32-
"@npm//yaml",
26+
"//:node_modules/@bazel/runfiles",
27+
"//:node_modules/@types/node",
28+
"//:node_modules/@types/yaml",
29+
"//:node_modules/chalk",
30+
"//:node_modules/yaml",
3331
],
3432
)

package.json

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@
3838
"tslint": "tslint -c tslint.json --project ./tsconfig.json",
3939
"stylelint": "stylelint \"src/**/*.+(css|scss)\" --config .stylelintrc.json",
4040
"resync-caretaker-app": "ts-node --project scripts/tsconfig.json scripts/caretaking/resync-caretaker-app-prs.ts",
41-
"ts-circular-deps:check": "yarn -s ng-dev ts-circular-deps check --config ./src/circular-deps-test.conf.js",
42-
"ts-circular-deps:approve": "yarn -s ng-dev ts-circular-deps approve --config ./src/circular-deps-test.conf.js",
41+
"ts-circular-deps:check": "yarn -s ng-dev ts-circular-deps check --config ./src/circular-deps-test.conf.cjs",
42+
"ts-circular-deps:approve": "yarn -s ng-dev ts-circular-deps approve --config ./src/circular-deps-test.conf.cjs",
4343
"merge": "yarn -s ng-dev pr merge",
4444
"approve-api": "node ./scripts/approve-api-golden.js",
4545
"approve-size-tests": "node ./scripts/approve-size-golden.js",
@@ -134,6 +134,7 @@
134134
"inquirer": "^8.2.0",
135135
"jasmine": "^4.1.0",
136136
"jasmine-core": "^4.1.0",
137+
"jasmine-reporters": "^2.5.2",
137138
"jsonc-parser": "^3.0.0",
138139
"kagekiri": "^1.4.1",
139140
"karma": "^6.3.12",
@@ -164,6 +165,7 @@
164165
"semver": "^7.3.5",
165166
"send": "^0.17.2",
166167
"shelljs": "^0.8.5",
168+
"source-map-support": "^0.5.21",
167169
"stylelint": "^14.14.0",
168170
"terser": "^5.10.0",
169171
"ts-node": "^10.9.1",
@@ -189,32 +191,32 @@
189191
"packageExtensions": {
190192
"@angular/animations": {
191193
"dependencies": {
192-
"@nginfra/angular-linking": "1.0.0"
194+
"@nginfra/angular-linking": "1.0.2"
193195
}
194196
},
195197
"@angular/common": {
196198
"dependencies": {
197-
"@nginfra/angular-linking": "1.0.0"
199+
"@nginfra/angular-linking": "1.0.2"
198200
}
199201
},
200202
"@angular/forms": {
201203
"dependencies": {
202-
"@nginfra/angular-linking": "1.0.0"
204+
"@nginfra/angular-linking": "1.0.2"
203205
}
204206
},
205207
"@angular/platform-browser": {
206208
"dependencies": {
207-
"@nginfra/angular-linking": "1.0.0"
209+
"@nginfra/angular-linking": "1.0.2"
208210
}
209211
},
210212
"@angular/router": {
211213
"dependencies": {
212-
"@nginfra/angular-linking": "1.0.0"
214+
"@nginfra/angular-linking": "1.0.2"
213215
}
214216
},
215217
"@angular/localize": {
216218
"dependencies": {
217-
"@nginfra/angular-linking": "1.0.0"
219+
"@nginfra/angular-linking": "1.0.2"
218220
}
219221
}
220222
}

packages.bzl

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,3 @@
1-
# Each individual package uses a placeholder for the version of Angular to ensure they're
2-
# all in-sync. This map is passed to each ng_package rule to stamp out the appropriate
3-
# version for the placeholders.
4-
TSLIB_PACKAGE_VERSION = "^2.3.0"
5-
RXJS_PACKAGE_VERSION = "^6.5.3 || ^7.4.0"
6-
71
# Packages which are versioned together on npm
82
ANGULAR_COMPONENTS_SCOPED_PACKAGES = ["@angular/%s" % p for p in [
93
"material",
@@ -27,12 +21,8 @@ PKG_GROUP_REPLACEMENTS = {
2721
NPM_PACKAGE_SUBSTITUTIONS = dict(PKG_GROUP_REPLACEMENTS, **{
2822
# Peer dependency version on the Angular framework.
2923
"0.0.0-NG": "{STABLE_FRAMEWORK_PEER_DEP_RANGE}",
30-
# Version of `tslib`
31-
"0.0.0-TSLIB": TSLIB_PACKAGE_VERSION,
3224
# Version of the local package being built, generated via the `--workspace_status_command` flag.
3325
"0.0.0-PLACEHOLDER": "{STABLE_PROJECT_VERSION}",
34-
# Version of `rxjs`
35-
"0.0.0-RXJS": RXJS_PACKAGE_VERSION,
3626
})
3727

3828
NO_STAMP_NPM_PACKAGE_SUBSTITUTIONS = dict(NPM_PACKAGE_SUBSTITUTIONS, **{

0 commit comments

Comments
 (0)