Skip to content
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
2 changes: 1 addition & 1 deletion src/bun/devcontainer-feature.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "Bun",
"id": "bun",
"version": "1.1.2",
"version": "1.1.3",
"description": "Installs Bun (Javascript runtime written in zig)",
"documentationURL": "https://github.com/prulloac/devcontainer-features/tree/main/src/bun",
"options": {
Expand Down
20 changes: 12 additions & 8 deletions src/bun/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,14 @@ if [ "${USE_NPM}" = "false" ]; then
curl -fsSL https://bun.sh/install | bash

echo '# bun' >> /etc/bash.bashrc
echo 'export BUN_INSTALL="$HOME/.bun"' >> /etc/bash.bashrc
echo 'export BUN_INSTALL=/usr/local' >> /etc/bash.bashrc
echo 'export PATH=$BUN_INSTALL/bin:$PATH' >> /etc/bash.bashrc

if [ -x "$(command -v zsh)" ]; then
echo '# bun' >> /home/$_REMOTE_USER/.zshenv
echo 'export BUN_INSTALL="$HOME/.bun"' >> /home/$_REMOTE_USER/.zshenv
echo 'export PATH=$BUN_INSTALL/bin:$PATH' >> /home/$_REMOTE_USER/.zshenv
touch $_REMOTE_HOME/.zshenv
echo '# bun' >> $_REMOTE_HOME/.zshenv
echo 'export BUN_INSTALL=/usr/local' >> $_REMOTE_HOME/.zshenv
echo 'export PATH=$BUN_INSTALL/bin:$PATH' >> $_REMOTE_HOME/.zshenv
fi

else
Expand All @@ -45,12 +46,15 @@ else
npm install --global bun

echo '# bun' >> /etc/bash.bashrc
echo 'export BUN_INSTALL="$HOME/.bun"' >> /etc/bash.bashrc
echo 'export BUN_INSTALL=/usr/local' >> /etc/bash.bashrc
echo 'export PATH=$BUN_INSTALL/bin:$PATH' >> /etc/bash.bashrc

echo '# bun' >> /home/$_REMOTE_USER/.zshenv
echo 'export BUN_INSTALL="$HOME/.bun"' >> /home/$_REMOTE_USER/.zshenv
echo 'export PATH=$BUN_INSTALL/bin:$PATH' >> /home/$_REMOTE_USER/.zshenv
if [ -x "$(command -v zsh)" ]; then
touch $_REMOTE_HOME/.zshenv
echo '# bun' >> $_REMOTE_HOME/.zshenv
echo 'export BUN_INSTALL=/usr/local' >> $_REMOTE_HOME/.zshenv
echo 'export PATH=$BUN_INSTALL/bin:$PATH' >> $_REMOTE_HOME/.zshenv
fi

fi

Expand Down
9 changes: 9 additions & 0 deletions test/bun/issue_46.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/bin/bash

set -e

source dev-container-features-test-lib

check "validate bun installation" bun --version | grep '1'

reportResults
9 changes: 9 additions & 0 deletions test/bun/issue_46_beta.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/bin/bash

set -e

source dev-container-features-test-lib

check "validate bun installation" bun --version | grep '1'

reportResults
18 changes: 18 additions & 0 deletions test/bun/scenarios.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,23 @@
},
"remoteUser": "vscode",
"updateContentCommand": "npm install -g @devcontainers/cli"
},
"issue_46": {
"name": "issue_46",
"image": "mcr.microsoft.com/devcontainers/base:bookworm",
"features": {
"bun": {}
},
"remoteUser": "root"
},
"issue_46_beta": {
"name": "issue_46 with useNpm",
"image": "mcr.microsoft.com/devcontainers/base:bookworm",
"features": {
"bun": {
"useNpm": true
}
},
"remoteUser": "root"
}
}
Loading