From 64981a9e6b553c0bf02229bf7446b776b76c72f9 Mon Sep 17 00:00:00 2001 From: tom Date: Thu, 10 Aug 2023 18:29:54 -0400 Subject: [PATCH] [skip ci] update contributing guide --- docs/CONTRIBUTING.md | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/docs/CONTRIBUTING.md b/docs/CONTRIBUTING.md index c8e3598963..4cdb479706 100644 --- a/docs/CONTRIBUTING.md +++ b/docs/CONTRIBUTING.md @@ -2,6 +2,8 @@ Thanks for showing interest to contribute to Blockscout. The following steps will get you up and running. +  + ## Project setup 1. Fork the repo by clicking Fork button at the top of the repo main page and name it appropriately @@ -23,6 +25,8 @@ Thanks for showing interest to contribute to Blockscout. The following steps wil yarn ``` +  + ## Toolkit We are using following technology stack in the project @@ -36,6 +40,8 @@ We are using following technology stack in the project And of course our premier language is [Typescript](https://www.typescriptlang.org/). +  + ## Local development 1. Prepare your environment variables: @@ -48,18 +54,27 @@ And of course our premier language is [Typescript](https://www.typescriptlang.or - if your options is "B", use `yarn dev:` command 3. In browser navigate to the URL from the command output (by default, it is `http://localhost:3000`) +  + ## Adding new dependencies For all types of dependencies: - **Do not add** a dependency if the desired functionality is easily implementable - If adding a dependency is necessary, please be sure that is is well-maintained and trustworthy +  + ## Adding new ENV variable *Note*, if the variable should be exposed to the browser don't forget to add prefix `NEXT_PUBLIC_` to its name. These are the steps that you have to follow to make everything work: 1. First and foremost, document variable in the [/docs/ENVS.md](./ENVS.md) file; provide short description, its expected type, requirement flag, default and example value; **do not skip this step** otherwise the app will not receive variable value at run-time -2. Make sure that you have added a property to React app config (`/configs/app/index.ts`) in appropriate section that is associated with this variable; do not use ENV variable values directly in the application code +2. Make sure that you have added a property to React app config (`/configs/app/index.ts`) in appropriate section that is associated with this variable; do not use ENV variable values directly in the application code; decide where this variable belongs to and place it under the certain section: + - `app` - the front-end app itself + - `api` - the main API configuration + - `UI` - the app UI customization + - `features` - the particular feature of the app + - `services` - some 3rd party service integration which is not related to one particular feature 3. For local development purposes add the variable with its appropriate values to pre-defined ENV configs `/configs/envs` where it is needed 4. Add the variable to CI configs where it is needed - `deploy/values/review/values.yaml.gotmpl` - review development environment @@ -68,6 +83,8 @@ These are the steps that you have to follow to make everything work: - `deploy/values/l2-optimism-goerli/values.yaml` - main development environment 5. Don't forget to mention in the PR notes that new ENV variable were added +  + ## Writing & Running Tests Every feature or bugfix should be accompanied by tests, either unit tests or component visual tests, or both, except from trivial fixes (for example, typo fix). All commands for running tests you can find [below](./CONTRIBUTING.md#command-list). @@ -93,6 +110,8 @@ We have 3 pre-configured projects. You can run your test with the desired projec *Note* that, since we are developing not on the same operating system as our CI system, we have to use Docker to generate or update the screenshots. In order to do that use `yarn test:pw:docker --update-snapshots` command. Please **do not commit** any screenshots generated via `yarn test:pw:local` command, their associated tests will fail in the CI run. +  + ## Making a Pull Request ### Steps to PR @@ -130,7 +149,9 @@ We have 3 pre-configured projects. You can run your test with the desired projec *Note*, if you Pull Request contains any changes that are not backwards compatible with the previous versions of the app, please specify them in PR description and add label ["breaking changes"](https://github.com/blockscout/frontend/labels/breaking%20changes) to it. -## Command list +  + +## Commands list | Command | Description | | --- | --- | @@ -152,6 +173,8 @@ We have 3 pre-configured projects. You can run your test with the desired projec | `yarn test:pw:docker` | run Playwright component tests in docker container | | `yarn test:pw:ci` | run Playwright component tests in CI | +  + ## Tips & Tricks ### Code Editor