Skip to content

Commit

Permalink
improve: Add external config
Browse files Browse the repository at this point in the history
Signed-off-by: Evaldo Felipe <[email protected]>
  • Loading branch information
evaldofelipe committed Jan 8, 2025
1 parent 842988f commit a68d5e7
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,9 @@
"scripts": {
"start": "export REACT_APP_GIT_COMMIT_HASH=$(git rev-parse HEAD) && vite",
"dev": "export REACT_APP_GIT_COMMIT_HASH=$(git rev-parse HEAD) && vite --port $PORT --host",
"build": "yarn prebuild && export REACT_APP_GIT_COMMIT_HASH=$(git rev-parse HEAD) && tsc && vite build",
"build": "yarn prebuild-env && yarn prebuild && export REACT_APP_GIT_COMMIT_HASH=$(git rev-parse HEAD) && tsc && vite build",
"prebuild": "tsx scripts/pre-build.ts",
"prebuild-env": "./scripts/pre-build-env.sh && source output.env",
"analyze": "yarn build && rollup-plugin-visualizer --open ./bundle-size-analysis.json",
"test": "export REACT_APP_GIT_COMMIT_HASH=$(git rev-parse HEAD) && jest --env jsdom src",
"serve": "vite preview --port 3000",
Expand Down
18 changes: 18 additions & 0 deletions scripts/pre-build-env.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/bin/bash

set -o errexit
set -o nounset

FILE_REMOTE="projects/across/frontend/outputs/output.env"
FILE_PATH="output.env"
GH_REPO="UMAprotocol/git-env"

if [ -n "${GH_TOKEN}" ]; then
echo "Getting env files from config repo..."
curl -o ${FILE_PATH} "https://${GH_TOKEN}@${GH_REPO}/${FILE_REMOTE}"
echo "Updated data at ${FILE_PATH}"
echo $GIT_ENV_EXPORTED
echo "Done!"
else
echo "No env exported"
fi

0 comments on commit a68d5e7

Please sign in to comment.