fix: resolve devcontainer feature common installation issue - #22
Conversation
- Remove invalid entrypoint, args, and init fields from devcontainer-feature.json - Add robust path detection in install.sh to find npm/global.json - Add debugging output and error handling for better troubleshooting - Ensure jq dependency is installed before JSON parsing Fixes #21 Co-authored-by: keito4 <keito4@users.noreply.github.com>
|
Caution Review failedThe pull request is closed. WalkthroughThe changes update the Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant Container
participant InstallScript
participant System
User->>Container: Start devcontainer
Container->>InstallScript: Run install.sh
InstallScript->>System: Print diagnostics (cwd, user, home)
InstallScript->>System: Search for global.json in multiple locations
alt global.json found
InstallScript->>System: Parse global.json keys for npm packages
InstallScript->>System: Run npm install -g with package names
else global.json not found
InstallScript->>System: Output warning and exit gracefully
end
InstallScript->>System: Print completion message
Assessment against linked issues
Suggested labels
Poem
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (3)
✨ Finishing Touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Actionable comments posted: 2
🧹 Nitpick comments (4)
.devcontainer/features/common/install.sh (4)
4-9: Consider gating verbose debug output
Unconditional log lines (cwd, user, home) can clutter build logs. You could wrap them in aif [ "${DEBUG:-}" = "true" ]guard or introduce a--verboseflag so diagnostics only print when needed.
11-18: Use workspace environment variables for path discovery
Hardcoded locations like/workspaceand/workspaces/*may differ across setups. Leverage built-in DevContainer env vars to locate the repo root more reliably, for example:- "/workspace/npm/global.json" - "/workspaces/*/npm/global.json" + "${DEV_CONTAINER_WORKSPACE_FOLDER}/npm/global.json" + "${GITHUB_WORKSPACE}/npm/global.json"🧰 Tools
🪛 Shellcheck (0.10.0)
[warning] 12-18: In POSIX sh, arrays are undefined.
(SC3030)
41-45: Clean up apt caches after installingjq
To keep the container lean, install without recommends and remove the package lists afterward:- apt-get update && apt-get install -y jq + apt-get update \ + && apt-get install -y --no-install-recommends jq \ + && rm -rf /var/lib/apt/lists/*
47-53: Verifynpmis available before proceeding
If Node.js isn’t installed, thenpm install -gsteps will fail in an opaque way. Add an early check:if ! command -v npm >/dev/null 2>&1; then echo "Error: npm is not installed. Please include a Node.js feature before common." exit 1 fi
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
.devcontainer/features/common/devcontainer-feature.json(1 hunks).devcontainer/features/common/install.sh(1 hunks)
🧰 Additional context used
🪛 Shellcheck (0.10.0)
.devcontainer/features/common/install.sh
[warning] 12-18: In POSIX sh, arrays are undefined.
(SC3030)
[warning] 21-21: In POSIX sh, array references are undefined.
(SC3054)
[warning] 34-34: In POSIX sh, array references are undefined.
(SC3054)
🔇 Additional comments (1)
.devcontainer/features/common/devcontainer-feature.json (1)
9-9: Ensure installation script execution is still wired up
The explicit"init","entrypoint", and"args"properties have been removed and an emptyoptionsblock was added. Verify that your devcontainer’s rootdevcontainer.jsonor the feature’s ownruns/postCreateCommandis invoking.devcontainer/features/common/install.sh, otherwise the install script will no longer execute automatically.
…lobal.jsonのパス検出を改善。
Fixes #21
This PR resolves the issue where
./features/commonwas not being installed during build time.Changes
Testing
The feature will now properly install global npm packages from npm/global.json during devcontainer build.
Generated with Claude Code
Summary by CodeRabbit