Skip to content

Commit

Permalink
build: migrate @angular-devkit/build-webpack tests to rules_js
Browse files Browse the repository at this point in the history
Migrates the `@angular-devkit/build-webpack` jasmine tests to
`rules_js`. This requires wiring up in the pnpm workspace.

Additionally `typescript` is added as it was missing as a "peer
dependency" at runtime for `@ngtools/webpack`. This is expected, and
we're already adding other peer deps before this change.
  • Loading branch information
devversion committed Jan 21, 2025
1 parent e519bef commit 14584f0
Show file tree
Hide file tree
Showing 7 changed files with 64 additions and 285 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,11 @@ 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/build_webpack/package.json=373950017
packages/angular_devkit/core/package.json=339935828
packages/angular_devkit/schematics/package.json=673943597
packages/ngtools/webpack/package.json=597254444
packages/schematics/angular/package.json=251715148
pnpm-lock.yaml=-1415551433
pnpm-workspace.yaml=-818108966
pnpm-lock.yaml=-690479437
pnpm-workspace.yaml=634423855
yarn.lock=-1257671515
2 changes: 2 additions & 0 deletions WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -190,8 +190,10 @@ npm_translate_lock(
"//packages/angular/pwa:package.json",
"//packages/angular_devkit/architect:package.json",
"//packages/angular_devkit/architect_cli:package.json",
"//packages/angular_devkit/build_webpack:package.json",
"//packages/angular_devkit/core:package.json",
"//packages/angular_devkit/schematics:package.json",
"//packages/ngtools/webpack:package.json",
"//packages/schematics/angular:package.json",
],
npmrc = "//:.npmrc",
Expand Down
24 changes: 12 additions & 12 deletions packages/angular_devkit/build_webpack/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,16 @@
# found in the LICENSE file at https://angular.dev/license

load("@npm//@angular/build-tooling/bazel/api-golden:index.bzl", "api_golden_test_npm_package")
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()

ts_json_schema(
name = "webpack_schema",
src = "src/builders/webpack/schema.json",
Expand Down Expand Up @@ -45,12 +47,12 @@ ts_project(
data = RUNTIME_ASSETS,
module_name = "@angular-devkit/build-webpack",
deps = [
":node_modules/@angular-devkit/architect",
":node_modules/@angular-devkit/core",
"//:node_modules/@types/node",
"//:node_modules/rxjs",
"//:node_modules/webpack",
"//:node_modules/webpack-dev-server",
"//packages/angular_devkit/architect:architect_rjs",
"//packages/angular_devkit/core:core_rjs",
],
)

Expand All @@ -69,27 +71,25 @@ ts_project(
),
deps = [
":build_webpack_rjs",
":node_modules/@angular-devkit/architect",
":node_modules/@angular-devkit/core",
":node_modules/@ngtools/webpack",
"//:node_modules/@types/jasmine",
"//packages/angular_devkit/architect:architect_rjs",
"//packages/angular_devkit/architect/node:node_rjs",
"//packages/angular_devkit/architect/testing:testing_rjs",
"//packages/angular_devkit/core:core_rjs",
"//packages/angular_devkit/core/node:node_rjs",
"//packages/ngtools/webpack:webpack_rjs",
],
)

jasmine_node_test(
jasmine_test(
name = "build_webpack_test",
srcs = [":build_webpack_test_lib"],
data = [
"build_webpack_test_lib_rjs",
"//:node_modules/@angular/common",
"//:node_modules/@angular/compiler",
"//:node_modules/@angular/compiler-cli",
"//:node_modules/@angular/core",
"//:node_modules/@angular/platform-browser",
"//:node_modules/@angular/platform-browser-dynamic",
"//:node_modules/tslib",
"//:node_modules/typescript",
"//:node_modules/zone.js",
],
)
Expand Down
5 changes: 3 additions & 2 deletions packages/angular_devkit/build_webpack/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,12 @@
"./*.js": "./*.js"
},
"dependencies": {
"@angular-devkit/architect": "0.0.0-EXPERIMENTAL-PLACEHOLDER",
"@angular-devkit/architect": "workspace:0.0.0-EXPERIMENTAL-PLACEHOLDER",
"rxjs": "7.8.1"
},
"devDependencies": {
"@angular-devkit/core": "0.0.0-PLACEHOLDER",
"@angular-devkit/core": "workspace:0.0.0-PLACEHOLDER",
"@ngtools/webpack": "workspace:0.0.0-PLACEHOLDER",
"webpack": "5.97.1"
},
"peerDependencies": {
Expand Down
2 changes: 1 addition & 1 deletion packages/ngtools/webpack/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"webpack": "^5.54.0"
},
"devDependencies": {
"@angular-devkit/core": "0.0.0-PLACEHOLDER",
"@angular-devkit/core": "workspace:0.0.0-PLACEHOLDER",
"@angular/compiler": "19.1.2",
"@angular/compiler-cli": "19.1.2",
"typescript": "5.7.3",
Expand Down
Loading

0 comments on commit 14584f0

Please sign in to comment.