my opinion based mono repo for shared libraries i only wanted to build stanalone liberies, run tests and publish without any fancy stuff.
after using this template firts change root package.json name (@monaorepo) property to your Scope
to genrate liberaries run npm i
in the root directory
then run npm run generate
to genrate the liberaries
need to pass 2 arguments to the script
- liberary name [string]
- liberary type [nest | basic]
the liberary name genrate from : <scope>/<type>-<name>
scope
: root package.json name field and @ prefix
for example : npm run genreate nest http-client
this will create a new libery template
with the name @monaorepo/nest-http-client
go to your package dir :
- make some changes
- write unit tests
- commit your changes
- run npm version command for example:
npm version patch
- npm build
- npm publish
will genrate a nestjs liberary with this file sturcture
.
├── package.json
├── tsconfig.json
├── src
│ ├── index.ts
│ ├── template.module.ts
│ ├── template.service.ts
│ └── template.service.spec.ts
└── ...
the template already setup with jest test runner and package.json with the following scripts
"build": "nest build", #(build liberary)
"test": "jest", #(run tests)
"test:watch": "jest --watch", #(hot reload for tests)
"test:cov": "jest --coverage" #(test coverage)
will genrate a basic liberary with this file sturcture
.
├── package.json
├── tsconfig.json
├── src
│ ├── index.ts
│ └── template.ts
└── ...
this template already setup with github actions for CI the workflow will run on every push to master branch and will run the following steps:
- checkout
- setup node
- install dependencies
- run tests
- build liberary
commit -> Job 1 which packages changed: [kafka1 mysql2]