git-package-cli
v0.0.2
Published
Utility commands for easily developing git-referenced modules in NPM packages
Downloads
3
Readme
Git package CLI
Useful CLI commands for working with NPM modules which are referenced and packaged as git repositories; especially useful in microfrontend architectures.
Usage
Use this module when:
- You want to track sub-components of your nodejs apps as entirely independent git repositories
- You want to use only NPM as a package manager and avoid other things which complicate setup for developers & end-users
- Your team isn't comfortable with git submodules
Sound good? Read on—
How to use this with your project
These commands can offer a reasonably seamless development experience, provided you follow a few necessary conventions in your setup:
- Sub-components:
- must have a
package.json
file in the root of the repository in order to be used directly as an NPM module via git - should use the
prepare
package script to perform any initial compilation or building necessary to import the component
- must have a
- The "main app" repository:
- can have its
package.json
wherever it wants, or be a monorepo with several packages, whatever... - should add the directory
./submodules
adjacent to anypackage.json
files to.gitignore
- can have its
That's it! Provided the above are followed, you may then run:
git-package checkout [moduleId]
to clone a working copy of the specified module into the./submodules
folder.git-package sync [moduleId]
to updatepackage.json
to reference the active version of the given module in your working copy. Usually you will want to commit this change to the repo in order to update the dependency for others.
Caveats
- If you use HTTPS URIs to reference git repos in
package.json
but use SSH to interact with those repositories as a developer, you will need to add your SSH remotes to any managed modules by hand.
License
MIT