Storing packages in git. Updating behavior


#1

I’m storing a package in a git repo.
Will my projects using that package update immediately If I push a commit to it ?
Do I need to update the version field in package.json ?

I conducted a couple of experiments, but I wasn’t able to figure out the exact project behaviour in this situation.

Thanks for your help.


#2

Hi Em-Ant

The projects will not update immediately upon pushing an update to the dependency git repo, but they may update the next time you modify package.json. I’m not sure the exact behavior of npm when using git dependencies. My recommendation is to specify a specific tag or sha to make sure that the dependency doesn’t update out from under you accidentally, and to manually update to a new tag when you know that the project depending on your repo has been updated to be compatible with the changes.

Happy to help :slight_smile:


#3

Thank you, for your super-quick answer :heart:.
I need all the projects depending on it (they could be many) to update when I introduce changes to the package implementation. Is that possible ?

I noticed that you have to edit the package.json to force the update. Will ALL the projects update after that or just the one that I edited ?


#4

Each project will require a separate update to the package.json.