chore: add devcontainer support (#16677)

This commit is contained in:
Tobias Fenster 2024-10-18 14:44:39 +02:00 • committed by GitHub
parent b313e3c511
commit 04721ef4c5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 33 additions and 0 deletions

View file

@ -0,0 +1,30 @@
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
// README at: https://github.com/devcontainers/templates/tree/main/src/go
{
"name": "evcc",
"image": "mcr.microsoft.com/devcontainers/go:1-1.23-bookworm",
"features": {
"ghcr.io/devcontainers/features/docker-outside-of-docker:1": {
"moby": true,
"installDockerBuildx": true,
"version": "latest",
"dockerDashComposeVersion": "v2"
},
"ghcr.io/devcontainers/features/node:1": {
"nodeGypDependencies": true,
"installYarnUsingApt": true,
"version": "latest",
"pnpmVersion": "latest",
"nvmVersion": "latest"
}
},
"postCreateCommand": "make install-ui && make install",
"customizations": {
"vscode": {
"extensions": [
"esbenp.prettier-vscode",
"octref.vetur"
]
}
}
}

1
.gitignore vendored
View file

@ -6,6 +6,7 @@ __debug_bin*
*.py
*.log
*.json
!.devcontainer/devcontainer.json
*.yaml
!templates/**/*.yaml
!templates/**/*-schema.json

View file

@ -6,6 +6,8 @@
Developing evcc requires [Go][1] 1.23 and [Node][2] 22. We recommend VSCode with the [Go](https://marketplace.visualstudio.com/items?itemName=golang.Go), [Prettier](https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode) and [Vetur](https://marketplace.visualstudio.com/items?itemName=octref.vetur) extensions.
Alternatively, if you use VS Code and [devcontainers](https://code.visualstudio.com/docs/devcontainers/containers), you can use the "Dev containers: Clone repository in container volume" action. This will create a devcontainer with the required toolchain and install the prerequisites as explained below. Wait until the startup log says "Done. Press any key to close the terminal." and check for any errors.
We use linters (golangci-lint, Prettier) to keep a coherent source code formatting. It's recommended to use the format-on-save feature of your editor. You can manually reformat your code by running:
```sh