Skip to content

Commit 48cf9ac

Browse files
committed
feat(tooling): add devcontainer developing environment
1 parent e2ce0a2 commit 48cf9ac

File tree

2 files changed

+69
-0
lines changed

2 files changed

+69
-0
lines changed

.devcontainer/devcontainer.json

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
// Instructions to use this devcontainer:
2+
// 0. Make sure Docker or Podman is running.
3+
// 1. Install the VS Code extension "Dev Containers" (ms-vscode-remote.remote-containers).
4+
// 2. Open the Command Palette (Shift+Ctrl+P / Shift+Cmd+P) and run "Dev Containers: Reopen in Container",
5+
// alternatively "Dev Containers: Open Folder in Container".
6+
// 3. When finished, run "Dev Containers: Close Remote Connection" from the Command Palette to stop the container.
7+
// 4. To reclaim disk space, remove the stopped container/image with Docker/Podman,
8+
// the container can be recreated from this config when needed.
9+
{
10+
// Display name shown by editor when selecting this dev container
11+
"name": "${localWorkspaceFolderBasename} Dev Environment",
12+
13+
// Base image from Microsoft devcontainers for a TypeScript + Node environment
14+
"image": "mcr.microsoft.com/devcontainers/typescript-node:24",
15+
16+
// Persisted volumes to speed installs and avoid repeated network requests
17+
"mounts": [
18+
// Share a pnpm store cache volume to speed package resolution and install times across projects/containers
19+
"source=pnpm-cache,target=${containerWorkspaceFolder}/.pnpm-store,type=volume"
20+
],
21+
22+
// Run once after the container filesystem is created.
23+
// - Fix ownership so the non-root node user can access workspace files
24+
// - Install latest pnpm globally so postStartCommand and developer workflows use pnpm
25+
"postCreateCommand": "sudo corepack enable && sudo chown -R node:node /home/node ${containerWorkspaceFolder}",
26+
27+
// Run each time the container starts. Ensures dependencies are installed inside the container user environment.
28+
"postStartCommand": "pnpm install --frozen-lockfile",
29+
30+
// Use the non-root 'node' user provided by the base image for safer file access and to mirror deployment permissions
31+
"remoteUser": "node",
32+
33+
"customizations": {
34+
"vscode": {
35+
// Recommended and enforced editor settings for consistent linting/validation across contributors
36+
"settings": {
37+
// Prefer editor config over global formatting where appropriate
38+
"editor.formatOnSave": true,
39+
"editor.codeActionsOnSave": {
40+
"source.fixAll.eslint": "explicit"
41+
},
42+
"eslint.validate": [
43+
"json",
44+
"javascript",
45+
"javascriptreact",
46+
"typescript",
47+
"typescriptreact"
48+
],
49+
// Disable telemetry to avoid sending usage data to Microsoft
50+
"telemetry.enableTelemetry": false
51+
},
52+
53+
// Recommended extensions preinstalled in the container to provide a consistent developer experience
54+
"extensions": [
55+
"streetsidesoftware.code-spell-checker", // basic spell checking in docs/comments
56+
"bradlc.vscode-tailwindcss", // Tailwind CSS IntelliSense if project uses Tailwind
57+
"dbaeumer.vscode-eslint", // ESLint integration for linting and autofix
58+
"esbenp.prettier-vscode", // Prettier for consistent formatting
59+
"yoavbls.pretty-ts-errors", // Improved TypeScript error messages
60+
"davidanson.vscode-markdownlint", // Markdown linting for docs
61+
"github.vscode-github-actions", // GitHub Actions workflow support
62+
"github.vscode-pull-request-github" // PR and issue integration with GitHub
63+
]
64+
}
65+
}
66+
}
67+

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,5 @@ packages/*/dist*
1212
.env*
1313

1414
*.DS_Store
15+
16+
.pnpm-store

0 commit comments

Comments
 (0)