-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: create a local feature for deno (#24)
this changeset is to refactor and clean up deno related configurations and settings to a local feature. - move deno to a local feature - move editor format settings to local feature - avoid clean up before restore
- Loading branch information
Showing
3 changed files
with
71 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
46 changes: 46 additions & 0 deletions
46
.devcontainer/local-features/deno/devcontainer-feature.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
{ | ||
"id": "deno", | ||
"name": "Deno", | ||
"version": "1.0.0", | ||
"description": "Installs Deno and needed dependencies instead of Node.js.", | ||
"options": { | ||
"version": { | ||
"type": "string", | ||
"proposals": [ | ||
"latest" | ||
], | ||
"default": "latest", | ||
"description": "Select or enter a Deno version to install" | ||
}, | ||
"denoInstall": { | ||
"type": "string", | ||
"description": "The path where Deno will be installed.", | ||
"default": "/usr/local" | ||
}, | ||
}, | ||
"customizations": { | ||
"vscode": { | ||
"extensions": [ | ||
"denoland.vscode-deno" | ||
], | ||
"settings": { | ||
// Better linting & formatting | ||
"deno.enable": true, | ||
"editor.defaultFormatter": "denoland.vscode-deno", | ||
"editor.formatOnPaste": true, | ||
"editor.formatOnSave": true, | ||
"editor.formatOnSaveMode": "file", | ||
"editor.codeActionsOnSave": [ | ||
"source.organizeImports", | ||
"source.fixAll" | ||
] | ||
} | ||
} | ||
}, | ||
"containerEnv": { | ||
"DENO_INSTALL": "/usr/local" | ||
}, | ||
"installsAfter": [ | ||
"ghcr.io/devcontainers/features/common-utils" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -e | ||
|
||
DENO_VERSION=${VERSION:-"latest"} | ||
DENO_INSTALL=${DENO_INSTALL:-"/usr/local"} | ||
|
||
echo "Activating feature 'deno@${DENO_VERSION}'" | ||
|
||
# The 'install.sh' entrypoint script is always executed as the 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 v${DENO_VERSION} | ||
fi | ||
fi |