Skip to content

Commit 7ccf368

Browse files
josephperrottthePunderWoman
authored andcommitted
build: define typescript version via string in module.bazel file (angular#63431)
Within our module.bazel file when describing the version of typescript to use for rules_ts, we use ts_version instead of ts_version_from to prevent our package.json file from being part of the set of files used to calculate the sha for the lock file. Any unrelated change to the version of the typescript file would end up causing our lockfile to be out of date. This amount of churn has proven to be too much for our current setup. We instead now test to validate the versions defined in the package.json and MODULE.bazel files match. PR Close angular#63431
1 parent b2ed21b commit 7ccf368

File tree

3 files changed

+9
-6
lines changed

3 files changed

+9
-6
lines changed

BUILD.bazel

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
load("@aspect_rules_js//js:defs.bzl", "js_library")
2+
load("@devinfra//bazel/validation:defs.bzl", "validate_ts_version_matching")
23
load("@npm//:defs.bzl", "npm_link_all_packages")
34
load("//:yarn.bzl", "YARN_PATH")
45
load("//tools:defaults.bzl", "copy_to_bin", "js_binary")
@@ -11,7 +12,6 @@ exports_files([
1112
"browser-providers.conf.js",
1213
YARN_PATH,
1314
"package.json",
14-
"angular.json",
1515
])
1616

1717
npm_link_all_packages(
@@ -25,6 +25,11 @@ filegroup(
2525
srcs = ["package.json"],
2626
)
2727

28+
validate_ts_version_matching(
29+
module_lock_file = "MODULE.bazel.lock",
30+
package_json = "package.json",
31+
)
32+
2833
alias(
2934
name = "tsconfig.json",
3035
actual = "//packages:tsconfig-build.json",

MODULE.bazel

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ rules_ts_ext.deps(
104104
name = "angular_npm_typescript",
105105
# Obtained by: curl --silent https://registry.npmjs.org/typescript/5.9.2 | jq -r '.dist.integrity'
106106
ts_integrity = "sha512-CWBzXQrc/qOkhidw1OzBTQuYRbfyxDXJMVJ1XNwUHGROVmuaeiEm3OslpZ1RV96d7SKKjZKrSJu3+t/xlw3R9A==",
107-
ts_version_from = "//:package.json",
107+
ts_version = "5.9.2",
108108
)
109109
use_repo(rules_ts_ext, **{"npm_typescript": "angular_npm_typescript"})
110110

MODULE.bazel.lock

Lines changed: 2 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)