Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: use npm to get/run bun #6

Merged
merged 3 commits into from
Jun 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 13 additions & 34 deletions axolotlsay-js/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,59 +4,38 @@ set -eu

EXE_BASENAME=axolotlsay-js

install_bun_windows() {
powershell -c "irm bun.sh/install.ps1 | iex"
}
# Install devDependencies to get bun
npm install --include=dev

install_bun_unix() {
curl -fsSL https://bun.sh/install | bash
}

# Don't install bun in interactive shells; just assume we have it
if [ -n "${CI:-}" ] && ! type bun >/dev/null; then
case "$(uname -s)" in
MINGW* | MSYS* | CYGWIN* | Windows_NT)
install_bun_windows
;;
*)
install_bun_unix
;;
esac

# So we don't have to reload the config it writes
# Note: this is also valid for Windows, which also places
# it in $HOME
export BUN_INSTALL="$HOME/.bun"
export PATH="$HOME/.bun/bin:$PATH"
fi

bun install

args=
bun_args=

# If we're building for cargo-dist, specify which target to build and what the
# filename should be. cargo-dist will expect one output with a known filename.
if [ -n "${CARGO_DIST_TARGET:-}" ]; then
case "${CARGO_DIST_TARGET}" in
x86_64-pc-windows-msvc)
args="--target bun-windows-x64 --outfile ${EXE_BASENAME}.exe"
bun_args="--target bun-windows-x64 --outfile ${EXE_BASENAME}.exe"
;;
mistydemeo marked this conversation as resolved.
Show resolved Hide resolved
aarch64-apple-darwin)
args="--target bun-darwin-arm64 --outfile ${EXE_BASENAME}"
bun_args="--target bun-darwin-arm64 --outfile ${EXE_BASENAME}"
;;
x86_64-apple-darwin)
args="--target bun-darwin-x64 --outfile ${EXE_BASENAME}"
bun_args="--target bun-darwin-x64 --outfile ${EXE_BASENAME}"
;;
aarch64-unknown-linux-gnu)
args="--target bun-linux-arm64 --outfile ${EXE_BASENAME}"
bun_args="--target bun-linux-arm64 --outfile ${EXE_BASENAME}"
;;
x86_64-unknown-linux-gnu)
args="--target bun-linux-x64 --outfile ${EXE_BASENAME}"
bun_args="--target bun-linux-x64 --outfile ${EXE_BASENAME}"
;;
aarch64-pc-windows-msvc)
echo "bun doesn't currently provide ARM binaries for Windows; unable to build"
exit 1
;;
*)
echo "Platform not supported: ${CARGO_DIST_TARGET}"
exit 1
esac
fi

bun build ./index.js --compile $args
npm run-script build -- $bun_args
Binary file modified axolotlsay-js/bun.lockb
Binary file not shown.
317 changes: 317 additions & 0 deletions axolotlsay-js/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading