Skip to content

Commit 924fa41

Browse files
authored
feat: add support for NodeJS 15.x (#2366)
Include support for NodeJS 15.x, updates some examples to use this Switches bazel-in-bazel example tests to use a tar file for package.json replacements
1 parent 43e9087 commit 924fa41

9 files changed

Lines changed: 153 additions & 16 deletions

File tree

examples/vendored_node/WORKSPACE

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,25 +26,25 @@ http_archive(
2626
)
2727

2828
http_archive(
29-
name = "vendored_node_10_12_0",
30-
build_file_content = """exports_files(["node-v10.12.0-linux-x64/bin/node"])""",
31-
sha256 = "4eba2e9a6db95745b769915d58e57df6ca6724ec1f023f76556fce30ceca2367",
32-
urls = ["https://nodejs.org/dist/v10.12.0/node-v10.12.0-linux-x64.tar.xz"],
29+
name = "vendored_node_15_0_1",
30+
build_file_content = """exports_files(["node-v15.0.1-linux-x64/bin/node"])""",
31+
sha256 = "cc9c3eed21755b490e5333ccab208ce15b539c35f64a764eeeae77c58746a7ff",
32+
urls = ["https://nodejs.org/dist/v15.0.1/node-v15.0.1-linux-x64.tar.xz"],
3333
)
3434

3535
load("@build_bazel_rules_nodejs//:index.bzl", "node_repositories", "npm_install")
3636

3737
# This example only works on linux as it downloads the linux node distribution
3838
# TODO(gregmagolan): make node_repositories acccept different archives for different platforms
3939
node_repositories(
40-
node_version = "10.12.0",
41-
vendored_node = "@vendored_node_10_12_0//:node-v10.12.0-linux-x64",
40+
node_version = "15.0.1",
41+
vendored_node = "@vendored_node_15_0_1//:node-v15.0.1-linux-x64",
4242
)
4343

4444
npm_install(
4545
name = "npm",
4646
data = [
47-
"@vendored_node_10_12_0//:node-v10.12.0-linux-x64/bin/node",
47+
"@vendored_node_15_0_1//:node-v15.0.1-linux-x64/bin/node",
4848
],
4949
package_json = "//:package.json",
5050
package_lock_json = "//:package-lock.json",
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
describe('vendored node', () => {
2-
it('version should be 10.12.0', () => {
3-
expect(process.version).toBe('v10.12.0');
2+
it('version should be 15.0.1', () => {
3+
expect(process.version).toBe('v15.0.1');
44
});
55
});

examples/vue/WORKSPACE

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,10 @@ http_archive(
1313

1414
load("@build_bazel_rules_nodejs//:index.bzl", "node_repositories", "npm_install")
1515

16-
node_repositories(package_json = ["//:package.json"])
16+
node_repositories(
17+
node_version = "15.0.1",
18+
package_json = ["//:package.json"],
19+
)
1720

1821
npm_install(
1922
name = "npm",

internal/bazel_integration_test/bazel_integration_test.bzl

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -269,6 +269,12 @@ def rules_nodejs_integration_test(name, **kwargs):
269269
repositories = kwargs.pop("repositories", {})
270270
repositories["//:release"] = "build_bazel_rules_nodejs"
271271

272+
# convert the npm packages into the tar output
273+
npm_packages = kwargs.pop("npm_packages", {})
274+
_tar_npm_packages = {}
275+
for key in npm_packages:
276+
_tar_npm_packages[key + ".tar"] = npm_packages[key]
277+
272278
bazel_integration_test(
273279
name = name,
274280
check_npm_packages = NPM_PACKAGES,
@@ -278,6 +284,7 @@ def rules_nodejs_integration_test(name, **kwargs):
278284
bazelrc_imports = {
279285
"//:common.bazelrc": "import %workspace%/../../common.bazelrc",
280286
},
287+
npm_packages = _tar_npm_packages,
281288
tags = tags,
282289
**kwargs
283290
)

internal/bazel_integration_test/test_runner.js

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -169,11 +169,13 @@ function copyNpmPackage(packagePath) {
169169
const to = tmp.dirSync({keep: DEBUG, unsafeCleanup: !DEBUG}).name;
170170
const from = RUNFILES_MANIFEST ? RUNFILES_MANIFEST[packagePath] :
171171
path.posix.join(process.cwd(), '..', packagePath);
172-
if (!isDirectory(from)) {
172+
if (!isFile(from)) {
173173
throw new Error(`npm package ${packagePath} not found at ${from}`);
174174
}
175-
copyFolderSync(from, to);
176-
return to;
175+
176+
const parsed = path.parse(from);
177+
copyFolderSync(parsed.dir, to);
178+
return path.join(to, parsed.base);
177179
}
178180

179181
const workspacePath = config.workspaceRoot.startsWith('external/') ?
@@ -243,6 +245,11 @@ if (config.bazelrcAppend) {
243245

244246
// Handle package.json replacements
245247
const packageJsonFile = path.posix.join(workspaceRoot, 'package.json');
248+
const packageJsonLockFile = path.posix.join(workspaceRoot, 'package-lock.json');
249+
const packageJsonLockContents = isFile(packageJsonLockFile) ?
250+
JSON.parse(fs.readFileSync(packageJsonLockFile, {encoding: 'utf-8'})) :
251+
undefined;
252+
246253
if (isFile(packageJsonFile)) {
247254
let packageJsonContents = fs.readFileSync(packageJsonFile, {encoding: 'utf-8'});
248255

@@ -259,8 +266,19 @@ if (isFile(packageJsonFile)) {
259266
packageJsonKey} failed!`)
260267
process.exit(1);
261268
}
269+
270+
if (packageJsonLockContents && packageJsonLockContents.packages && packageJsonKey) {
271+
// keeping the entry results in a npm error, but removing it solves it
272+
// TODO(matt): regenerate the entry here when I understand the filepaths :/
273+
delete packageJsonLockContents.packages[`node_modules/${packageJsonKey}`];
274+
}
262275
}
276+
263277
fs.writeFileSync(packageJsonFile, packageJsonContents);
278+
279+
if (packageJsonLockContents) {
280+
fs.writeFileSync(packageJsonLockFile, JSON.stringify(packageJsonLockContents, null, 2));
281+
}
264282
}
265283

266284
const packageJsonReplacementKeys = Object.keys(config.packageJsonRepacements);

internal/node/node_versions.bzl

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -550,6 +550,12 @@ NODE_VERSIONS = {
550550
"10.23.0-linux_s390x": ("node-v10.23.0-linux-s390x.tar.xz", "node-v10.23.0-linux-s390x", "421216ff143357a6ef27a293ac1aa1a3ad0eb4ca26f5b62d8301048cf5a2d63a"),
551551
"10.23.0-linux_amd64": ("node-v10.23.0-linux-x64.tar.xz", "node-v10.23.0-linux-x64", "3293b1ea9b9e08d9dbc5bb8717a80084e24cadfe3b030a8ebfdadea5f963dfc9"),
552552
"10.23.0-windows_amd64": ("node-v10.23.0-win-x64.zip", "node-v10.23.0-win-x64", "efafacc17f72ed96b4a08eda185b61e98f7aeb8a26a6776312055b8c0c492313"),
553+
# 10.23.1
554+
"10.23.1-darwin_amd64": ("node-v10.23.1-darwin-x64.tar.gz", "node-v10.23.1-darwin-x64", "07da39e4c122d1cee744f3a3ace904edf23c3256879adedafcca6a1da4ca4681"),
555+
"10.23.1-linux_arm64": ("node-v10.23.1-linux-arm64.tar.xz", "node-v10.23.1-linux-arm64", "9b923a161d80d2802241538c8f2099705163fc7f0dcd886d2274d8d6adf4f58f"),
556+
"10.23.1-linux_s390x": ("node-v10.23.1-linux-s390x.tar.xz", "node-v10.23.1-linux-s390x", "615962749dfe497d455426bc3097978b0504e0988e8bd198c0d202896056c245"),
557+
"10.23.1-linux_amd64": ("node-v10.23.1-linux-x64.tar.xz", "node-v10.23.1-linux-x64", "207e5ec77ca655ba6fcde922d6b329acbb09898b0bd793ccfcce6c27a36fdff0"),
558+
"10.23.1-windows_amd64": ("node-v10.23.1-win-x64.zip", "node-v10.23.1-win-x64", "497996aa1037b6f7f492c1d275bb90140269223939525286b4e95babad16f0de"),
553559
# 11.0.0
554560
"11.0.0-darwin_amd64": ("node-v11.0.0-darwin-x64.tar.gz", "node-v11.0.0-darwin-x64", "f70e12d246ba35e88c5c08a195215c5c913ce66c9d95d0bd21cc1d3e69904279"),
555561
"11.0.0-linux_arm64": ("node-v11.0.0-linux-arm64.tar.xz", "node-v11.0.0-linux-arm64", "0d0c7013fd00a8e713c36aa96bcc268eeadbad2ce48d87e19849d66f4c618cad"),
@@ -862,6 +868,12 @@ NODE_VERSIONS = {
862868
"12.20.0-linux_s390x": ("node-v12.20.0-linux-s390x.tar.xz", "node-v12.20.0-linux-s390x", "8295be2df01d29e741adb4431eb846470a9dc96b4096a6f64161e4579229ce58"),
863869
"12.20.0-linux_amd64": ("node-v12.20.0-linux-x64.tar.xz", "node-v12.20.0-linux-x64", "8eddb41e4b8a76cb99dd3c38826193eeb3e187301e5ef060a8bc7c18031b94f5"),
864870
"12.20.0-windows_amd64": ("node-v12.20.0-win-x64.zip", "node-v12.20.0-win-x64", "60653195f04fd4f3fd2ae6eef85a4c872d31e3a10fded9b75904195c60b143de"),
871+
# 12.20.1
872+
"12.20.1-darwin_amd64": ("node-v12.20.1-darwin-x64.tar.gz", "node-v12.20.1-darwin-x64", "da5d32de2e0f3e82b4bc4a33754a9ceedb3c031f8804e984de89d82074897795"),
873+
"12.20.1-linux_arm64": ("node-v12.20.1-linux-arm64.tar.xz", "node-v12.20.1-linux-arm64", "3c1dff2a7070214fa3947f8b7331c592e2d7c7347693da927b56cfd51ed70917"),
874+
"12.20.1-linux_s390x": ("node-v12.20.1-linux-s390x.tar.xz", "node-v12.20.1-linux-s390x", "409e7b1b99ceca82c3fa36785de38bac80acf40189a6052e4226299b690113a6"),
875+
"12.20.1-linux_amd64": ("node-v12.20.1-linux-x64.tar.xz", "node-v12.20.1-linux-x64", "313014c7e0abe808ec8453d78f7892c430e1b282a6d3faf9904fcb72c79e8db6"),
876+
"12.20.1-windows_amd64": ("node-v12.20.1-win-x64.zip", "node-v12.20.1-win-x64", "63cb0ccb17d6071e5418661b9755dc6a47f89db6e0945cb92dafbd000d9cc654"),
865877
# 13.0.0
866878
"13.0.0-darwin_amd64": ("node-v13.0.0-darwin-x64.tar.gz", "node-v13.0.0-darwin-x64", "612556a8c7e6b4cd08f6134b8afe5a05bf84c0121225fa9c542be1c98af04a35"),
867879
"13.0.0-linux_arm64": ("node-v13.0.0-linux-arm64.tar.xz", "node-v13.0.0-linux-arm64", "6ed882e17123861b5b81683de2b2c86be02c5916ef0beda04fd176329888fd12"),
@@ -1090,4 +1102,70 @@ NODE_VERSIONS = {
10901102
"14.15.3-linux_s390x": ("node-v14.15.3-linux-s390x.tar.xz", "node-v14.15.3-linux-s390x", "eb976b0d14cc629be3b1d03516ec5516c27d3655f84f11d23af15f4f83d34e27"),
10911103
"14.15.3-linux_amd64": ("node-v14.15.3-linux-x64.tar.xz", "node-v14.15.3-linux-x64", "6715ecd8b5ab626b4de8454bd0da629a6194bf8f25db71545da64b78b95e4350"),
10921104
"14.15.3-windows_amd64": ("node-v14.15.3-win-x64.zip", "node-v14.15.3-win-x64", "621de473d22debc0ab1e9a336dc2112d6efca7f7daa769018153e4309e6da844"),
1105+
# 14.15.4
1106+
"14.15.4-darwin_amd64": ("node-v14.15.4-darwin-x64.tar.gz", "node-v14.15.4-darwin-x64", "6b0e19e5c2601ef97510f7eb4f52cc8ee261ba14cb05f31eb1a41a5043b0304e"),
1107+
"14.15.4-linux_arm64": ("node-v14.15.4-linux-arm64.tar.xz", "node-v14.15.4-linux-arm64", "b990bd99679158c3164c55a20c2a6677c3d9e9ffdfa0d4a40afe9c9b5e97a96f"),
1108+
"14.15.4-linux_s390x": ("node-v14.15.4-linux-s390x.tar.xz", "node-v14.15.4-linux-s390x", "29f794d492eccaf0b08e6492f91162447ad95cfefc213fc580a72e29e11501a9"),
1109+
"14.15.4-linux_amd64": ("node-v14.15.4-linux-x64.tar.xz", "node-v14.15.4-linux-x64", "ed01043751f86bb534d8c70b16ab64c956af88fd35a9506b7e4a68f5b8243d8a"),
1110+
"14.15.4-windows_amd64": ("node-v14.15.4-win-x64.zip", "node-v14.15.4-win-x64", "b2a0765240f8fbd3ba90a050b8c87069d81db36c9f3745aff7516e833e4d2ed6"),
1111+
# 15.0.0
1112+
"15.0.0-darwin_amd64": ("node-v15.0.0-darwin-x64.tar.gz", "node-v15.0.0-darwin-x64", "f9eee1f659d96991bc629ec1cec986f504242fc0f046f4487d2fe13b9ab37c99"),
1113+
"15.0.0-linux_arm64": ("node-v15.0.0-linux-arm64.tar.xz", "node-v15.0.0-linux-arm64", "52aba1b117499680adea5fec43083fcb94a3483eda182ea82ca47f5d7c9eec97"),
1114+
"15.0.0-linux_s390x": ("node-v15.0.0-linux-s390x.tar.xz", "node-v15.0.0-linux-s390x", "7c916b1f3729a66701a0fc0ffe0afde05e401ccc3c53e7114db37cfbf4604f27"),
1115+
"15.0.0-linux_amd64": ("node-v15.0.0-linux-x64.tar.xz", "node-v15.0.0-linux-x64", "054c1c20ee237614e12ee2baab1ec96bfafc835a2d36fb2b860fdf10be0777b0"),
1116+
"15.0.0-windows_amd64": ("node-v15.0.0-win-x64.zip", "node-v15.0.0-win-x64", "fe8358e18a1f5a44849420d9d76c755e7489f92e0933c8d780107cd688e1d3d6"),
1117+
# 15.0.1
1118+
"15.0.1-darwin_amd64": ("node-v15.0.1-darwin-x64.tar.gz", "node-v15.0.1-darwin-x64", "8f7e2ddd44d2aef20d568489f2cf844383037725ce2fc04ad722a312ef08b2d0"),
1119+
"15.0.1-linux_arm64": ("node-v15.0.1-linux-arm64.tar.xz", "node-v15.0.1-linux-arm64", "403571f7e37dfefd7bd46411fff4ec7d81bf3d1a34feb37939ad35a06e61d855"),
1120+
"15.0.1-linux_s390x": ("node-v15.0.1-linux-s390x.tar.xz", "node-v15.0.1-linux-s390x", "537fec4b3e2c06459991d25641da83533fee551575326b36d54e44364a10678a"),
1121+
"15.0.1-linux_amd64": ("node-v15.0.1-linux-x64.tar.xz", "node-v15.0.1-linux-x64", "cc9c3eed21755b490e5333ccab208ce15b539c35f64a764eeeae77c58746a7ff"),
1122+
"15.0.1-windows_amd64": ("node-v15.0.1-win-x64.zip", "node-v15.0.1-win-x64", "efa7a74d91789a6e9f068f375e49f108ff87578fd88ff4b4e7fefd930c04db6c"),
1123+
# 15.1.0
1124+
"15.1.0-darwin_amd64": ("node-v15.1.0-darwin-x64.tar.gz", "node-v15.1.0-darwin-x64", "af4d2208a577501464cf39bff4de4d756b2e15b62ba83ab424ac0b5aa3e45c24"),
1125+
"15.1.0-linux_arm64": ("node-v15.1.0-linux-arm64.tar.xz", "node-v15.1.0-linux-arm64", "992f640323ba10bfb9c43a464f2be9047568883e127761244a97d0f9a00260dc"),
1126+
"15.1.0-linux_s390x": ("node-v15.1.0-linux-s390x.tar.xz", "node-v15.1.0-linux-s390x", "89f34b9f7a42e6d21919e3a7fe5e6dbe9891a2bc1a86f62b1b967a05bf45b51d"),
1127+
"15.1.0-linux_amd64": ("node-v15.1.0-linux-x64.tar.xz", "node-v15.1.0-linux-x64", "d049437db2e7b90c3d5afb53fc8dc33dc6069fb43aa05e59c985867fc3813ba6"),
1128+
"15.1.0-windows_amd64": ("node-v15.1.0-win-x64.zip", "node-v15.1.0-win-x64", "51f172afa35e6bff7096062819e5600672536f26f490f97ee782b30b3cf9c9ba"),
1129+
# 15.2.0
1130+
"15.2.0-darwin_amd64": ("node-v15.2.0-darwin-x64.tar.gz", "node-v15.2.0-darwin-x64", "31cd7d98b2eeddf0895e75b650d005af0f4103d6ce54a93554b32080a0b79780"),
1131+
"15.2.0-linux_arm64": ("node-v15.2.0-linux-arm64.tar.xz", "node-v15.2.0-linux-arm64", "3c3b12366023c895328a05d9c43842b4a26c372000ee351f02ee90a8844a5211"),
1132+
"15.2.0-linux_s390x": ("node-v15.2.0-linux-s390x.tar.xz", "node-v15.2.0-linux-s390x", "9768d32c762b876964db640a0108918a61ba31840d04a6fd1deb4f648a011079"),
1133+
"15.2.0-linux_amd64": ("node-v15.2.0-linux-x64.tar.xz", "node-v15.2.0-linux-x64", "3eb7c8e991af347c87817d9c1e1e16efaf31dfbd95b35fbd404d598fb4b14739"),
1134+
"15.2.0-windows_amd64": ("node-v15.2.0-win-x64.zip", "node-v15.2.0-win-x64", "2331e3a4dbfce4edc1ba1e146de47899eef5f76d6470c433826f2b8766c0e4e4"),
1135+
# 15.2.1
1136+
"15.2.1-darwin_amd64": ("node-v15.2.1-darwin-x64.tar.gz", "node-v15.2.1-darwin-x64", "2cca29de17ab2d047ca3a793fe15be43e251985dd3b186942b593fa2f0d9e47a"),
1137+
"15.2.1-linux_arm64": ("node-v15.2.1-linux-arm64.tar.xz", "node-v15.2.1-linux-arm64", "77983ab655fd90d64efb37149a45fbb79e4998c5952c5b4696a6fb1b87245311"),
1138+
"15.2.1-linux_s390x": ("node-v15.2.1-linux-s390x.tar.xz", "node-v15.2.1-linux-s390x", "5dcae04fa61959f28e5a9ef45d99ff06703c067f814d4f3a5d90d168c58d59b7"),
1139+
"15.2.1-linux_amd64": ("node-v15.2.1-linux-x64.tar.xz", "node-v15.2.1-linux-x64", "a13dc3282312f8e862b02e5aacd93a7dffe5b01d55f60f3a6042b10523b5d7b3"),
1140+
"15.2.1-windows_amd64": ("node-v15.2.1-win-x64.zip", "node-v15.2.1-win-x64", "ac3a647f18d0c81d5da4094f00526462c2ca38f4866c46489a6cd8ee402a417f"),
1141+
# 15.3.0
1142+
"15.3.0-darwin_amd64": ("node-v15.3.0-darwin-x64.tar.gz", "node-v15.3.0-darwin-x64", "58376f9bf566f89a664dd3c89e087b28fddb2b99a008a4952671d9ec4cf83e42"),
1143+
"15.3.0-linux_arm64": ("node-v15.3.0-linux-arm64.tar.xz", "node-v15.3.0-linux-arm64", "3e942f20f757574bd460951f47222b64ddebc0bf0a161ba1caf63442ec9602a9"),
1144+
"15.3.0-linux_s390x": ("node-v15.3.0-linux-s390x.tar.xz", "node-v15.3.0-linux-s390x", "dc78d66928d7ca8fc1aa88e2b1e4e82e29455acf75ce44232c2e1fb1d0ebe3aa"),
1145+
"15.3.0-linux_amd64": ("node-v15.3.0-linux-x64.tar.xz", "node-v15.3.0-linux-x64", "02741db3f55022a94f43fa1774e9fc389848949ec5f5cff822833d8b9711ad93"),
1146+
"15.3.0-windows_amd64": ("node-v15.3.0-win-x64.zip", "node-v15.3.0-win-x64", "757c3f5617d28f1fc56ccb8dd7008ea865e482ae9baf5e4bf4d003afa8ae9c8b"),
1147+
# 15.4.0
1148+
"15.4.0-darwin_amd64": ("node-v15.4.0-darwin-x64.tar.gz", "node-v15.4.0-darwin-x64", "503d160016f6a61ec25a9462499721ef96b9ed08e232a420d17541774e079dda"),
1149+
"15.4.0-linux_arm64": ("node-v15.4.0-linux-arm64.tar.xz", "node-v15.4.0-linux-arm64", "1b2b601167f6e07bb9b2bb86774bc386c5c60fac6ab28e49ad6d62f491be2b7f"),
1150+
"15.4.0-linux_s390x": ("node-v15.4.0-linux-s390x.tar.xz", "node-v15.4.0-linux-s390x", "417ade49c5d9b15391fb47e5d95bc91b0da90977472f062905b22f1a4a027f4c"),
1151+
"15.4.0-linux_amd64": ("node-v15.4.0-linux-x64.tar.xz", "node-v15.4.0-linux-x64", "a1fc57a8aeeb2a175ca62718fdc0f896efc0f78695a7d4f56d5e8653a24b1a11"),
1152+
"15.4.0-windows_amd64": ("node-v15.4.0-win-x64.zip", "node-v15.4.0-win-x64", "9bfd174d15cf38885740e3b2308e701f33d064bb1100afd59f8114298a89e4a7"),
1153+
# 15.5.0
1154+
"15.5.0-darwin_amd64": ("node-v15.5.0-darwin-x64.tar.gz", "node-v15.5.0-darwin-x64", "f7b2859579d5c1c6e6935e939e78b5405f21797782b1f3c9607aecd6ad6a3ebf"),
1155+
"15.5.0-linux_arm64": ("node-v15.5.0-linux-arm64.tar.xz", "node-v15.5.0-linux-arm64", "caf23a20ef6dbce192c954bc7c14296756153e23561b324266e0d2e5dba02527"),
1156+
"15.5.0-linux_s390x": ("node-v15.5.0-linux-s390x.tar.xz", "node-v15.5.0-linux-s390x", "0fd2258e1524ccc4c23ff0da422846ca482f4dc1c722b45d3e39bf671f8f032c"),
1157+
"15.5.0-linux_amd64": ("node-v15.5.0-linux-x64.tar.xz", "node-v15.5.0-linux-x64", "d1390db801acbbda692a3fefef861f8195374f374018f9404cabf53ab9816b93"),
1158+
"15.5.0-windows_amd64": ("node-v15.5.0-win-x64.zip", "node-v15.5.0-win-x64", "19353f6403deed2be4b2c056b161d4bad724418473e49e7a1cbe76eea06421be"),
1159+
# 15.5.1
1160+
"15.5.1-darwin_amd64": ("node-v15.5.1-darwin-x64.tar.gz", "node-v15.5.1-darwin-x64", "4507dab0481b0b5374b5758b1eba7d105c8cbcb173548119b04d9ef7d9f1d40f"),
1161+
"15.5.1-linux_arm64": ("node-v15.5.1-linux-arm64.tar.xz", "node-v15.5.1-linux-arm64", "b431a81ba4729233d686c922690b2d355381b1dd83b1fc486c4a27683ac15649"),
1162+
"15.5.1-linux_s390x": ("node-v15.5.1-linux-s390x.tar.xz", "node-v15.5.1-linux-s390x", "fa77245208b8f6fe1f40cc1b067bf08c1e33f857a328e78ededdc6ba1f016bae"),
1163+
"15.5.1-linux_amd64": ("node-v15.5.1-linux-x64.tar.xz", "node-v15.5.1-linux-x64", "dbc41a611d99aedf2cfd3d0acc50759a6b9084c7447862e990f51958d4a7aa41"),
1164+
"15.5.1-windows_amd64": ("node-v15.5.1-win-x64.zip", "node-v15.5.1-win-x64", "e1f826f9647fc7058b48c669991956a427fe4b6ccefa415a18b41715483f958d"),
1165+
# 15.6.0
1166+
"15.6.0-darwin_amd64": ("node-v15.6.0-darwin-x64.tar.gz", "node-v15.6.0-darwin-x64", "e79baddd344fd19c68104591964263b14ddc57fb98051bebb744151f21a83667"),
1167+
"15.6.0-linux_arm64": ("node-v15.6.0-linux-arm64.tar.xz", "node-v15.6.0-linux-arm64", "533a5cbda0dc4f42f0cd2967db3f40a5186e64806ee981b791e7c37bb2780fc3"),
1168+
"15.6.0-linux_s390x": ("node-v15.6.0-linux-s390x.tar.xz", "node-v15.6.0-linux-s390x", "94a350a4cbd1b46789b9425610e25dffd560b78d4e711708df06565b361df3fa"),
1169+
"15.6.0-linux_amd64": ("node-v15.6.0-linux-x64.tar.xz", "node-v15.6.0-linux-x64", "e8ae7a715c1886c1ca4ec401c401bc832c8fac586c7aa0e7cc1db9bda4e785a8"),
1170+
"15.6.0-windows_amd64": ("node-v15.6.0-win-x64.zip", "node-v15.6.0-win-x64", "83d1aafbe869c8e7064b8ad97894ce8428d8d66b8fa38f6d5364dc3e9ffb3813"),
10931171
}

internal/pkg_npm/pkg_npm.bzl

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ See the [stamping documentation](https://github.com/bazelbuild/rules_nodejs/blob
4040
4141
Usage:
4242
43-
`pkg_npm` yields three labels. Build the package directory using the default label:
43+
`pkg_npm` yields four labels. Build the package directory using the default label:
4444
4545
```sh
4646
$ bazel build :my_package
@@ -70,6 +70,17 @@ $ bazel run :my_package.publish
7070
You can pass arguments to npm by escaping them from Bazel using a double-hyphen, for example:
7171
7272
`bazel run my_package.publish -- --tag=next`
73+
74+
It is also possible to use the resulting tar file file from the `.pack` as an action input via the `.tar` label:
75+
76+
```python
77+
my_rule(
78+
name = "foo",
79+
srcs = [
80+
"//:my_package.tar",
81+
],
82+
)
83+
```
7384
"""
7485

7586
# Used in angular/angular /packages/bazel/src/ng_package/ng_package.bzl
@@ -307,17 +318,37 @@ def pkg_npm_macro(name, **kwargs):
307318
name = name,
308319
**kwargs
309320
)
321+
310322
native.alias(
311323
name = name + ".pack",
312324
actual = select({
313325
"@bazel_tools//src/conditions:host_windows": name + ".pack.bat",
314326
"//conditions:default": name + ".pack.sh",
315327
}),
316328
)
329+
317330
native.alias(
318331
name = name + ".publish",
319332
actual = select({
320333
"@bazel_tools//src/conditions:host_windows": name + ".publish.bat",
321334
"//conditions:default": name + ".publish.sh",
322335
}),
323336
)
337+
338+
native.genrule(
339+
name = "%s.tar" % name,
340+
outs = ["%s.tgz" % name],
341+
cmd = "$(location :%s.pack) | xargs -I {} cp {} $@" % name,
342+
# NOTE(mattem): on windows, it seems to output a buch of other stuff on stdout when piping, so pipe to tail
343+
# and grab the last line
344+
cmd_bat = "$(location :%s.pack) | tail -1 | xargs -I {} cp {} $@" % name,
345+
tools = [
346+
":%s.pack" % name,
347+
],
348+
# tagged as manual so this doesn't case two actions for each input with builds for "host" (as used as a tool)
349+
tags = [
350+
"local",
351+
"manual",
352+
],
353+
visibility = kwargs.get("visibility"),
354+
)

scripts/update-nodejs-versions.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
const https = require("https");
66

77
const MIN_VERSION = [8, 0, 0];
8-
const MAX_VERSION = [14, 99, 99];
8+
const MAX_VERSION = [15, 99, 99];
99

1010
const REPOSITORY_TYPES = {
1111
"darwin-x64.tar.gz": "darwin_amd64",

tools/defaults.bzl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ def pkg_npm(**kwargs):
5555
"0.0.0-PLACEHOLDER": "{STABLE_BUILD_SCM_VERSION}",
5656
})
5757

58-
# Finally call through to the rule with our defaults set
58+
# Call through to the rule with our defaults set
5959
_pkg_npm(
6060
deps = deps,
6161
substitutions = select({

0 commit comments

Comments
 (0)