Skip to content

Commit

Permalink
build: migrate @angular/cli tests to use rules_js
Browse files Browse the repository at this point in the history
Integrates `@angular/cli` into the pnpm workspace and wires up the
native `rules_js` rules.

One nice benefits that highlight here:

- `resolve` runtime dependency is only installed in the CLI folder, and
  we can pull it from there. --> Locally managed deps! :yay:
  • Loading branch information
devversion authored and alan-agius4 committed Jan 20, 2025
1 parent 676ce57 commit d278d94
Show file tree
Hide file tree
Showing 9 changed files with 272 additions and 238 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,11 @@
# This file should be checked into version control along with the pnpm-lock.yaml file.
.npmrc=-2023857461
package.json=750671300
packages/angular_devkit/architect/package.json=-107274537
packages/angular/cli/package.json=349838588
packages/angular_devkit/architect/package.json=-1496633956
packages/angular_devkit/core/package.json=339935828
pnpm-lock.yaml=-1484082178
pnpm-workspace.yaml=-1853274682
packages/angular_devkit/schematics/package.json=673943597
packages/schematics/angular/package.json=251715148
pnpm-lock.yaml=1860194410
pnpm-workspace.yaml=1839001260
yarn.lock=1185228888
3 changes: 3 additions & 0 deletions WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -186,8 +186,11 @@ npm_translate_lock(
data = [
"//:package.json",
"//:pnpm-workspace.yaml",
"//packages/angular/cli:package.json",
"//packages/angular_devkit/architect:package.json",
"//packages/angular_devkit/core:package.json",
"//packages/angular_devkit/schematics:package.json",
"//packages/schematics/angular:package.json",
],
npmrc = "//:.npmrc",
patches = {
Expand Down
22 changes: 11 additions & 11 deletions packages/angular/cli/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,17 @@
# 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:ng_cli_schema_generator.bzl", "cli_json_schema")
load("//tools:ts_json_schema.bzl", "ts_json_schema")

licenses(["notice"])

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

npm_link_all_packages()

RUNTIME_ASSETS = glob(
include = [
"bin/**/*",
Expand Down Expand Up @@ -43,6 +45,10 @@ ts_project(
data = RUNTIME_ASSETS,
module_name = "@angular/cli",
deps = [
":node_modules/@angular-devkit/architect",
":node_modules/@angular-devkit/core",
":node_modules/@angular-devkit/schematics",
":node_modules/resolve",
"//:node_modules/@angular/core",
"//:node_modules/@inquirer/prompts",
"//:node_modules/@listr2/prompt-adapter-inquirer",
Expand All @@ -62,14 +68,8 @@ ts_project(
"//:node_modules/npm-pick-manifest",
"//:node_modules/pacote",
"//:node_modules/semver",
"//:node_modules/symbol-observable",
"//:node_modules/yargs",
"//packages/angular_devkit/architect:architect_rjs",
"//packages/angular_devkit/architect/node:node_rjs",
"//packages/angular_devkit/core:core_rjs",
"//packages/angular_devkit/core/node:node_rjs",
"//packages/angular_devkit/schematics:schematics_rjs",
"//packages/angular_devkit/schematics/tasks:tasks_rjs",
"//packages/angular_devkit/schematics/tools:tools_rjs",
],
)

Expand Down Expand Up @@ -148,9 +148,9 @@ ts_project(
],
)

jasmine_node_test(
jasmine_test(
name = "angular-cli_test",
srcs = [":angular-cli_test_lib"],
data = [":angular-cli_test_lib_rjs"],
)

genrule(
Expand Down
8 changes: 4 additions & 4 deletions packages/angular/cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@
},
"homepage": "/~https://github.com/angular/angular-cli",
"dependencies": {
"@angular-devkit/architect": "0.0.0-EXPERIMENTAL-PLACEHOLDER",
"@angular-devkit/core": "0.0.0-PLACEHOLDER",
"@angular-devkit/schematics": "0.0.0-PLACEHOLDER",
"@angular-devkit/architect": "workspace:0.0.0-EXPERIMENTAL-PLACEHOLDER",
"@angular-devkit/core": "workspace:0.0.0-PLACEHOLDER",
"@angular-devkit/schematics": "workspace:0.0.0-PLACEHOLDER",
"@inquirer/prompts": "7.2.1",
"@listr2/prompt-adapter-inquirer": "2.0.18",
"@schematics/angular": "0.0.0-PLACEHOLDER",
"@schematics/angular": "workspace:0.0.0-PLACEHOLDER",
"@yarnpkg/lockfile": "1.1.0",
"ini": "5.0.0",
"jsonc-parser": "3.3.1",
Expand Down
2 changes: 1 addition & 1 deletion packages/angular_devkit/architect/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"main": "src/index.js",
"typings": "src/index.d.ts",
"dependencies": {
"@angular-devkit/core": "0.0.0-PLACEHOLDER",
"@angular-devkit/core": "workspace:0.0.0-PLACEHOLDER",
"rxjs": "7.8.1"
},
"builders": "./builders/builders.json"
Expand Down
2 changes: 1 addition & 1 deletion packages/angular_devkit/schematics/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"schematics"
],
"dependencies": {
"@angular-devkit/core": "0.0.0-PLACEHOLDER",
"@angular-devkit/core": "workspace:0.0.0-PLACEHOLDER",
"jsonc-parser": "3.3.1",
"magic-string": "0.30.17",
"ora": "5.4.1",
Expand Down
4 changes: 2 additions & 2 deletions packages/schematics/angular/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
},
"schematics": "./collection.json",
"dependencies": {
"@angular-devkit/core": "0.0.0-PLACEHOLDER",
"@angular-devkit/schematics": "0.0.0-PLACEHOLDER",
"@angular-devkit/core": "workspace:0.0.0-PLACEHOLDER",
"@angular-devkit/schematics": "workspace:0.0.0-PLACEHOLDER",
"jsonc-parser": "3.3.1"
}
}
Loading

0 comments on commit d278d94

Please sign in to comment.