@@ -8,6 +8,7 @@ load("@aspect_bazel_lib//lib:utils.bzl", "to_label")
8
8
load ("@aspect_bazel_lib//lib:jq.bzl" , "jq" )
9
9
load ("@aspect_bazel_lib//lib:copy_to_directory.bzl" , "copy_to_directory" )
10
10
load ("//tools:link_package_json_to_tarballs.bzl" , "link_package_json_to_tarballs" )
11
+ load ("//:constants.bzl" , "RELEASE_ENGINES_NODE" , "RELEASE_ENGINES_NPM" , "RELEASE_ENGINES_YARN" )
11
12
12
13
_DEFAULT_TSCONFIG = "//:tsconfig-build.json"
13
14
_DEFAULT_TSCONFIG_TEST = "//:tsconfig-test.json"
@@ -64,12 +65,16 @@ def pkg_npm(name, pkg_deps = [], use_prodmode_output = False, **kwargs):
64
65
65
66
visibility = kwargs .pop ("visibility" , None )
66
67
67
- common_substitutions = dict (kwargs .pop ("substitutions" , {}))
68
- substitutions = dict (common_substitutions , ** {
69
- "0.0.0-PLACEHOLDER" : "0.0.0" ,
70
- })
71
- stamped_substitutions = dict (common_substitutions , ** {
68
+ NPM_PACKAGE_SUBSTITUTIONS = {
69
+ # Version of the local package being built, generated via the `--workspace_status_command` flag.
72
70
"0.0.0-PLACEHOLDER" : "{BUILD_SCM_VERSION}" ,
71
+ "0.0.0-ENGINES-NODE" : RELEASE_ENGINES_NODE ,
72
+ "0.0.0-ENGINES-NPM" : RELEASE_ENGINES_NPM ,
73
+ "0.0.0-ENGINES-YARN" : RELEASE_ENGINES_YARN ,
74
+ }
75
+
76
+ NO_STAMP_PACKAGE_SUBSTITUTIONS = dict (NPM_PACKAGE_SUBSTITUTIONS , ** {
77
+ "0.0.0-PLACEHOLDER" : "0.0.0" ,
73
78
})
74
79
75
80
deps = kwargs .pop ("deps" , [])
@@ -161,8 +166,8 @@ def pkg_npm(name, pkg_deps = [], use_prodmode_output = False, **kwargs):
161
166
package_name = None ,
162
167
validate = False ,
163
168
substitutions = select ({
164
- "//:stamp" : stamped_substitutions ,
165
- "//conditions:default" : substitutions ,
169
+ "//:stamp" : NPM_PACKAGE_SUBSTITUTIONS ,
170
+ "//conditions:default" : NO_STAMP_PACKAGE_SUBSTITUTIONS ,
166
171
}),
167
172
visibility = visibility ,
168
173
nested_packages = ["package" ],
0 commit comments