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(config): Adds support for --offline flag to global add command #7330

Merged
merged 3 commits into from Jun 13, 2019

Conversation

fcrick
Copy link
Contributor

@fcrick fcrick commented Jun 9, 2019

Summary

Adds support for --offline flag to global add command.

Previously, this argument was ignored, resulting in issue #4913.

Test plan

Observe below how yarn currently goes to network when --offline is set with global add:

$ yarn --offline global add packagethatdoesnotexist@1.0.0
yarn global v1.16.0
[1/4] Resolving packages...
error An unexpected error occurred: "https://registry.yarnpkg.com/packagethatdoesnotexist: Not found".
info If you think this is a bug, please open a bug report with the information provided in "C:\\Users\\fcrick\\AppData\\Local\\Yarn\\Data\\global\\yarn-error.log".
info Visit https://yarnpkg.com/en/docs/cli/global for documentation about this command.

With fix, it now suggests running without --offline

$ node ./bin/yarn.js --offline global add packagethatdoesnotexist@1.0.0
yarn global v1.17.0-0
[1/4] Resolving packages...
error Couldn't find any versions for "packagethatdoesnotexist" that matches "1.0.0" in our cache (possible versions are ""). This is usually caused by a missing entry in the lockfile, running Yarn without the --offline flag may help fix this issue.
info Visit https://yarnpkg.com/en/docs/cli/global for documentation about this command.

Added test to verify this behavior.

@fcrick fcrick marked this pull request as ready for review June 9, 2019 20:24
@arcanis arcanis merged commit 6b7ee8c into yarnpkg:master Jun 13, 2019
@arcanis
Copy link
Member

arcanis commented Jun 13, 2019

Thanks 👍

VincentBailly pushed a commit to VincentBailly/yarn that referenced this pull request Jun 10, 2020
…arnpkg#7330)

* fix(config): Adds support for --offline flag to global add command

* Update CHANGELOG.md

* lower line lengths below 120
VincentBailly pushed a commit to VincentBailly/yarn that referenced this pull request Jun 10, 2020
…arnpkg#7330)

* fix(config): Adds support for --offline flag to global add command

* Update CHANGELOG.md

* lower line lengths below 120
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.

None yet

2 participants