Skip to content

Commit

Permalink
fix: Isolate logic to expose js env variables sooner (#8202)
Browse files Browse the repository at this point in the history
## **Description**
When creating a new terminal and trying to run any of the building
commands like `yarn setup` `yarn watch` `yarn start:android` and `yarn
start:ios`

It would give an error that the environment variables are not loaded

The problem was that we were checking if the variables were loaded
before they were actually loaded.

The solution is to load the variables as one of the first steps if they
exist.

## **Related issues**

Fixes:

## **Manual testing steps**

1. Go to this page...
2.
3.

## **Screenshots/Recordings**

<!-- If applicable, add screenshots and/or recordings to visualize the
before and after of your change. -->

### **Before**

<!-- [screenshots/recordings] -->

### **After**

<!-- [screenshots/recordings] -->

## **Pre-merge author checklist**

- [ ] I’ve followed [MetaMask Coding
Standards](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/CODING_GUIDELINES.md).
- [ ] I've clearly explained what problem this PR is solving and how it
is solved.
- [ ] I've linked related issues
- [ ] I've included manual testing steps
- [ ] I've included screenshots/recordings if applicable
- [ ] I’ve included tests if applicable
- [ ] I’ve documented my code using [JSDoc](https://jsdoc.app/) format
if applicable
- [ ] I’ve applied the right labels on the PR (see [labeling
guidelines](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/LABELING_GUIDELINES.md)).
Not required for external contributors.
- [ ] I’ve properly set the pull request status:
  - [ ] In case it's not yet "ready for review", I've set it to "draft".
- [ ] In case it's "ready for review", I've changed it from "draft" to
"non-draft".

## **Pre-merge reviewer checklist**

- [ ] I've manually tested the PR (e.g. pull and build branch, run the
app, test code being changed).
- [ ] I confirm that this PR addresses all acceptance criteria described
in the ticket it closes and includes the necessary testing evidence such
as recordings and or screenshots.
  • Loading branch information
tommasini authored Jan 22, 2024
1 parent cc71f31 commit 7e66fb0
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions scripts/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -132,19 +132,21 @@ remapFlaskEnvVariables() {
remapEnvVariable "MM_FLASK_MIXPANEL_TOKEN" "MM_MIXPANEL_TOKEN"
}



prebuild(){
# Import provider
yarn --ignore-engines build:static-logos

loadJSEnv(){
# Load JS specific env variables
if [ "$PRE_RELEASE" = false ] ; then
if [ -e $JS_ENV_FILE ]
then
source $JS_ENV_FILE
fi
fi
}


prebuild(){
# Import provider
yarn --ignore-engines build:static-logos

WATCHER_PORT=${WATCHER_PORT:-8081}
}

Expand Down Expand Up @@ -541,7 +543,9 @@ checkAuthToken() {

checkParameters "$@"


printTitle
loadJSEnv
if [ "$MODE" == "releaseE2E" ] || [ "$MODE" == "QA" ] || [ "$MODE" == "QAE2E" ]; then
echo "DEBUG SENTRY PROPS"
checkAuthToken 'sentry.debug.properties'
Expand Down

0 comments on commit 7e66fb0

Please sign in to comment.