This is an example of multiple NPM modules published on one repository that stands as a monorepo project.
These projects are just an example of implementation where every project has its own module (@slaveofcode is the GitHub account/organization name)
- Auth (npm module as: @slaveofcode/test-auth)
- Cryptography (npm module as: @slaveofcode/test-cryptography)
- Common Helpers (npm module as: @slaveofcode/test-common-helpers)
- Notification (npm module as: @slaveofcode/test-notification)
- Service Adapter (npm module as: @slaveofcode/test-service-adapter)
I manually changed the module name at package.json & package-lock.json (use test- prefix) because those modules are created just for testing only
The GitHub action will automatically release a new npm module version when the version of package.json is changed (patch-minor-major), triggered by pushing the commit at main branch
- remove label
private: trueonpackage.json - add custom
.npmrcto handle local & cloud registry authentication (see the example atauth/.npmrc) - Don't forget to set
mainandfilesto only direct the generated.jsfiles atpackage.json - Add extra config at
package.json(You might adjust the account & repository name)
... "repository": { "url": "https://github.com/slaveofcode/monorepo-npm-modules-example" }, "publishConfig": { "registry": "https://npm.pkg.github.com/" } ...