Skip to content

Commit 7a3977a

Browse files
committed
build: migrate apps/ directory to new toolchain (#2943)
PR Close #2943
1 parent 8f19310 commit 7a3977a

File tree

21 files changed

+194
-352
lines changed

21 files changed

+194
-352
lines changed

.aspect/rules/external_repository_action_cache/npm_translate_lock_LTkzNjczMzk3Mw==

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ github-actions/pull-request-labeling/package.json=-197755049
2020
github-actions/saucelabs/package.json=855472374
2121
github-actions/unified-status-check/package.json=-337882335
2222
ng-dev/package.json=1323489217
23-
package.json=-1202209611
24-
pnpm-lock.yaml=-1602715196
23+
package.json=-791801366
24+
pnpm-lock.yaml=-1788436055
2525
pnpm-workspace.yaml=1110472849
2626
yarn.lock=-598328143

WORKSPACE

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -209,3 +209,13 @@ rules_angular_step3(
209209
angular_compiler_cli = "@devinfra//:node_modules/@angular/compiler-cli",
210210
typescript = "@devinfra//:node_modules/typescript",
211211
)
212+
213+
git_repository(
214+
name = "rules_sass",
215+
commit = "cc1e845339fc45d3c8390445014d5824b85a0948",
216+
remote = "https://github.com/devversion/rules_sass.git",
217+
)
218+
219+
load("@rules_sass//src/toolchain:repositories.bzl", "setup_rules_sass")
220+
221+
setup_rules_sass()

apps/BUILD.bazel

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,13 @@
1-
load("@build_bazel_rules_nodejs//:index.bzl", "copy_to_bin", "nodejs_binary")
1+
load("@devinfra_npm//:firebase-tools/package_json.bzl", firebase = "bin")
2+
load("//tools:defaults2.bzl", "copy_to_bin", "ts_config")
3+
4+
ts_config(
5+
name = "tsconfig",
6+
src = "tsconfig.json",
7+
visibility = [
8+
"//apps:__subpackages__",
9+
],
10+
)
211

312
copy_to_bin(
413
name = "static_runfiles",
@@ -10,47 +19,44 @@ copy_to_bin(
1019
],
1120
)
1221

13-
nodejs_binary(
22+
firebase.firebase_binary(
1423
name = "serve",
1524
chdir = package_name(),
1625
data = [
1726
# top-level static runfiles
1827
":static_runfiles",
1928

2029
# Firebase function files
21-
"//apps/functions:functions_compiled",
2230
"//apps/functions:functions_files",
2331

2432
# Firebase hosted application files
2533
"//apps/code-of-conduct:application_files",
2634
],
27-
entry_point = "@npm//:node_modules/firebase-tools/lib/bin/firebase.js",
28-
tags = ["ibazel_notify_changes"],
29-
templated_args = [
35+
fixed_args = [
3036
"--project",
3137
"internal-200822",
3238
"--config",
3339
"firebase.json",
3440
"emulators:start",
3541
],
42+
tags = ["ibazel_notify_changes"],
3643
)
3744

38-
nodejs_binary(
45+
firebase.firebase_binary(
3946
name = "deploy",
4047
chdir = package_name(),
4148
data = [
4249
# top-level static runfiles
4350
":static_runfiles",
4451

4552
# Firebase function files
46-
"//apps/functions:functions_compiled",
4753
"//apps/functions:functions_files",
4854

4955
# Firebase hosted application files
5056
"//apps/code-of-conduct:application_files",
57+
"//:node_modules/firebase-functions",
5158
],
52-
entry_point = "@npm//:node_modules/firebase-tools/lib/bin/firebase.js",
53-
templated_args = [
59+
fixed_args = [
5460
"--project",
5561
"internal-200822",
5662
"--config",

apps/code-of-conduct/BUILD.bazel

Lines changed: 22 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,79 +1,59 @@
1-
load("//tools:defaults.bzl", "esbuild", "esbuild_config", "ng_module")
2-
load("@io_bazel_rules_sass//:defs.bzl", "npm_sass_library", "sass_binary")
3-
load("@build_bazel_rules_nodejs//:index.bzl", "copy_to_bin")
1+
load("//tools:defaults2.bzl", "copy_to_bin", "esbuild", "ng_project", "npm_sass_library", "sass_binary")
42

53
package(default_visibility = ["//apps/code-of-conduct:__subpackages__"])
64

7-
ng_module(
5+
ng_project(
86
name = "main",
97
srcs = [
108
"environment.ts",
119
"main.ts",
1210
],
1311
deps = [
14-
"//apps/code-of-conduct/app",
15-
"//apps/code-of-conduct/app:app_routes",
16-
"@npm//@angular/common",
17-
"@npm//@angular/compiler",
18-
"@npm//@angular/fire",
19-
"@npm//@angular/platform-browser",
20-
"@npm//@angular/router",
21-
"@npm//zone.js",
12+
"//:node_modules/@angular/common",
13+
"//:node_modules/@angular/compiler",
14+
"//:node_modules/@angular/fire",
15+
"//:node_modules/@angular/platform-browser",
16+
"//:node_modules/@angular/router",
17+
"//:node_modules/zone.js",
18+
"//apps/code-of-conduct/app:app_rjs",
19+
"//apps/code-of-conduct/app:app_routes_rjs",
2220
],
2321
)
2422

2523
npm_sass_library(
2624
name = "angular_material_sass_deps",
27-
deps = ["@npm//@angular/material"],
25+
deps = [
26+
"//:node_modules/@angular/cdk",
27+
"//:node_modules/@angular/material",
28+
],
2829
)
2930

3031
sass_binary(
3132
name = "styles",
3233
src = "styles.scss",
33-
include_paths = [
34-
"external/npm/node_modules",
35-
],
3634
deps = [
3735
":angular_material_sass_deps",
3836
],
3937
)
4038

41-
esbuild_config(
42-
name = "esbuild_config",
43-
config_file = "esbuild.config.mjs",
44-
deps = [
45-
"//shared-scripts/angular-optimization:js_lib",
46-
"@npm//@angular/compiler-cli",
47-
],
48-
)
49-
5039
esbuild(
51-
name = "bundles",
52-
config = ":esbuild_config",
53-
entry_points = [":main.ts"],
54-
platform = "browser",
55-
target = "es2016",
56-
deps = [
57-
":main",
40+
name = "bundle",
41+
srcs = [
42+
":main_rjs",
5843
],
44+
entry_points = [":main.js"],
45+
platform = "browser",
46+
target = "es2022",
5947
)
6048

6149
copy_to_bin(
62-
name = "application_files_in_bin",
50+
name = "application_files",
6351
srcs = [
6452
"favicon.ico",
6553
"index.html",
6654
"robots.txt",
67-
],
68-
)
69-
70-
filegroup(
71-
name = "application_files",
72-
srcs = [
73-
":application_files_in_bin",
74-
":bundles",
55+
":bundle",
7556
":styles",
76-
"@npm//:node_modules/zone.js/bundles/zone.umd.min.js",
7757
],
7858
visibility = ["//apps:__pkg__"],
7959
)

apps/code-of-conduct/app/BUILD.bazel

Lines changed: 19 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
1-
load("@io_bazel_rules_sass//:defs.bzl", "sass_binary")
2-
load("//tools:defaults.bzl", "ng_module")
1+
load("//tools:defaults2.bzl", "ng_project", "sass_binary")
32

43
package(default_visibility = ["//apps/code-of-conduct:__subpackages__"])
54

6-
ng_module(
5+
ng_project(
76
name = "app",
87
srcs = [
98
"app.component.ts",
@@ -13,12 +12,12 @@ ng_module(
1312
"app.component.html",
1413
],
1514
deps = [
16-
"//apps/code-of-conduct/app/account",
17-
"//apps/code-of-conduct/app/block-user",
18-
"//apps/code-of-conduct/app/user-table",
19-
"@npm//@angular/common",
20-
"@npm//@angular/core",
21-
"@npm//@angular/router",
15+
"//:node_modules/@angular/common",
16+
"//:node_modules/@angular/core",
17+
"//:node_modules/@angular/router",
18+
"//apps/code-of-conduct/app/account:account_rjs",
19+
"//apps/code-of-conduct/app/block-user:block-user_rjs",
20+
"//apps/code-of-conduct/app/user-table:user-table_rjs",
2221
],
2322
)
2423

@@ -27,29 +26,29 @@ sass_binary(
2726
src = "app.component.scss",
2827
)
2928

30-
ng_module(
29+
ng_project(
3130
name = "block_service",
3231
srcs = [
3332
"block.service.ts",
3433
],
3534
deps = [
36-
"@npm//@angular/common",
37-
"@npm//@angular/core",
38-
"@npm//@angular/fire",
39-
"@npm//@angular/material",
40-
"@npm//rxjs",
35+
"//:node_modules/@angular/common",
36+
"//:node_modules/@angular/core",
37+
"//:node_modules/@angular/fire",
38+
"//:node_modules/@angular/material",
39+
"//:node_modules/rxjs",
4140
],
4241
)
4342

44-
ng_module(
43+
ng_project(
4544
name = "app_routes",
4645
srcs = [
4746
"app.routes.ts",
4847
],
4948
deps = [
50-
"//apps/code-of-conduct/app/account",
51-
"//apps/code-of-conduct/app/login",
52-
"//apps/code-of-conduct/app/main",
53-
"@npm//@angular/router",
49+
"//:node_modules/@angular/router",
50+
"//apps/code-of-conduct/app/account:account_rjs",
51+
"//apps/code-of-conduct/app/login:login_rjs",
52+
"//apps/code-of-conduct/app/main:main_rjs",
5453
],
5554
)

apps/code-of-conduct/app/account/BUILD.bazel

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
1-
load("@io_bazel_rules_sass//:defs.bzl", "sass_binary")
2-
load("//tools:defaults.bzl", "ng_module")
1+
load("//tools:defaults2.bzl", "ng_project", "sass_binary")
32

4-
ng_module(
3+
ng_project(
54
name = "account",
65
srcs = glob(["*.ts"]),
76
assets = [
@@ -12,14 +11,14 @@ ng_module(
1211
"//apps:__subpackages__",
1312
],
1413
deps = [
15-
"@npm//@angular/cdk",
16-
"@npm//@angular/common",
17-
"@npm//@angular/core",
18-
"@npm//@angular/fire",
19-
"@npm//@angular/material",
20-
"@npm//@angular/router",
21-
"@npm//@octokit/rest",
22-
"@npm//rxjs",
14+
"//:node_modules/@angular/cdk",
15+
"//:node_modules/@angular/common",
16+
"//:node_modules/@angular/core",
17+
"//:node_modules/@angular/fire",
18+
"//:node_modules/@angular/material",
19+
"//:node_modules/@angular/router",
20+
"//:node_modules/@octokit/rest",
21+
"//:node_modules/rxjs",
2322
],
2423
)
2524

apps/code-of-conduct/app/block-user/BUILD.bazel

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
1-
load("//tools:defaults.bzl", "ng_module")
2-
load("@io_bazel_rules_sass//:defs.bzl", "sass_binary")
1+
load("//tools:defaults2.bzl", "ng_project", "sass_binary")
32

43
package(default_visibility = ["//apps/code-of-conduct:__subpackages__"])
54

6-
ng_module(
5+
ng_project(
76
name = "block-user",
87
srcs = glob(
98
["*.ts"],
@@ -14,12 +13,12 @@ ng_module(
1413
":block-user.component.html",
1514
],
1615
deps = [
17-
"//apps/code-of-conduct/app:block_service",
18-
"@npm//@angular/common",
19-
"@npm//@angular/core",
20-
"@npm//@angular/fire",
21-
"@npm//@angular/forms",
22-
"@npm//@angular/material",
16+
"//:node_modules/@angular/common",
17+
"//:node_modules/@angular/core",
18+
"//:node_modules/@angular/fire",
19+
"//:node_modules/@angular/forms",
20+
"//:node_modules/@angular/material",
21+
"//apps/code-of-conduct/app:block_service_rjs",
2322
],
2423
)
2524

apps/code-of-conduct/app/login/BUILD.bazel

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,19 @@
1-
load("@io_bazel_rules_sass//:defs.bzl", "sass_binary")
2-
load("//tools:defaults.bzl", "ng_module")
1+
load("//tools:defaults2.bzl", "ng_project", "sass_binary")
32

43
package(default_visibility = ["//apps/code-of-conduct:__subpackages__"])
54

6-
ng_module(
5+
ng_project(
76
name = "login",
87
srcs = glob(["*.ts"]),
98
assets = [
109
":login.component.css",
1110
"login.component.html",
1211
],
1312
deps = [
14-
"//apps/code-of-conduct/app/account",
15-
"@npm//@angular/common",
16-
"@npm//@angular/core",
17-
"@npm//@angular/material",
13+
"//:node_modules/@angular/common",
14+
"//:node_modules/@angular/core",
15+
"//:node_modules/@angular/material",
16+
"//apps/code-of-conduct/app/account:account_rjs",
1817
],
1918
)
2019

apps/code-of-conduct/app/main/BUILD.bazel

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,20 @@
1-
load("//tools:defaults.bzl", "ng_module")
2-
load("@io_bazel_rules_sass//:defs.bzl", "sass_binary")
1+
load("//tools:defaults2.bzl", "ng_project", "sass_binary")
32

43
package(default_visibility = ["//apps/code-of-conduct:__subpackages__"])
54

6-
ng_module(
5+
ng_project(
76
name = "main",
87
srcs = glob(["*.ts"]),
98
assets = [
109
":main.component.css",
1110
"main.component.html",
1211
],
1312
deps = [
14-
"//apps/code-of-conduct/app/block-user",
15-
"//apps/code-of-conduct/app/user-table",
16-
"@npm//@angular/common",
17-
"@npm//@angular/core",
18-
"@npm//@angular/material",
13+
"//:node_modules/@angular/common",
14+
"//:node_modules/@angular/core",
15+
"//:node_modules/@angular/material",
16+
"//apps/code-of-conduct/app/block-user:block-user_rjs",
17+
"//apps/code-of-conduct/app/user-table:user-table_rjs",
1918
],
2019
)
2120

0 commit comments

Comments
 (0)