crazyfactory / php-package-boilerplate

0 stars 0 forks source link

chore(.gitignore): Ignore composer.lock #9

Open dacgray opened 6 years ago

dacgray commented 6 years ago

We should default ignore composer.lock.

It can contain sensitive information like gemfury keys - and so should be ignored by default.

cyberhck commented 6 years ago

since this is public boilerplate and our default repositories are public, ignoring a composer.lock isn't a very good idea (had this huge discussion with andre, and as you can see we're no longer ignoring composer.lock on shop). User is anyway supposed to delete the .git directory and do a init again when he starts with boilerplate. I propose, just ignore by adding to .gitignore, but don't delete it. That way we still track it, but once user removes .git and does a git init, he'll not track anymore, but if he feels like it, he can always remove from .gitignore, but for this project, we want to be able to produce reproducible builds and we want travis to go faster, so don't actually delete the lock file :slightly_smiling_face:

dacgray commented 6 years ago

There's still the problem of the lock file potentially containing our gemfury key. We can't expose the key on an open source repo.

This is not to say we should ignore our .lock files on other projects. Only open source projects where our key is exposed.

So since this is our package boilerplate, and a lot of those future packages will be open source we should ignore composer.lock by default.

cyberhck commented 6 years ago

I mean, this repo will never reference any private repo anyway, so there's no problem of exposing our keys.

When someone creates a new project either using composer create-project or git clone ..., first thing they're supposed to is to remove .git directory, (composer create-project actually doesn't clone history, it's not even a git repo at first), so all we have to do to this repo is to add composer.lock to .gitignore, and without deleting in this repo.

Once you create a new repo from this repo, it'll immediately stop tracking in your new repository (and you might even want to make it private in that case)

dacgray commented 6 years ago

So, this will be the default for new packages.

Can we agree that we should add composer.lock to .gitinore as a starting point for these packages by default?

cyberhck commented 6 years ago

I'm not sure if we understand each other.

That's some of the point, but I'm not saying that composer.lock will be automatically tracked. We do the following:

I still think that's not a good default, our builds won't be reproducible, and we should be committing composer.lock anyways, I think keys being inside composer.lock is a bad idea already, but to overcome that, ignoring lock file isn't a good idea, instead just keep the package private.

Package can only be public if it doesn't have any secret things, (which means we'll want to commit composer.lock anyways)

Actually I'm not very good at conveying proper response via text, we can actually sit down after scrum and have a discussion what do you say? (Just read the thing and it sounds terrible, when it wasn't like that when I wrote it), actually let's just discuss this tomorrow :)

cyberhck commented 6 years ago

hey, actually I thought about this yesterday evening and it makes to ignore by default because this is a package, sorry for wasting your time, I forgot about that guideline somewhere it says package should ignore and app should commit.

Sorry, my bad. So we'll add to .gitignore and remove composer.lock :)