Files
Bubberstation/tools/bootstrap/javascript.sh
Jeremiah e1c3946591 [tgui] Replaces node with bun (#91359)
## About The Pull Request
Swaps out node & yarn in favor of [bun](https://bun.sh/)

![image](https://github.com/user-attachments/assets/3df68cdf-98ed-477b-a9b6-5072d0de27ed)

sub tasks
- [x] add bun setup script
- [x] fix tgui-dev-server (bun glob is different)
- [x] set juke to run bun
- [x] remove all yarn stuff 
- [x] convert all tests from vitest to bun 
- [x] fight with CI/tgs

## Why It's Good For The Game
Yarn has served us over the years as our package manager but the method
it bundles dependencies has lead to issues and setbacks, notably needing
to wait on rspack support, but more recently in trying to switch to
biome
1. I can add in packages that do not need these workarounds, like god
intended
2. We won't need to [keep around
sdks](https://yarnpkg.com/getting-started/editor-sdks) which rely on
yarn to even publish
3. We're not committing the yarn cache or .pnp file, which kind of
defeats the purpose
4. Native typescript support and testing
5. Because it'd be cool

## Caveats
Rspack was throwing errors on TGS while doing this. I needed to switch
back to webpack/swc, which seems to work flawlessly. It was too tiring
for anyone involved to debug and this was the simplest route. It adds a
completely negligible amount of time to build. It might even resolve
some issues elsewhere.

Making this switch extends that very first setup time! I'm working on
cutting it down, but as of right now, it takes about 80 seconds just for
TGUI to download all the packages. Afterwards, it's the same.
## Changelog
2025-06-17 09:03:23 +12:00

33 lines
1.0 KiB
Bash
Executable File

#!/bin/sh
# bootstrap/bun
#
# Bun-finding script for all `sh` environments, including Linux, MSYS2,
# Git for Windows, and GitHub Desktop. Invokable from CLI or automation.
#
# If a bun executable installed by a bootstrapper is present, it will be used.
# Otherwise, this script requires a system `bun` to be provided.
set -e
# Load Bun version from dependencies.sh
OldPWD="$PWD"
cd "$(dirname "$0")/../.."
. ./dependencies.sh # sets BUN_VERSION (define this in dependencies.sh)
cd "$OldPWD"
BunVersion="$BUN_VERSION"
BunFullVersion="bun-v$BunVersion"
# If Bun is not present, install using the official installer.
if ! command -v bun >/dev/null 2>&1; then
echo "Bun not found, installing with official installer..."
curl -fsSL https://bun.sh/install | bash -s $BunFullVersion
if [ -d "$HOME/.bun/bin" ]; then
export PATH="$HOME/.bun/bin:$PATH"
else
echo "Bun installation directory not found. Please check the installation."
exit 1
fi
fi
echo "Using Bun $(bun --version)"
exec bun "$@"