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
1 change: 1 addition & 0 deletions src/deno/devcontainer-feature.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
"denoland.vscode-deno"
],
"settings": {
"deno.enable": true,
"github.copilot.chat.codeGeneration.instructions": [
{
"text": "This dev container includes `deno` pre-installed and available on the `PATH` for Deno, JavaScript and Typescript development."
Expand Down
31 changes: 13 additions & 18 deletions src/deno/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -42,33 +42,28 @@ check_packages ca-certificates curl dirmngr gpg gpg-agent

# Normalize version tag format
case "${VERSION}" in
latest | v*)
TAG="$VERSION"
;;
*)
TAG="v${VERSION}"
;;
latest) TAG="$(curl -s https://dl.deno.land/release-latest.txt)" ;;
v*) TAG="${VERSION}" ;;
*) TAG="v${VERSION}" ;;
esac

# Run installer as non-root user
# If we don't already have Deno installed, install it now.
if ! deno --version > /dev/null ; then
echo "Installing Deno..."
if [ "${DENO_VERSION}" = "latest" ]; then
curl -fsSL https://deno.land/install.sh | sh
else
curl -fsSL https://deno.land/install.sh | sh -s ${TAG}
fi
if ! deno --version > /dev/null; then
echo "Installing Deno ${TAG}..."
su "${_REMOTE_USER}" -c "curl -fsSL https://deno.land/install.sh | sh -s -- --yes ${TAG}"
fi

INSTALL_ENV=DENO_INSTALL
INSTALL_DIR="${!INSTALL_ENV:-${_REMOTE_USER_HOME}/.deno}"
BIN_DIR="${INSTALL_DIR}/bin"
EXE="${BIN_DIR}/deno"

# Install global packages if specified
# See # See https://docs.deno.com/runtime/reference/cli/install/#global-installation
# See https://docs.deno.com/runtime/reference/cli/install/#global-installation
if [ "${#PACKAGES[@]}" -gt 0 ]; then
echo "Installing global packages..."
su "${_REMOTE_USER}" -c "${EXE} install --global --allow-net --allow-read ${PACKAGES}"
su "${_REMOTE_USER}" -c "$EXE install --global --allow-net --allow-read ${PACKAGES}"
fi

# Clean up installer
rm -rf "${INSTALLER}"

echo "Done!"