-
-
Notifications
You must be signed in to change notification settings - Fork 8.1k
feat: add dev container configuration for development experience #15895
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
base: master
Are you sure you want to change the base?
Conversation
Adds comprehensive VS Code dev container configuration to enable one-click development environment setup. The devcontainer includes Node.js 20 LTS, TypeScript tooling, and essential development services (Redis, NATS, MySQL) with pre-configured VS Code extensions and settings. Closes nestjs#15864
Pull Request Test Coverage Report for Build a79e1bef-a856-4cb1-8b31-900ac30e3cbfDetails
💛 - Coveralls |
.devcontainer/Dockerfile
Outdated
| nodemon \ | ||
| # Testing tools | ||
| mocha \ | ||
| nyc \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do we really need some of these packages to be installed globally?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're right - these don't need to be global. They're already in devDependencies and can be accessed via npm scripts or npx. I'll update the Dockerfile to remove the global installations of mocha, nyc, nodemon, ts-node, and other dev tools.
The only global package that might be justified is npm-check-updates for convenience, but I can remove that too if you prefer. Would you like me to keep just the base Node image and rely entirely on the local node_modules?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah i'd say the fewer global deps the better
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done! I've removed all global npm package installations from the Dockerfile. The devcontainer now relies entirely on local node_modules - all tools (typescript, ts-node, mocha, nyc, eslint, prettier, concurrently, cross-env, lerna, gulp-cli) are accessible via npx or npm scripts.
Removed global npm package installations (typescript, ts-node, mocha, nyc, eslint, prettier, concurrently, cross-env, lerna, gulp-cli) from the devcontainer Dockerfile. These packages are already available in devDependencies and can be accessed via npm scripts or npx, eliminating the need for global installations. This change aligns with the principle of minimizing global dependencies and relying on local node_modules instead.
Adds comprehensive VS Code dev container configuration to enable one-click development environment setup. The devcontainer includes Node.js 20 LTS, TypeScript tooling, and essential development services (Redis, NATS, MySQL) with pre-configured VS Code extensions and settings.
Closes #15864
PR Checklist
Please check if your PR fulfills the following requirements:
PR Type
What kind of change does this PR introduce?
What is the current behavior?
Contributors need to manually set up their local development environment, including Node.js version, dependencies, services (Redis, NATS, MySQL), and VS Code extensions/settings. This creates friction for new contributors and can lead to inconsistent development environments.
Issue Number: #15864
What is the new behavior?
Contributors can now use VS Code's "Reopen in Container" feature to automatically set up a complete, consistent development environment with:
.devcontainer/README.mdDoes this PR introduce a breaking change?
Other information
The devcontainer configuration is purely additive and doesn't affect existing development workflows. Developers can continue using their local setup if preferred. Integration test services are available via
npm run test:docker:upbut are not started automatically to ensure container reliability.The implementation follows VS Code dev container best practices and includes robust error handling for permission issues and npm installation failures that commonly occur in containerized environments.