|
| 1 | +// .devcontainer/devcontainer.json |
| 2 | +// VS Code / GitHub Codespaces devcontainer for the cfxdevkit monorepo. |
| 3 | +// |
| 4 | +// Features: |
| 5 | +// • Node.js 22 + pnpm |
| 6 | +// • Biome, ESLint and TypeScript tooling pre-installed |
| 7 | +// • All workspace ports forwarded automatically |
| 8 | +// • `pnpm install` runs automatically after the container is created |
| 9 | +{ |
| 10 | + "name": "cfxdevkit monorepo", |
| 11 | + |
| 12 | + // Use the official Microsoft Node.js devcontainer image (Debian-based). |
| 13 | + "image": "mcr.microsoft.com/devcontainers/javascript-node:1-22-bookworm", |
| 14 | + |
| 15 | + // ── Features ───────────────────────────────────────────────────────────── |
| 16 | + "features": { |
| 17 | + // Enable corepack so `pnpm` is available without a global install. |
| 18 | + "ghcr.io/devcontainers/features/node:1": { |
| 19 | + "version": "22", |
| 20 | + "nodeGypDependencies": false |
| 21 | + } |
| 22 | + }, |
| 23 | + |
| 24 | + // ── VS Code extensions ──────────────────────────────────────────────────── |
| 25 | + "customizations": { |
| 26 | + "vscode": { |
| 27 | + "extensions": [ |
| 28 | + "biomejs.biome", |
| 29 | + "dbaeumer.vscode-eslint", |
| 30 | + "ms-vscode.vscode-typescript-next", |
| 31 | + "esbenp.prettier-vscode", |
| 32 | + "ms-azuretools.vscode-docker", |
| 33 | + "redhat.vscode-yaml", |
| 34 | + "bradlc.vscode-tailwindcss", |
| 35 | + "streetsidesoftware.code-spell-checker" |
| 36 | + ], |
| 37 | + "settings": { |
| 38 | + // Use Biome as the default formatter for JavaScript / TypeScript. |
| 39 | + "editor.defaultFormatter": "biomejs.biome", |
| 40 | + "editor.formatOnSave": true, |
| 41 | + "[javascript]": { "editor.defaultFormatter": "biomejs.biome" }, |
| 42 | + "[typescript]": { "editor.defaultFormatter": "biomejs.biome" }, |
| 43 | + "[json]": { "editor.defaultFormatter": "biomejs.biome" }, |
| 44 | + "[jsonc]": { "editor.defaultFormatter": "biomejs.biome" } |
| 45 | + } |
| 46 | + } |
| 47 | + }, |
| 48 | + |
| 49 | + // ── Port forwarding ─────────────────────────────────────────────────────── |
| 50 | + // Automatically forward the conflux-devkit UI and all RPC ports so you can |
| 51 | + // access them from your browser when running inside Codespaces. |
| 52 | + "forwardPorts": [7748, 8545, 8546, 12537, 12535], |
| 53 | + "portsAttributes": { |
| 54 | + "7748": { "label": "conflux-devkit UI", "onAutoForward": "openBrowser" }, |
| 55 | + "8545": { "label": "EVM RPC (HTTP)", "onAutoForward": "silent" }, |
| 56 | + "8546": { "label": "EVM RPC (WebSocket)", "onAutoForward": "silent" }, |
| 57 | + "12537": { "label": "Conflux Core RPC (HTTP)", "onAutoForward": "silent" }, |
| 58 | + "12535": { "label": "Conflux Core RPC (WebSocket)", "onAutoForward": "silent" } |
| 59 | + }, |
| 60 | + |
| 61 | + // ── Lifecycle hooks ─────────────────────────────────────────────────────── |
| 62 | + "onCreateCommand": "corepack enable && corepack prepare pnpm@latest --activate", |
| 63 | + "postCreateCommand": "pnpm install", |
| 64 | + "postStartCommand": "pnpm build" |
| 65 | +} |
0 commit comments