Commit 3d419e0c authored by tom's avatar tom

[skip ci] Refactor local development setup and scripts

parent 2704bfa6
...@@ -44,15 +44,21 @@ And of course our premier language is [Typescript](https://www.typescriptlang.or ...@@ -44,15 +44,21 @@ And of course our premier language is [Typescript](https://www.typescriptlang.or
## Local development ## Local development
1. Prepare your environment variables: To develop locally, follow one of the two paths outlined below:
- clone `.env.example` into `configs/envs/.env.secrets` and fill it with necessary secrets for the [external services](./ENVS.md#external-services-configuration) integration; you can pick up only those that your needed
- choose one of the following options: A. Custom configuration:
A. create `.env.local` file in the root folder with environment variables from the [list](./ENVS.md); all required variables should be present in the file;
B. pick up one of the predefined configurations located at `/configs/envs` folder; no actual action is needed at this stage; 1. Create `.env.local` file in the root folder and include all required environment variables from the [list](./ENVS.md)
2. Run your local dev server: 2. Optionally, clone `.env.example` and name it `.env.secrets`. Fill it with necessary secrets for integrating with [external services](./ENVS.md#external-services-configuration). Include only secrets your need.
- if you picked up option "A" above, use `yarn dev` command 3. Use `yarn dev` command to start the dev server.
- if your options is "B", use `yarn dev:<config_name>` command 4. Open your browser and navigate to the URL provided in the command line output (by default, it is `http://localhost:3000`).
3. In browser navigate to the URL from the command output (by default, it is `http://localhost:3000`)
B. Pre-defined configuration:
1. Optionally, clone `.env.example` file into `configs/envs/.env.secrets`. Fill it with necessary secrets for integrating with [external services](./ENVS.md#external-services-configuration). Include only secrets your need.
2. Choose one of the predefined configurations located in the `/configs/envs` folder.
3. Start your local dev server using the `yarn dev:<config_name>` command.
4. Open your browser and navigate to the URL provided in the command line output (by default, it is `http://localhost:3000`).
&nbsp; &nbsp;
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
"npm": "8" "npm": "8"
}, },
"scripts": { "scripts": {
"dev": "next dev", "dev": "./tools/scripts/dev.sh",
"dev:preset": "./tools/scripts/dev.preset.sh", "dev:preset": "./tools/scripts/dev.preset.sh",
"build": "next build", "build": "next build",
"build:docker": "docker build --build-arg GIT_COMMIT_SHA=$(git rev-parse --short HEAD) --build-arg GIT_TAG=$(git describe --tags --abbrev=0) -t blockscout-frontend:local ./", "build:docker": "docker build --build-arg GIT_COMMIT_SHA=$(git rev-parse --short HEAD) --build-arg GIT_TAG=$(git describe --tags --abbrev=0) -t blockscout-frontend:local ./",
......
...@@ -14,11 +14,6 @@ if [ ! -f "$config_file" ]; then ...@@ -14,11 +14,6 @@ if [ ! -f "$config_file" ]; then
exit 1 exit 1
fi fi
if [ ! -f "$secrets_file" ]; then
echo "Error: File '$secrets_file' not found."
exit 1
fi
# download assets for the running instance # download assets for the running instance
dotenv \ dotenv \
-e $config_file \ -e $config_file \
......
#!/bin/bash
# download assets for the running instance
dotenv \
-e .env.development.local \
-e .env.local \
-e .env.development \
-e .env \
-- bash -c './deploy/scripts/download_assets.sh ./public/assets'
# generate envs.js file and run the app
dotenv \
-v NEXT_PUBLIC_GIT_COMMIT_SHA=$(git rev-parse --short HEAD) \
-v NEXT_PUBLIC_GIT_TAG=$(git describe --tags --abbrev=0) \
-e .env.secrets \
-e .env.development.local \
-e .env.local \
-e .env.development \
-e .env \
-- bash -c './deploy/scripts/make_envs_script.sh && next dev -- -p $NEXT_PUBLIC_APP_PORT' |
pino-pretty
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment