diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 9b4f578..4b9b364 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -1,26 +1,27 @@ -// For format details, see https://aka.ms/devcontainer.json. For config options, see the -// README at: https://github.com/devcontainers/templates/tree/main/src/javascript-node { - "name": "Tutorials", - "image": "mcr.microsoft.com/devcontainers/javascript-node:20", - "features": { - "ghcr.io/devcontainers-contrib/features/jshint:2": {} - }, + "name": "Dash Platform Tutorials", + "image": "mcr.microsoft.com/devcontainers/javascript-node:20", + "remoteUser": "node", - // Use 'forwardPorts' to make a list of ports inside the container available locally. - // "forwardPorts": [], + "onCreateCommand": "cp -n .env.example .env", + "postCreateCommand": "npm ci", + "postAttachCommand": ".devcontainer/welcome.sh", - // Use 'postCreateCommand' to run commands after the container is created. - "postCreateCommand": "npm install", - - // Configure tool-specific properties. "customizations": { - // Configure properties specific to VS Code. "vscode": { - // Add the IDs of extensions you want installed when the container is created. "extensions": [ + "dbaeumer.vscode-eslint", + "esbenp.prettier-vscode", + "mikestead.dotenv", "streetsidesoftware.code-spell-checker" - ] + ], + "settings": { + "editor.defaultFormatter": "esbenp.prettier-vscode", + "editor.tabSize": 2, + "files.eol": "\n", + "files.trimTrailingWhitespace": true, + "files.insertFinalNewline": true + } } } } diff --git a/.devcontainer/welcome.sh b/.devcontainer/welcome.sh new file mode 100755 index 0000000..73a0838 --- /dev/null +++ b/.devcontainer/welcome.sh @@ -0,0 +1,2 @@ +#!/bin/sh +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' diff --git a/README.md b/README.md index b2a0595..5eda876 100644 --- a/README.md +++ b/README.md @@ -8,6 +8,20 @@ site](http://docs.dash.org/projects/platform/en/stable/docs/tutorials/introducti uses `@dashevo/evo-sdk`. For the legacy `js-dash-sdk` tutorials, see [v2.0.1](https://github.com/dashpay/platform-tutorials/releases/tag/v2.0.1). +## Quick Start with Dev Containers + +[![Open in GitHub +Codespaces](https://github.com/codespaces/badge.svg)](https://codespaces.new/dashpay/platform-tutorials) + +The included dev container provides a ready-to-use environment with Node.js, dependencies, and +editor tooling pre-configured. Open the repo in [GitHub +Codespaces](https://codespaces.new/dashpay/platform-tutorials) or locally with the [VS Code Dev +Containers extension](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-containers). + +On first launch the container installs dependencies and creates a starter `.env` file from +`.env.example`. Run `node create-wallet.mjs` to generate a mnemonic, then set `PLATFORM_MNEMONIC` +in your `.env` file to begin the tutorials. + ## Install Note: [NodeJS](https://nodejs.org/en/download/) (v20+) must be installed to run the tutorial code.