Add devcontainer config to pin Node version from .nvmrc#1626
Add devcontainer config to pin Node version from .nvmrc#1626jakecoffman merged 2 commits intomainfrom
Conversation
Co-authored-by: jakecoffman <886768+jakecoffman@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
This pull request adds devcontainer configuration to ensure GitHub Codespaces uses the Node.js version specified in .nvmrc (20.9.0) instead of a newer default version. This aligns the Codespaces development environment with the Node version used in CI workflows and local development.
Changes:
- Adds
.devcontainer/devcontainer.jsonwith apostCreateCommandto install the correct Node version and dependencies
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| @@ -0,0 +1,3 @@ | |||
| { | |||
| "postCreateCommand": "nvm install && nvm alias default $(cat .nvmrc) && npm install" | |||
There was a problem hiding this comment.
The postCreateCommand is missing nvm use between nvm install and npm install. After installing the Node version, you need to activate it with nvm use before running npm commands. The README.md (line 31) shows the established pattern: nvm install;nvm use. Without this, npm install may run with a different Node version than intended. Consider updating to: nvm install && nvm use && nvm alias default $(cat .nvmrc) && npm install
| "postCreateCommand": "nvm install && nvm alias default $(cat .nvmrc) && npm install" | |
| "postCreateCommand": "nvm install && nvm use && nvm alias default $(cat .nvmrc) && npm install" |
| @@ -0,0 +1,3 @@ | |||
| { | |||
| "postCreateCommand": "nvm install && nvm alias default $(cat .nvmrc) && npm install" | |||
There was a problem hiding this comment.
The devcontainer configuration uses npm install but the project consistently uses npm clean-install everywhere else (test.yml:23, check-dist.yml:24, dependabot-build.yml:52, integration-test.yml:23). Using npm clean-install (or npm ci) ensures a clean, reproducible installation from package-lock.json, which is the established convention in this repository.
| "postCreateCommand": "nvm install && nvm alias default $(cat .nvmrc) && npm install" | |
| "postCreateCommand": "nvm install && nvm alias default $(cat .nvmrc) && npm clean-install" |
Codespaces launches with a newer Node than
.nvmrcspecifies. Added devcontainer configuration to install and default to the.nvmrcversion..devcontainer/devcontainer.jsonwith apostCreateCommandthat runsnvm install(reads.nvmrc), sets the default alias, and installs npm dependencies💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.