feat(cli): Generate an empty lockfile when there are no dependencies #5843
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
this reverts most of #3395 992b5c9 which appears only necessary to work around #3329 (requesting the yarn version with -v triggered install). As noted in #5839,
yarn -v
andyarn check
no longer haveinstall
as a side effect and IMO, the original behavior where an empty lock file is generated as part of install is the correct behavior.Many tools currently sniff for a yarn.lock file to determine if yarn is being used. It seems more consistent with
yarn import
which generates a lockfile even if the existing node_modules is empty.fixes #5839
Test plan
yarn run test
passesyarn run lint
passesyarn-local install
saves an empty lockfileyarn-local import
continues to save an empty lockfileyarn-local -v
will not trigger install and will not generate a lock file. correctly displays a version.yarn-local check
will not trigger install and will not generate a lock file