Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Isolate logic to expose js env variables sooner #8202

Merged
merged 3 commits into from
Jan 22, 2024
Merged

Conversation

tommasini
Copy link
Contributor

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...

Screenshots/Recordings

Before

After

Pre-merge author checklist

  • I’ve followed MetaMask Coding Standards.
  • 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 format if applicable
  • I’ve applied the right labels on the PR (see labeling guidelines). 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.

@tommasini tommasini requested a review from a team as a code owner January 3, 2024 21:34
Copy link
Contributor

github-actions bot commented Jan 3, 2024

CLA Signature Action: All authors have signed the CLA. You may need to manually re-run the blocking PR check if it doesn't pass in a few minutes.

@tommasini tommasini added team-mobile-client needs-dev-review PR needs reviews from other engineers (in order to receive required approvals) labels Jan 3, 2024
@owencraston
Copy link
Contributor

This is a good solution but I am wondering if we should have better defaults for these env variables? I know that for METAMASK_BUILD_TYPE we can default to main and METAMASK_ENVIRONMENT should probably be local? Then in the build.sh we can simply just have check if these values exist and if not use these defaults?

scripts/build.sh Outdated Show resolved Hide resolved
@tommasini tommasini changed the title fix: advanced the prebuild that would source the js env fix: Isolate logic to fetch js env variables Jan 22, 2024
@tommasini tommasini changed the title fix: Isolate logic to fetch js env variables fix: Isolate logic to expose js env variables sooner Jan 22, 2024
@codecov-commenter
Copy link

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (487f25d) 40.30% compared to head (532ba68) 40.30%.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #8202   +/-   ##
=======================================
  Coverage   40.30%   40.30%           
=======================================
  Files        1235     1235           
  Lines       29928    29928           
  Branches     2872     2872           
=======================================
  Hits        12062    12062           
  Misses      17173    17173           
  Partials      693      693           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link

sonarcloud bot commented Jan 22, 2024

Quality Gate Passed Quality Gate passed

Kudos, no new issues were introduced!

0 New issues
0 Security Hotspots
No data about Coverage
No data about Duplication

See analysis details on SonarCloud

Copy link
Contributor

@sethkfman sethkfman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@tommasini tommasini merged commit 7e66fb0 into main Jan 22, 2024
30 checks passed
@tommasini tommasini deleted the fix/source-env-js branch January 22, 2024 23:04
@github-actions github-actions bot removed the needs-dev-review PR needs reviews from other engineers (in order to receive required approvals) label Jan 22, 2024
@github-actions github-actions bot locked and limited conversation to collaborators Jan 22, 2024
@metamaskbot metamaskbot added the release-7.16.0 Issue or pull request that will be included in release 7.16.0 label Jan 22, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
release-7.16.0 Issue or pull request that will be included in release 7.16.0 team-mobile-platform
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants