diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 00000000000..9c2c295f023 --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,36 @@ +// For format details, see https://aka.ms/devcontainer.json. For config options, see the +// README at: https://github.com/devcontainers/templates/tree/main/src/ubuntu +{ + "name": "Ubuntu", + // Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile + "image": "mcr.microsoft.com/devcontainers/base:jammy", + "features": { + "ghcr.io/devcontainers/features/go:1": { + "version": "latest" + }, + "ghcr.io/devcontainers/features/hugo:1": { + "extended": true, + "version": "latest" + }, + "ghcr.io/devcontainers/features/node:1": { + "nodeGypDependencies": true, + "version": "lts", + "nvmVersion": "latest" + } + }, + "customizations": { + "vscode": { + "extensions": [ + "streetsidesoftware.code-spell-checker", + "tamasfe.even-better-toml", + "davidanson.vscode-markdownlint", + "budparr.language-hugo-vscode" + ], + "settings": { + "git.alwaysSignOff": true + } + } + }, + "forwardPorts": [1313], + "postAttachCommand": "bash scripts/init-container.sh" +} diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 00000000000..5dc46e6b38b --- /dev/null +++ b/.gitattributes @@ -0,0 +1,3 @@ +* text=auto eol=lf +*.{cmd,[cC][mM][dD]} text eol=crlf +*.{bat,[bB][aA][tT]} text eol=crlf \ No newline at end of file diff --git a/README.md b/README.md index a189c74f09e..98bc0a4c4ff 100644 --- a/README.md +++ b/README.md @@ -29,21 +29,44 @@ The Dapr docs are built using [Hugo](https://gohugo.io/) with the [Docsy](https: The [daprdocs](./daprdocs) directory contains the hugo project, markdown files, and theme configurations. -## Pre-requisites +## Setup with a devcontainer -- [Hugo extended version](https://gohugo.io/getting-started/installing) -- [Node.js](https://nodejs.org/en/) +This repository comes with a [devcontainer](/.devcontainer/devcontainer.json) configuration that automatically installs all the required dependencies and VSCode extensions to build and run the docs. + +This devcontainer can be used to develop locally with VSCode or via GitHub Codespaces completely in the browser. Other IDEs that support [devcontainers](https://containers.dev/) can be used but won't have the extensions preconfigured and will likely have different performance characteristics. + +### Pre-requisites -## Environment setup +- [Docker Desktop](https://www.docker.com/products/docker-desktop) +- [VSCode](https://code.visualstudio.com/download) -1. Ensure pre-requisites are installed -2. Clone this repository +### Environment setup + +1. [Fork](https://github.com/dapr/docs/fork) and clone this repository. + +1. Open the forked repository in VS Code ```sh -git clone https://github.com/dapr/docs.git +code . ``` -3. Change to daprdocs directory: +1. When prompted, click "Reopen in Container" to open the repository in the devcontainer. + +Continue with the [Run local server](#run-local-server) steps. + +## Setup without a devcontainer + +### Pre-requisites + +- [Hugo extended version](https://gohugo.io/getting-started/installing) +- [Node.js](https://nodejs.org/en/) + +### Environment setup + +1. Ensure pre-requisites are installed. +1. [Fork](https://github.com/dapr/docs/fork) and clone this repository. + +1. Change to daprdocs directory: ```sh cd ./daprdocs @@ -63,7 +86,7 @@ npm install ## Run local server -1. Make sure you're still in the `daprdocs` directory +1. Make sure you're in the `daprdocs` directory 2. Run ```sh @@ -72,14 +95,13 @@ hugo server 3. Navigate to `http://localhost:1313/` - ## Update docs -1. Fork repo into your account -1. Create new branch -1. Commit and push changes to forked branch -1. Submit pull request from downstream branch to the upstream branch for the correct version you are targeting -1. Staging site will automatically get created and linked to PR to review and test +1. Ensure you are in your forked repo +2. Create new branch +3. Commit and push changes to forked branch +4. Submit pull request from downstream branch to the upstream branch for the correct version you are targeting +5. Staging site will automatically get created and linked to PR to review and test ## Code of Conduct diff --git a/scripts/init-container.sh b/scripts/init-container.sh new file mode 100644 index 00000000000..61f6a8dccc3 --- /dev/null +++ b/scripts/init-container.sh @@ -0,0 +1,4 @@ +git config --global --add safe.directory '*' +cd ./daprdocs +git submodule update --init --recursive +npm install