diff --git a/README.md b/README.md index c26ba75..6d5ab2c 100644 --- a/README.md +++ b/README.md @@ -91,7 +91,7 @@ just setup all This runs the full flow in `Scripts/setup.sh`: 1. base system setup -2. node +2. node / pnpm / yarn / bun 3. go / gvm 4. rust 5. python / pyenv / miniforge diff --git a/Scripts/node.sh b/Scripts/node.sh index 9629874..d714180 100644 --- a/Scripts/node.sh +++ b/Scripts/node.sh @@ -11,6 +11,7 @@ NC='\033[0m' export NVM_DIR="$HOME/.programming/node" export COREPACK_ENABLE_DOWNLOAD_PROMPT=0 +export BUN_INSTALL="$NVM_DIR/bun" echo -e "${BLUE} LOG:${YELLOW} Setting up Node.js (NVM) in ${NVM_DIR}...${NC}" @@ -30,9 +31,23 @@ if command -v nvm &> /dev/null; then echo -e "${BLUE} LOG:${YELLOW} Enabling Corepack (pnpm/yarn)...${NC}" corepack enable + + echo -e "${BLUE} LOG:${YELLOW} Preparing pnpm and yarn...${NC}" + + corepack prepare pnpm@latest --activate + corepack prepare yarn@stable --activate + + if [ ! -x "$BUN_INSTALL/bin/bun" ]; then + echo -e "${BLUE} LOG:${YELLOW} Installing Bun to ${BUN_INSTALL}...${NC}" + curl -fsSL https://bun.sh/install | bash + else + echo -e "${BLUE} LOG:${YELLOW} Bun already installed at ${BUN_INSTALL}.${NC}" + fi + + export PATH="$BUN_INSTALL/bin:$PATH" echo -e "${GREEN} LOG: Node setup complete. $(node -v)${NC}" - echo -e "${GREEN} LOG: Package Managers: pnpm $(pnpm -v), yarn $(yarn -v)${NC}" + echo -e "${GREEN} LOG: Package Managers: pnpm $(pnpm -v), yarn $(yarn -v), bun $(bun -v)${NC}" else echo -e "${RED} ERROR: NVM failed to load from $NVM_DIR${NC}" exit 1 diff --git a/Zsh/.zsh_prompt b/Zsh/.zsh_prompt index b4b9a64..bbc72e9 100644 --- a/Zsh/.zsh_prompt +++ b/Zsh/.zsh_prompt @@ -233,7 +233,7 @@ build_prompt() { [ -z "$python_version" ] || tool_versions+=("%F{magenta} ${python_version}%f") fi - if project_has_pattern '**/package.json' '**/.nvmrc' '**/pnpm-workspace.yaml' '**/yarn.lock' '**/package-lock.json'; then + if project_has_pattern '**/package.json' '**/.nvmrc' '**/pnpm-workspace.yaml' '**/yarn.lock' '**/package-lock.json' '**/bun.lock' '**/bun.lockb'; then node_version="$(get_command_version node)" [ -z "$node_version" ] || tool_versions+=("%F{green} ${node_version}%f") fi diff --git a/Zsh/.zshrc b/Zsh/.zshrc index 40c0361..9d8c817 100644 --- a/Zsh/.zshrc +++ b/Zsh/.zshrc @@ -219,6 +219,13 @@ bindkey '^[OA' history-substring-search-up bindkey '^[[B' history-substring-search-down bindkey '^[OB' history-substring-search-down +# bun +export BUN_INSTALL="$PROG_DIR/node/bun" +case ":$PATH:" in + *":$BUN_INSTALL/bin:"*) ;; + *) export PATH="$BUN_INSTALL/bin:$PATH" ;; +esac + # pnpm export PNPM_HOME="$PROG_DIR/node/pnpm" case ":$PATH:" in