Use this manager to manage git-dependencies with different branches for your project automatically using NPM.
Install microservices-git-dependencies-manager
as a dependency for your project and save file git-dependencies.json
at the same level as package.json of the project. Every npm install
after that every package from the file will be processed and installed into your project with specific branch. It could be useful if you have more than one branch of your project with some external libs, and would like to install the same branch of dependency as you project.
For example, you have project: microservice users
and some intenal git-packages in their package.json (libs, crud-boilerplate, logger, e.t.c.). For each branch (feature/newRelease, develop, staging, master) of your main project you have the same branches of your dependencies. Then, when you merge changes of feature branch into develop, or merge develop into staging, you also need to make following commit with package.json version fixes. This brokes Docker build cache, also. This manager helps you to solve both problems. You don't need to change anything in package.json between branches.
For each package, manager tries to install such branches one-by-one until success
- env variable
GIT_DEPENDENCIES_USE_BRANCH
- branch-name from
.git
directory of your project defaultBranch
from the config file
To reduce amount of useless packages in the project, manager removes itself at the end. To disable it, change value of selfCleanup
field in git-dependencies.json
file in your project.