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

yarn install should generate an empty yarn lock even if there are no dependencies #5839

Closed
jimmyhchan opened this issue May 17, 2018 · 1 comment · Fixed by #5843
Closed

Comments

@jimmyhchan
Copy link
Contributor

Do you want to request a feature or report a bug?

bug
What is the current behavior?
For a project with no dependencies, running yarn aka yarn install will not create a yarn.lock. Instead the message info Lockfile not saved, no dependencies. will be given.

If the current behavior is a bug, please provide the steps to reproduce.

yarn init
yarn
# info Lockfile not saved, no dependencies.

ls yarn.lock
# ls: yarn.lock: No such file or directory

What is the expected behavior?
For a package.json with no dependencies an "empty" yarn.lock should be generated if:

  • yarn (it does not -- this bug)
  • yarn install (it does not -- this bug)
  • yarn import (it does already!)

NO yarn.lock and no errors if:

Please mention your node.js, yarn and operating system version.
node 6.9.1
yarn 1.6.0
Mac OS 10.13.4

Extra Info

@ghost ghost assigned rally25rs May 17, 2018
@ghost ghost added the triaged label May 18, 2018
jimmyhchan added a commit to jimmyhchan/yarn that referenced this issue May 21, 2018
…encies

this reverts most of yarnpkg#3395 992b5c9
which appears only necessary to work around yarnpkg#3329 (requesting the yarn
version with -v triggered install)
@rally25rs
Copy link
Contributor

Since there is actually a message "Lockfile not saved, no dependencies." this seems like it was the intended behavior by whoever wrote it, but I agree that an empty lockfile seems like a good idea. I'll flag this as a feature request.

@BYK BYK closed this as completed in #5843 May 23, 2018
BYK pushed a commit that referenced this issue May 23, 2018
…5843)

**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` and `yarn check` no longer have `install` 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` passes
`yarn run lint` passes
`yarn-local install`  saves an empty lockfile
`yarn-local import`  continues to save an empty lockfile
`yarn-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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants