Skip to content

Commit

Permalink
Switch to bun
Browse files Browse the repository at this point in the history
Remove @vercell/ncc, bun build seems to be reproducible.
  • Loading branch information
avdv committed Nov 27, 2024
1 parent b246caa commit 0727586
Show file tree
Hide file tree
Showing 8 changed files with 18,987 additions and 28,030 deletions.
17 changes: 9 additions & 8 deletions BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -16,22 +16,23 @@ genrule(
cmd = """
set -euo pipefail
# provide a writable home dir
export HOME=`pwd`
export HOME="$$(pwd)/NOHOME"
mkdir "$$HOME"
# index.js should not be a symlink
cat index.js > i.js && mv i.js index.js
NPM=$(location @nodejs//:bin/npm)
"$$NPM" ci
"$$NPM" exec -- @vercel/ncc build index.js -o $(RULEDIR)/generated --no-cache
BUN=$(location @bun//:bin/bun)
$$BUN install --no-save
$$BUN build --target=node --outfile=$@ index.js
""",
srcs = ["package.json", "package-lock.json", "index.js"],
srcs = ["package.json", "bun.lockb", "index.js"],
tags = ["requires-network"],
tools = ["@nodejs//:bin/npm"],
outs = ["generated/index.js"],
tools = ["@nodejs//:bin/npm", "@bun//:bin/bun"],
outs = ["generated/bundle.mjs"],
visibility = ["//:__subpackages__"],
)

updatesrc_diff_and_update(
name = "update",
srcs = ["dist/index.js"],
srcs = ["dist/bundle.mjs"],
outs = [":dist"],
)
6 changes: 6 additions & 0 deletions MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,9 @@ nix_pkg.attr(
repo = "@nixpkgs",
)
use_repo(nix_pkg, "nodejs")

nix_pkg.attr(
attr = "bun",
repo = "@nixpkgs",
)
use_repo(nix_pkg, "bun")
Binary file added bun.lockb
Binary file not shown.
Loading

0 comments on commit 0727586

Please sign in to comment.