Skip to content

Commit 40dca33

Browse files
committed
Switch to bun
Remove @vercell/ncc, bun build seems to be reproducible.
1 parent b246caa commit 40dca33

File tree

9 files changed

+18988
-28031
lines changed

9 files changed

+18988
-28031
lines changed

BUILD.bazel

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,22 +16,23 @@ genrule(
1616
cmd = """
1717
set -euo pipefail
1818
# provide a writable home dir
19-
export HOME=`pwd`
19+
export HOME="$$(pwd)/NOHOME"
20+
mkdir "$$HOME"
2021
# index.js should not be a symlink
2122
cat index.js > i.js && mv i.js index.js
22-
NPM=$(location @nodejs//:bin/npm)
23-
"$$NPM" ci
24-
"$$NPM" exec -- @vercel/ncc build index.js -o $(RULEDIR)/generated --no-cache
23+
BUN=$(location @bun//:bin/bun)
24+
$$BUN install --no-save
25+
$$BUN build --target=node --outfile=$@ $(location index.js)
2526
""",
26-
srcs = ["package.json", "package-lock.json", "index.js"],
27+
srcs = ["package.json", "bun.lockb", "index.js"],
2728
tags = ["requires-network"],
28-
tools = ["@nodejs//:bin/npm"],
29-
outs = ["generated/index.js"],
29+
tools = ["@nodejs//:bin/npm", "@bun//:bin/bun"],
30+
outs = ["generated/bundle.mjs"],
3031
visibility = ["//:__subpackages__"],
3132
)
3233

3334
updatesrc_diff_and_update(
3435
name = "update",
35-
srcs = ["dist/index.js"],
36+
srcs = ["dist/bundle.mjs"],
3637
outs = [":dist"],
3738
)

MODULE.bazel

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,3 +30,9 @@ nix_pkg.attr(
3030
repo = "@nixpkgs",
3131
)
3232
use_repo(nix_pkg, "nodejs")
33+
34+
nix_pkg.attr(
35+
attr = "bun",
36+
repo = "@nixpkgs",
37+
)
38+
use_repo(nix_pkg, "bun")

action.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,4 +38,4 @@ outputs:
3838

3939
runs:
4040
using: node20 # keep this in sync with @nodejs in MODULE.bazel
41-
main: dist/index.js
41+
main: dist/bundle.mjs

bun.lockb

3.67 KB
Binary file not shown.

0 commit comments

Comments
 (0)