-
Notifications
You must be signed in to change notification settings - Fork 0
refactor(devcontainer): create dedicated installation scripts #9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
6faadd7
chore(devcontainer): move workspace folder to /src
iplaylf2 66d3b71
refactor(feature): extract fnm and uv installation scripts to separat…
iplaylf2 50691ad
chore(fnm): shorten feature name to "fnm"
iplaylf2 2c21b63
feat(shadowenv): add shadowenv devcontainer feature
iplaylf2 d72022a
chore(coderabbit): improve PR review workflow configuration
iplaylf2 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
This file contains hidden or 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 |
|---|---|---|
|
|
@@ -6,4 +6,5 @@ dockerfiles | |
| docstrings | ||
| mapfile | ||
| pipefail | ||
| shadowenv | ||
| shellcheck | ||
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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,15 @@ | ||
| #!/usr/bin/env bash | ||
| set -euo pipefail | ||
|
|
||
| node_version="${1:?node version required (lts | <version> | none)}" | ||
|
|
||
| curl -fsSL https://fnm.vercel.app/install | bash | ||
|
|
||
| fnm_dir="$HOME/.local/share/fnm" | ||
| export PATH="$fnm_dir:$PATH" | ||
iplaylf2 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| case "$node_version" in | ||
| none) ;; | ||
| lts) fnm install --lts ;; | ||
| *) fnm install "$node_version" ;; | ||
| esac | ||
This file contains hidden or 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 |
|---|---|---|
| @@ -1,20 +1,13 @@ | ||
| #!/usr/bin/env bash | ||
| if [ -z "${BASH_VERSION:-}" ] || [ "$(id -un)" != "$_REMOTE_USER" ]; then | ||
| exec su "$_REMOTE_USER" -c "bash -lc '$0'" | ||
| fi | ||
|
|
||
| set -euo pipefail | ||
|
|
||
| curl -fsSL https://fnm.vercel.app/install | bash | ||
|
|
||
| FNM_PATH="$HOME/.local/share/fnm" | ||
| export PATH="$FNM_PATH:$PATH" | ||
| FEATURE_DIR="$(cd "$(dirname "$0")" && pwd)" | ||
| FNM_SCRIPT="$FEATURE_DIR/fnm-install.sh" | ||
|
|
||
| NODE_VERSION="${NODE_VERSION:-lts}" | ||
| if [ "$NODE_VERSION" != "none" ]; then | ||
| if [ "$NODE_VERSION" = "lts" ]; then | ||
| fnm install --lts | ||
| else | ||
| fnm install "$NODE_VERSION" | ||
| fi | ||
|
|
||
| if [[ "$(id -un)" != "$_REMOTE_USER" ]]; then | ||
| su - "$_REMOTE_USER" -c "/bin/bash $(printf '%q ' "$FNM_SCRIPT" "$NODE_VERSION")" | ||
| else | ||
| /bin/bash "$FNM_SCRIPT" "$NODE_VERSION" | ||
| fi |
This file contains hidden or 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,6 @@ | ||
| { | ||
| "id": "shadowenv", | ||
| "version": "1.0.0", | ||
| "name": "shadowenv", | ||
| "description": "Installs shadowenv." | ||
| } |
This file contains hidden or 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,28 @@ | ||
| #!/usr/bin/env bash | ||
| set -euo pipefail | ||
|
|
||
| arch="$(uname -m)" | ||
| case "$arch" in | ||
| x86_64|amd64) target="x86_64-unknown-linux-gnu" ;; | ||
| aarch64|arm64) target="aarch64-unknown-linux-gnu" ;; | ||
| *) echo "shadowenv: unsupported arch: $arch" >&2; exit 1 ;; | ||
| esac | ||
|
|
||
| version="3.4.0" | ||
| url="https://github.com/Shopify/shadowenv/releases/download/${version}/shadowenv-${target}" | ||
|
|
||
| download_path="$(mktemp)" | ||
| trap 'rm -f "$download_path"' EXIT | ||
| curl -fsSL "$url" -o "$download_path" | ||
|
|
||
| install_path="/usr/local/bin/shadowenv" | ||
| install -m 0755 "$download_path" "$install_path" | ||
|
|
||
| FEATURE_DIR="$(cd "$(dirname "$0")" && pwd)" | ||
| REGISTER_SCRIPT="$FEATURE_DIR/shadowenv-register.sh" | ||
|
|
||
| if [[ "$(id -un)" != "$_REMOTE_USER" ]]; then | ||
| su - "$_REMOTE_USER" -c "/bin/bash $(printf '%q' "$REGISTER_SCRIPT")" | ||
| else | ||
| /bin/bash "$REGISTER_SCRIPT" | ||
| fi | ||
iplaylf2 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
This file contains hidden or 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,8 @@ | ||
| #!/usr/bin/env bash | ||
| set -euo pipefail | ||
|
|
||
| line='eval "$(shadowenv init bash)"' | ||
| bashrc="$HOME/.bashrc" | ||
|
|
||
| touch "$bashrc" | ||
| grep -Fqx "$line" "$bashrc" || printf '\n%s\n' "$line" >> "$bashrc" |
This file contains hidden or 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 |
|---|---|---|
| @@ -1,14 +1,13 @@ | ||
| #!/usr/bin/env bash | ||
| if [ -z "${BASH_VERSION:-}" ] || [ "$(id -un)" != "$_REMOTE_USER" ]; then | ||
| exec su "$_REMOTE_USER" -c "bash -lc '$0'" | ||
| fi | ||
|
|
||
| set -euo pipefail | ||
|
|
||
| curl -fsSL https://astral.sh/uv/install.sh | sh | ||
| . "$HOME/.local/bin/env" | ||
| FEATURE_DIR="$(cd "$(dirname "$0")" && pwd)" | ||
| UV_SCRIPT="$FEATURE_DIR/uv-install.sh" | ||
|
|
||
| PYTHON_VERSION="${PYTHON_VERSION:-3}" | ||
| if [ "$PYTHON_VERSION" != "none" ]; then | ||
| uv python install --default "$PYTHON_VERSION" | ||
|
|
||
| if [[ "$(id -un)" != "$_REMOTE_USER" ]]; then | ||
| su - "$_REMOTE_USER" -c "/bin/bash $(printf '%q ' "$UV_SCRIPT" "$PYTHON_VERSION")" | ||
| else | ||
| /bin/bash "$UV_SCRIPT" "$PYTHON_VERSION" | ||
| fi |
This file contains hidden or 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,12 @@ | ||
| #!/usr/bin/env bash | ||
| set -euo pipefail | ||
|
|
||
| python_version="${1:?python version required (e.g. 3 | 3.12 | none)}" | ||
|
|
||
| curl -LsSf https://astral.sh/uv/install.sh | sh | ||
iplaylf2 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| . "$HOME/.local/bin/env" | ||
iplaylf2 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| case "$python_version" in | ||
| none) ;; | ||
| *) uv python install "$python_version" --default ;; | ||
| esac | ||
This file contains hidden or 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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.