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

enhance(build/spas): allow yarn dev without internet if DEV_MODE is enabled #10533

Merged
merged 4 commits into from
Mar 1, 2024

Conversation

caugner
Copy link
Contributor

@caugner caugner commented Feb 16, 2024

Summary

(MP-899)

Problem

When working on a train or a plane without internet, you cannot run yarn dev, because it fails when building the SPA.

Solution

Convert the errors to warnings if DEV_MODE is enabled (via setting REACT_APP_DEV_MODE=true in the .env).

Note: Technically, yarn tool popularities is also affected, but the command defaults to not downloading the popularities again if they already exist (unless --refresh is provided), so this PR doesn't cover that case (just don't delete your popularities.json when you're on a plane 🙂).


Screenshots

Before

% yarn tool spas
yarn run v1.22.21
$ NODE_OPTIONS='--no-warnings=ExperimentalWarning --loader ts-node/esm' node ./tool/cli.ts spas

error: getaddrinfo ENOTFOUND api.github.com

error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

After

% yarn tool spas
yarn run v1.22.21
$ NODE_OPTIONS='--no-warnings=ExperimentalWarning --loader ts-node/esm' node ./tool/cli.ts spas
Warning: Couldn't fetch recent GitHub contributions for repo mdn/translated-content!
Warning: Couldn't fetch recent GitHub contributions for repo mdn/content!
Warning: Couldn't fetch hacks.mozilla.org feed!
Built 146 SPA related files
✨  Done in 17.81s.

How did you test this change?

Ran yarn tool spas with wifi disabled (see above).

@caugner caugner requested a review from a team as a code owner February 16, 2024 09:30
Copy link
Contributor

@argl argl left a comment

Choose a reason for hiding this comment

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

Looks good to me

@caugner caugner merged commit 78a9500 into main Mar 1, 2024
12 checks passed
@caugner caugner deleted the allow-yarn-dev-with-dev-mode-without-internet branch March 1, 2024 08:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants