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 lockfile #484

Merged
merged 1 commit into from
Aug 21, 2017
Merged

yarn lockfile #484

merged 1 commit into from
Aug 21, 2017

Conversation

jordaaash
Copy link
Contributor

Yarn is a package manager that I imagine you're already familiar with. It provides fast, deterministic dependency installation.

This commit is just a lockfile for the current dependencies of the SDK, obtained by running yarn install.

Having this allows anyone to build and use the library, resolve the correct dependencies, and benefit from yarn's package cache. It doesn't affect anyone who doesn't use yarn.

@coveralls
Copy link

coveralls commented Aug 21, 2017

Coverage Status

Coverage remained the same at 94.408% when pulling 2795f50 on jordansexton:yarn into c6c9313 on Vincit:master.

@koskimas
Copy link
Collaborator

Isn't it better to just add yarn.lock to gitignore? Why does it need to be added to the repository?

@fl0w
Copy link
Contributor

fl0w commented Aug 21, 2017

This is a bad idea IMO. This would require a new objection release for any dependency bump.

Better to let semver work its magic.

edit Huh, TIL!

@koskimas
Copy link
Collaborator

koskimas commented Aug 21, 2017

@fl0w Lock files of dependencies are ignored. This would only affect people who develop objection.

@jordaaash
Copy link
Contributor Author

As far as I understand, the yarn lockfile needs to be checked in. This is just for building the library itself. This isn't a concern for application developers that don't build from the source; if they use yarn, they will generate their own lockfile, which they'll use in deployment.

However, if you're building the library from source, you aren't guaranteed to resolve the same dependencies as anyone else building the library from source.

@koskimas
Copy link
Collaborator

koskimas commented Aug 21, 2017

@jordansexton Maybe there is something I'm not getting. I'll read this article that seems to suggest that lock files should be committed even for libraries.

The thing that confuses me is this:
If the lock file is committed, everyone that builds objection gets the same dependencies. But what's the use of that? When people actually use objection they will get different dependencies (determined by their project's lock file). So I would think the lock file only causes bugs to be found in production instead of during development.

If there is a broken dependency, wouldn't the correct way to deal with it be to change package.json so that the library works again for everyone?

@koskimas
Copy link
Collaborator

The lock file would be a good idea for devDependencies, but not for real dependencies.

@jordaaash
Copy link
Contributor Author

That article you linked has a good analysis of it, but the closing section of it suggests that developers building the library will only find issues users would find upon installing by reinstalling their dependencies anyway. This can always be done with yarn --force.

Additionally, if you are installing dependencies that have changed (let's say in the package.json, "some-dependency" is set to "^0.1.1" and the author has published 0.1.2), it's my understanding that yarn install will regenerate an updated lockfile.

This allows the change to be detected (where before it would have gone unnoticed) and the updated lockfile committed. You can use yarn --pure-lockfile (not the default) to only install dependencies from the lockfile. In practice, this actually makes breaking dependency changes easier to discover.

@jordaaash
Copy link
Contributor Author

yarnpkg/yarn#570 (comment) has a more detailed explanation of the expected behavior of yarn when cloning the repo and setting up (TLDR section at the bottom).

@koskimas
Copy link
Collaborator

I can merge this, but who is going to keep this file up to date? I won't since I don't use yarn.

@jordaaash
Copy link
Contributor Author

I'm happy to, but I would probably also get Greenkeeper.io set up to keep it up to date (and warn if any dependency updates break the tests) because I'm lazy 😜

@koskimas
Copy link
Collaborator

Greenkeeper can do that? I'll try to configure it. For some reason it has stopped updating the deps alltogether for objection. I'll need to look into it anyways.

@koskimas koskimas merged commit 42d5197 into Vincit:master Aug 21, 2017
@jordaaash
Copy link
Contributor Author

Yep!

For each update to any of your dependencies, our bot immediately runs npm install and npm test.

I think it might also work just by having Greenkeeper open its PRs for dependency updates, since that should then trigger Travis to run, yeah?

@jordaaash
Copy link
Contributor Author

Did some research, looks like you need to use this to get lockfile updates for free:
https://github.com/greenkeeperio/greenkeeper-lockfile

This looks cool as well, seems like a Greenkeeper alternative with built-in lockfile updates:
https://renovateapp.com

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.

4 participants