1
0
mirror of https://github.com/angular/angular-cli.git synced 2025-05-21 22:34:21 +08:00

build: migrate @angular/pwa tests to rules_js

This commit changes the execution of `@angular/pwa` tests to `rules_js`
native `jasmine_test`.

This requires setting it up in the pnpm workspace for first-party linked
dependencies. Notably it turns out the peer dependency placeholder was
incorrect, so we are fixing it here and nicely avoid a problem where
pnpm would otherwise not find a local, or external suitable version.

As we originally tried to work without the fix for the peer dependency
range, there was supported added for extra substitutions. We are keeping
that logic as it will likely be useful in the future.
This commit is contained in:
Paul Gschwendtner 2025-01-20 15:22:16 +00:00
parent 2982c01655
commit e519bef788
7 changed files with 40 additions and 21 deletions
.aspect/rules/external_repository_action_cache
WORKSPACE
packages/angular/pwa
pnpm-lock.yamlpnpm-workspace.yaml
tools/bazel

@ -4,11 +4,12 @@
.npmrc=-2023857461
package.json=1763647818
packages/angular/cli/package.json=-1878910022
packages/angular/pwa/package.json=1108903917
packages/angular_devkit/architect/package.json=-1496633956
packages/angular_devkit/architect_cli/package.json=1551210941
packages/angular_devkit/core/package.json=339935828
packages/angular_devkit/schematics/package.json=673943597
packages/schematics/angular/package.json=251715148
pnpm-lock.yaml=869099341
pnpm-workspace.yaml=-1051214858
pnpm-lock.yaml=-1415551433
pnpm-workspace.yaml=-818108966
yarn.lock=-1257671515

@ -187,6 +187,7 @@ npm_translate_lock(
"//:package.json",
"//:pnpm-workspace.yaml",
"//packages/angular/cli:package.json",
"//packages/angular/pwa:package.json",
"//packages/angular_devkit/architect:package.json",
"//packages/angular_devkit/architect_cli:package.json",
"//packages/angular_devkit/core:package.json",

@ -3,14 +3,16 @@
# Use of this source code is governed by an MIT-style license that can be
# found in the LICENSE file at https://angular.dev/license
load("@npm//@bazel/jasmine:index.bzl", "jasmine_node_test")
load("//tools:defaults2.bzl", "npm_package", "ts_project")
load("@npm2//:defs.bzl", "npm_link_all_packages")
load("//tools:defaults2.bzl", "jasmine_test", "npm_package", "ts_project")
load("//tools:ts_json_schema.bzl", "ts_json_schema")
licenses(["notice"])
package(default_visibility = ["//visibility:public"])
npm_link_all_packages()
RUNTIME_ASSETS = glob(
include = [
"pwa/*.js",
@ -32,10 +34,10 @@ ts_project(
data = RUNTIME_ASSETS,
module_name = "@angular/pwa",
deps = [
":node_modules/@angular-devkit/schematics",
":node_modules/@schematics/angular",
"//:node_modules/@types/node",
"//:node_modules/parse5-html-rewriting-stream",
"//packages/angular_devkit/schematics:schematics_rjs",
"//packages/schematics/angular:angular_rjs",
],
)
@ -55,9 +57,9 @@ ts_project(
],
)
jasmine_node_test(
jasmine_test(
name = "pwa_test",
srcs = [":pwa_test_lib"],
data = [":pwa_test_lib_rjs"],
)
genrule(

@ -12,12 +12,12 @@
"save": false
},
"dependencies": {
"@angular-devkit/schematics": "0.0.0-PLACEHOLDER",
"@schematics/angular": "0.0.0-PLACEHOLDER",
"@angular-devkit/schematics": "workspace:0.0.0-PLACEHOLDER",
"@schematics/angular": "workspace:0.0.0-PLACEHOLDER",
"parse5-html-rewriting-stream": "7.0.0"
},
"peerDependencies": {
"@angular/cli": "0.0.0-ANGULAR-FW-PEER-DEP"
"@angular/cli": "workspace:^0.0.0-PLACEHOLDER"
},
"peerDependenciesMeta": {
"@angular/cli": {

22
pnpm-lock.yaml generated

@ -580,6 +580,21 @@ importers:
specifier: 17.7.2
version: 17.7.2
packages/angular/pwa:
dependencies:
'@angular-devkit/schematics':
specifier: workspace:0.0.0-PLACEHOLDER
version: link:../../angular_devkit/schematics
'@angular/cli':
specifier: workspace:^0.0.0-PLACEHOLDER
version: link:../cli
'@schematics/angular':
specifier: workspace:0.0.0-PLACEHOLDER
version: link:../../schematics/angular
parse5-html-rewriting-stream:
specifier: 7.0.0
version: 7.0.0
packages/angular_devkit/architect:
dependencies:
'@angular-devkit/core':
@ -2218,7 +2233,6 @@ packages:
/@bazel/typescript@5.8.1(typescript@5.7.3):
resolution: {integrity: sha512-NAJ8WQHZL1WE1YmRoCrq/1hhG15Mvy/viWh6TkvFnBeEhNUiQUsA5GYyhU1ztnBIYW03nATO3vwhAEfO7Q0U5g==}
deprecated: No longer maintained, https://github.com/aspect-build/rules_ts is the recommended replacement
hasBin: true
peerDependencies:
typescript: 5.7.3
@ -7579,7 +7593,6 @@ packages:
/entities@4.5.0:
resolution: {integrity: sha512-V0hjH4dGPh9Ao5p0MoRY6BVqtwCjhz6vI5LT8AJ55H+4g9/4vbHx1I54fS0XuclLhDHArPQCiMjDxjaL8fPxhw==}
engines: {node: '>=0.12'}
dev: true
/env-paths@2.2.1:
resolution: {integrity: sha512-+h1lkLKhZMTYjog1VEpJNG7NZJWcuc2DDk/qsqSTRRCOXiLjeQ1d1/udrUGhqMxUgAlwKNZ0cf2uqan5GLuS2A==}
@ -11555,13 +11568,11 @@ packages:
entities: 4.5.0
parse5: 7.2.1
parse5-sax-parser: 7.0.0
dev: true
/parse5-sax-parser@7.0.0:
resolution: {integrity: sha512-5A+v2SNsq8T6/mG3ahcz8ZtQ0OUFTatxPbeidoMB7tkJSGDY3tdfl4MHovtLQHkEn5CGxijNWRQHhRQ6IRpXKg==}
dependencies:
parse5: 7.2.1
dev: true
/parse5@6.0.1:
resolution: {integrity: sha512-Ofn/CTFzRGTTxwpNEs9PP93gXShHcTq255nzRYSKe8AkVpZY7e1fpmTfOyoIvjP5HG7Z2ZM7VS9PPhQGW2pOpw==}
@ -11571,7 +11582,6 @@ packages:
resolution: {integrity: sha512-BuBYQYlv1ckiPdQi/ohiivi9Sagc9JG+Ozs0r7b/0iK3sKmrb0b9FdWdBbOdx6hBCM/F9Ir82ofnBhtZOjCRPQ==}
dependencies:
entities: 4.5.0
dev: true
/parseurl@1.3.3:
resolution: {integrity: sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ==}
@ -12115,7 +12125,7 @@ packages:
/puppeteer@18.2.1:
resolution: {integrity: sha512-7+UhmYa7wxPh2oMRwA++k8UGVDxh3YdWFB52r9C3tM81T6BU7cuusUSxImz0GEYSOYUKk/YzIhkQ6+vc0gHbxQ==}
engines: {node: '>=14.1.0'}
deprecated: < 22.8.2 is no longer supported
deprecated: < 19.4.0 is no longer supported
dependencies:
https-proxy-agent: 5.0.1(supports-color@10.0.0)
progress: 2.0.3

@ -5,4 +5,5 @@ packages:
- packages/angular_devkit/core
- packages/angular_devkit/schematics
- packages/angular/cli
- packages/angular/pwa
- packages/schematics/angular

@ -15,6 +15,7 @@ def npm_package(
pkg_deps = [],
stamp_files = [],
pkg_json = "package.json",
extra_substitutions = {},
**kwargs):
if name != "pkg":
fail("Expected npm_package to be named `pkg`. " +
@ -61,6 +62,9 @@ def npm_package(
out = "substituted_with_snapshot_repos/package.json",
)
nostamp_subs = dict(substitutions["rjs"]["nostamp"], **extra_substitutions)
stamp_subs = dict(substitutions["rjs"]["stamp"], **extra_substitutions)
expand_template(
name = "final_package_json",
template = select({
@ -71,8 +75,8 @@ def npm_package(
"//conditions:default": "substituted/package.json",
}),
out = "substituted_final/package.json",
substitutions = substitutions["rjs"]["nostamp"],
stamp_substitutions = substitutions["rjs"]["stamp"],
substitutions = nostamp_subs,
stamp_substitutions = stamp_subs,
)
stamp_targets = []
@ -81,8 +85,8 @@ def npm_package(
name = "stamp_file_%s" % f,
template = f,
out = "substituted/%s" % f,
substitutions = substitutions["rjs"]["nostamp"],
stamp_substitutions = substitutions["rjs"]["stamp"],
substitutions = nostamp_subs,
stamp_substitutions = stamp_subs,
)
stamp_targets.append("stamp_file_%s" % f)