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 .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"image": "mcr.microsoft.com/devcontainers/base:ubuntu",
"features": {
"ghcr.io/devcontainers-extra/features/homebrew-package:1": {},
"ghcr.io/eitsupi/devcontainer-features/jq-likes:2": {},
"./features/common": {},
"ghcr.io/itsmechlark/features/1password:1": {},
"ghcr.io/devcontainers/features/github-cli:1": {},
Expand Down
9 changes: 4 additions & 5 deletions .devcontainer/features/common/devcontainer-feature.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,9 @@
"name": "Common Development Setup",
"description": "Installs common development functions and configures development environment scripts",
"installsAfter": [
"ghcr.io/meaningful-ooo/devcontainer-features/homebrew"
"ghcr.io/meaningful-ooo/devcontainer-features/homebrew",
"ghcr.io/devcontainers-extra/features/zsh-plugins:0",
"ghcr.io/eitsupi/devcontainer-features/jq-likes:2"
],
"options": {},
"init": true,
"entrypoint": "/bin/sh",
"args": ["-c", "sh .devcontainer/features/common/install.sh"]
"options": {}
}
51 changes: 40 additions & 11 deletions .devcontainer/features/common/install.sh
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,14 +1,43 @@
#!/bin/sh
set -e

# npm/global.jsonからパッケージを読み込んでインストール
if [ -f "npm/global.json" ]; then
echo "Installing global npm packages from npm/global.json..."
jq -r '.dependencies | keys[]' npm/global.json | while read package; do
version=$(jq -r ".dependencies[\"$package\"].version" npm/global.json)
echo "Installing $package@$version..."
npm install -g "$package@$version"
done
#!/usr/bin/env bash
[ -n "${ZSH_VERSION-}" ] && emulate -L sh
set -eu
if (set -o 2>/dev/null | grep -q pipefail); then
set -o pipefail
fi

echo "Starting common feature installation..."
echo "Current working directory: $(pwd)"
echo "User: $(whoami)"
echo "Home directory: $HOME"

GLOBAL_JSON_PATHS=(
"npm/global.json"
"/workspace/npm/global.json"
"/workspaces/*/npm/global.json"
"$HOME/npm/global.json"
"/tmp/build/npm/global.json"
)

GLOBAL_JSON_FILE=""
for path in ${GLOBAL_JSON_PATHS[@]}; do
for file in $path; do
if [ -f "$file" ]; then
GLOBAL_JSON_FILE="$file"
echo "Found npm/global.json at: $GLOBAL_JSON_FILE"
break 2
fi
done
done

if [ -z "$GLOBAL_JSON_FILE" ]; then
echo "Warning: npm/global.json not found in any of the expected locations:"
for path in ${GLOBAL_JSON_PATHS[@]}; do
echo " - $path"
done
echo "Skipping npm package installation."
exit 0
fi

npm install -g $(jq -r '.dependencies | keys[]' "$GLOBAL_JSON_FILE")

echo "Feature installation completed. Configuration will be applied by postCreateCommand."