Skip to content

Commit 5b85735

Browse files
thephezclaude
andauthored
chore: update devcontainer config (#62)
* chore: modernize devcontainer config for better DX Replace unused JSHint feature with ESLint/Prettier/DotENV extensions, switch to npm ci, auto-create .env from template, add VS Code settings, run as non-root user, and display onboarding steps on container start. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * docs: update readme with dev container section * fix: use postattachcommand so message is shown to user on startup * chore: move welcome message to script with docs link Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 1996f90 commit 5b85735

3 files changed

Lines changed: 33 additions & 16 deletions

File tree

.devcontainer/devcontainer.json

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,27 @@
1-
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
2-
// README at: https://github.com/devcontainers/templates/tree/main/src/javascript-node
31
{
4-
"name": "Tutorials",
5-
"image": "mcr.microsoft.com/devcontainers/javascript-node:20",
6-
"features": {
7-
"ghcr.io/devcontainers-contrib/features/jshint:2": {}
8-
},
2+
"name": "Dash Platform Tutorials",
3+
"image": "mcr.microsoft.com/devcontainers/javascript-node:20",
4+
"remoteUser": "node",
95

10-
// Use 'forwardPorts' to make a list of ports inside the container available locally.
11-
// "forwardPorts": [],
6+
"onCreateCommand": "cp -n .env.example .env",
7+
"postCreateCommand": "npm ci",
8+
"postAttachCommand": ".devcontainer/welcome.sh",
129

13-
// Use 'postCreateCommand' to run commands after the container is created.
14-
"postCreateCommand": "npm install",
15-
16-
// Configure tool-specific properties.
1710
"customizations": {
18-
// Configure properties specific to VS Code.
1911
"vscode": {
20-
// Add the IDs of extensions you want installed when the container is created.
2112
"extensions": [
13+
"dbaeumer.vscode-eslint",
14+
"esbenp.prettier-vscode",
15+
"mikestead.dotenv",
2216
"streetsidesoftware.code-spell-checker"
23-
]
17+
],
18+
"settings": {
19+
"editor.defaultFormatter": "esbenp.prettier-vscode",
20+
"editor.tabSize": 2,
21+
"files.eol": "\n",
22+
"files.trimTrailingWhitespace": true,
23+
"files.insertFinalNewline": true
24+
}
2425
}
2526
}
2627
}

.devcontainer/welcome.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
#!/bin/sh
2+
printf '\n=== Dash Platform Tutorials ===\n\nNext steps:\n 1. Verify connection: node connect.mjs\n 2. Create a wallet: node create-wallet.mjs\n 3. Edit .env with your mnemonic (PLATFORM_MNEMONIC)\n 4. Start tutorials in 1-Identities-and-Names/\n\nDocs: https://docs.dash.org/projects/platform/en/stable/docs/tutorials/introduction.html\n\n'

README.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,20 @@ site](http://docs.dash.org/projects/platform/en/stable/docs/tutorials/introducti
88
uses `@dashevo/evo-sdk`. For the legacy `js-dash-sdk` tutorials, see
99
[v2.0.1](https://github.com/dashpay/platform-tutorials/releases/tag/v2.0.1).
1010

11+
## Quick Start with Dev Containers
12+
13+
[![Open in GitHub
14+
Codespaces](https://github.com/codespaces/badge.svg)](https://codespaces.new/dashpay/platform-tutorials)
15+
16+
The included dev container provides a ready-to-use environment with Node.js, dependencies, and
17+
editor tooling pre-configured. Open the repo in [GitHub
18+
Codespaces](https://codespaces.new/dashpay/platform-tutorials) or locally with the [VS Code Dev
19+
Containers extension](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-containers).
20+
21+
On first launch the container installs dependencies and creates a starter `.env` file from
22+
`.env.example`. Run `node create-wallet.mjs` to generate a mnemonic, then set `PLATFORM_MNEMONIC`
23+
in your `.env` file to begin the tutorials.
24+
1125
## Install
1226

1327
Note: [NodeJS](https://nodejs.org/en/download/) (v20+) must be installed to run the tutorial code.

0 commit comments

Comments
 (0)