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

Set fixed packages versions in composer.json and .gitignore composer.lock #8382

Closed
barbushin opened this issue Jul 20, 2015 · 6 comments
Closed
Labels
wontfix If you can reproduce this issue, please reopen the issue or create a new one describing it.

Comments

@barbushin
Copy link
Contributor

I know that there is official Composer developers position that composer.lock is the best way to set fixed versions of vendors for project. But after working in many many different projects, I found that finally, it's much better just to use fixed versions numbers in composer.json and if you google it, you will find many people who think the same way.

image

image

See http://stackoverflow.com/questions/12896780/should-composer-lock-be-committed-to-version-control

May be we should think about it one more time?

I already confused working with Composer in Piwik, because I add some debug libraries for my local use, and got many conflicts with composer.lock that is not listed in .gitignore.

@barbushin barbushin changed the title Set fixed packages versions in composer.json and remove composer.lock Set fixed packages versions in composer.json and remove composer.lock Jul 20, 2015
@barbushin barbushin changed the title Set fixed packages versions in composer.json and remove composer.lock Set fixed packages versions in composer.json and .gitignore composer.lock Jul 20, 2015
@quba
Copy link
Contributor

quba commented Jul 20, 2015

@mgazdzik asked the same question several times and nothing has changed so I'd say that the answer is no (even though it would make my life easier as well).

@mnapoli
Copy link
Contributor

mnapoli commented Jul 20, 2015

The answer in the screenshot (the one from Josh) is out of topic as long as you use composer install instead of composer update (which is the recommended practice). This is a common mistake, nobody should run composer update unless they actually want to update a dependency. The answer from "jieg" says:

For application/projects: Yes

Piwik is an application, not a library, so yes we should commit composer.lock (which is what we are doing). I don't see why we should move away from that.

I don't see a reason to use fixed versions, and see the following downsides:

  • sometimes we require specific versions because of a specific reasons: in that case we can see it in composer.json and be very careful when updating the version (because we can't add comments in JSON) -> so that's useful to be able to use ~2.1 and in other places 1.4.4
  • we risk updating the versions even less because it's one more step (edit composer.json + run composer update) -> the simpler the workflow is, the better IMO (i.e. just running composer update thepackage is good)

Also keep in mind that the good practice of Composer is to commit the composer.lock file for applications (which we are doing). So I'd say it's good to stay with the official best practices.

On the other side, I don't see problems with the current practice (but maybe there are). Could you please list them?

@barbushin
Copy link
Contributor Author

@mnapoli There was a problem for me to use some custom vendors that I added in composer.json, and getting conflict in Git switching to different branches.

Matt, thanks for your answer - it's very good explanation of how it works for Piwik.

@mnapoli
Copy link
Contributor

mnapoli commented Jul 20, 2015

It's still open for discussion though if we have particular issues. But your conflicts with composer.json will still be there even if we use fixed version numbers (as this file will stay committed anyway).

@barbushin
Copy link
Contributor Author

@mnapoli Problem is that modified composer.lock can't be merged automatically with composer.lock of another branch. Merging composer.json when switching between branches works fine.

@mattab mattab added the wontfix If you can reproduce this issue, please reopen the issue or create a new one describing it. label Jul 24, 2015
@gitMomo
Copy link

gitMomo commented Aug 19, 2019

Versionning composer.lock in your project avoids a large memory load on the server. composer uses lots of memory when calculating dependencies, but not when just installing packages.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
wontfix If you can reproduce this issue, please reopen the issue or create a new one describing it.
Projects
None yet
Development

No branches or pull requests

5 participants