From b3435035af50990677ad7f5105245acaaf141388 Mon Sep 17 00:00:00 2001 From: andig Date: Tue, 7 May 2024 11:19:55 +0200 Subject: [PATCH] chore: minor --- CONTRIBUTING.md | 99 +++++++++++++++++++++---------------------------- README.md | 2 + 2 files changed, 45 insertions(+), 56 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index f845ac547..42e770921 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,17 +1,55 @@ ## Contributing -To build evcc from source, [Go][1] 1.22 and [Node][2] 18 are required. +### Developing -Build and run go backend. The UI becomes available at http://127.0.0.1:7070/ +#### Development environment + +Developing evcc requires [Go][1] 1.22 and [Node][2] 18. 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. + +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 +make lint +make lint-ui +``` + +#### Changing device templates + +evcc supports a massive amount of different devices. To keep our documentation and website in sync with the latest software the core project (this repo) generates meta-data that's pushed to the `docs` and `evcc.io` repository. Make sure to update this meta-data every time you make changes to a templates. + +```sh +make docs +``` + +If you miss one of the above steps Gitub Actions will likely trigger a **Porcelain** error. + +### Building from source + +To build and run the evcc go backend use: ```sh make install-ui -make ui make install make ./evcc ``` +The UI becomes available at http://127.0.0.1:7070/ + +#### Cross Compiling + +To compile a version for an ARM device like a Raspberry Pi set GO command variables as needed, eg: + +```sh +GOOS=linux GOARCH=arm GOARM=6 make +``` + +#### Publishing docker images + +```sh +make docker DOCKER_IMAGE=my/docker DOCKER_TAG=0815 +``` + ### Debugging in VS Code #### evcc Core @@ -31,29 +69,6 @@ You can adjust the referred configuration as needed to e.g. use your live config }, ``` -#### Decorators - -Here's another `launch.json` configuration that can be used for specifically debugging the decorator. - -```json -{ - "name": "Debug decorator", - "type": "go", - "request": "launch", - "mode": "debug", - "program": "${workspaceFolder}/cmd/tools/decorate.go", - "args": ["-o", "decorator_test.go", "-p", "main", "-f", "decorateVehicle", "-b", "api.Vehicle", "-t", "api.VehicleChargeController,StartCharge,func() error", "-t", "api.VehicleChargeController,StopCharge,func() error"], -}, -``` - -### Cross Compile - -To compile a version for an ARM device like a Raspberry Pi set GO command variables as needed, eg: - -```sh -GOOS=linux GOARCH=arm GOARM=6 make -``` - ### UI development For frontend development start the Vue toolchain in dev-mode. Open http://127.0.0.1:7071/ to get to the livelreloading development server. It pulls its data from port 7070 (see above). @@ -63,7 +78,7 @@ npm install npm run dev ``` -### Integration tests +#### Integration testing We use Playwright for end-to-end integration tests. They start a local evcc instance with different configuration yamls and prefilled databases. To run them, you have to do a local build first. @@ -87,39 +102,11 @@ make ui build ./evcc --config tests/simulator.evcc.yaml ``` -### Code formatting - -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. For VSCode use 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) extension. You can manually reformat your code by running: - -```sh -make lint -make lint-ui -``` - -### Publishing docker images - -```sh -make docker DOCKER_IMAGE=my/docker DOCKER_TAG=0815 -``` - -### Changing templates - -evcc supports a massive amount of different devices. To keep our documentation and website in sync with the latest software the core project (this repo) generates meta-data that's pushed to the `docs` and `evcc.io` repository. Make sure to update this meta-data every time you make changes to a templates. - -```sh -make docs -``` - -If you miss one of the above steps Gitub Actions will likely trigger a **Porcelain** error. - ### Adding or modifying translations -evcc already includes many translations for the UI. Weblate Hosted is used to maintain all languages. Feel free to add more languages or verify and edit existing translations. Weblate will automatically push all modifications on a regular base to the evcc repository. +evcc already includes many translations for the UI. We're using [Weblate](https://hosted.weblate.org/projects/evcc/evcc/) to maintain translations. Feel free to add more languages or verify and edit existing translations. Weblate will automatically push all modifications to the evcc repository where they get reviewed and merged. -[![Weblate Hosted](https://hosted.weblate.org/widgets/evcc/-/evcc/287x66-grey.png)](https://hosted.weblate.org/engage/evcc/) [![Languages](https://hosted.weblate.org/widgets/evcc/-/evcc/multi-auto.svg)](https://hosted.weblate.org/engage/evcc/) -https://hosted.weblate.org/projects/evcc/evcc/ - [1]: https://go.dev [2]: https://nodejs.org/ diff --git a/README.md b/README.md index ad03f8463..3150a206b 100644 --- a/README.md +++ b/README.md @@ -44,6 +44,8 @@ You'll find everything you need in our [documentation](https://docs.evcc.io/). Technical details on how to contribute, how to add translations and how to build evcc from source can be found [here](CONTRIBUTING.md). +[![Weblate Hosted](https://hosted.weblate.org/widgets/evcc/-/evcc/287x66-grey.png)](https://hosted.weblate.org/engage/evcc/) + ## Sponsorship