Skip to content

Commit

Permalink
build: use worker for ts_project to enable fast DX and avoid no-san…
Browse files Browse the repository at this point in the history
…dbox issues

For the `rules_js` migration we are introducing a new ruleset for
Angular rules. These rules are not used here by the CLI as we don't use
`ng_module`, but we are building the rules in a way where we expose a
worker binary that can also work with vanilla TS.

The worker significantly speeds up compilations, bringing them to
equivalent speeds of `ts_library`, and **importantly** fixes/avoids
issues when actions are executing outside sandbox. E.g. on Windows where
the tsc compilation currently can see many other files that aren't
action inputs; and accidentally picks them up.
  • Loading branch information
devversion authored and clydin committed Dec 16, 2024
1 parent 6835c81 commit 15c743c
Show file tree
Hide file tree
Showing 6 changed files with 986 additions and 251 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Input hashes for repository rule npm_translate_lock(name = "npm2", pnpm_lock = "@//:pnpm-lock.yaml").
# This file should be checked into version control along with the pnpm-lock.yaml file.
.npmrc=-2023857461
package.json=1660173726
pnpm-lock.yaml=-575223749
package.json=584705354
pnpm-lock.yaml=-183886713
pnpm-workspace.yaml=1711114604
yarn.lock=1177923974
yarn.lock=1731700542
14 changes: 10 additions & 4 deletions WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ register_toolchains(
"//tools:windows_tar_system_toolchain",
)

load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive", "http_file")

http_archive(
name = "bazel_skylib",
Expand Down Expand Up @@ -37,9 +37,9 @@ build_bazel_rules_nodejs_dependencies()

http_archive(
name = "aspect_rules_js",
sha256 = "75c25a0f15a9e4592bbda45b57aa089e4bf17f9176fd735351e8c6444df87b52",
strip_prefix = "rules_js-2.1.0",
url = "https://github.com/aspect-build/rules_js/releases/download/v2.1.0/rules_js-v2.1.0.tar.gz",
sha256 = "3388abe9b9728ef68ea8d8301f932b11b2c9a271d74741ddd5f3b34d1db843ac",
strip_prefix = "rules_js-2.1.1",
url = "https://github.com/aspect-build/rules_js/releases/download/v2.1.1/rules_js-v2.1.1.tar.gz",
)

load("@aspect_rules_js//js:repositories.bzl", "rules_js_dependencies")
Expand Down Expand Up @@ -218,3 +218,9 @@ rules_ts_dependencies(
# TODO: Support in https://github.com/aspect-build/rules_ts/blob/main/ts/private/npm_repositories.bzl
ts_version = "5.6.2",
)

http_file(
name = "tsc_worker",
sha256 = "",
urls = ["https://raw.githubusercontent.com/devversion/rules_angular/a270a74d1e64577bddba96a5484c7c5d2c5d2770/dist/worker.mjs"],
)
Loading

0 comments on commit 15c743c

Please sign in to comment.