angular-monorepo-packages-test
v0.0.0
Published
This repository exists to demonstrate setting up Lerna and providing contribution guidelines for projects using Lerna.
Downloads
3
Readme
Angular Monorepo Packages Test
This repository exists to demonstrate setting up Lerna and providing contribution guidelines for projects using Lerna.
- Setup Lerna
- Contributing Guidelines
Important links:
1. Setup with Lerna
For more information on Lerna, read up on their source repo docs: https://github.com/lerna/lerna
- Setup with Lerna
- Init Lerna
- Modify lerna.json
- Modify package.json
- Modify each project's package.json
- Modify each project's ng-package.json/ng-package.prod.json
1.i. Init Lerna
Run npx lerna init
within the main project directory (not 'projects').
1.ii. Modify lerna.json
Use the following for the lerna.json file. These configurations can be modified as needed.
{
"packages": [
"projects/*"
],
"command": {
"publish": {
"contents": "dist",
"conventional-commits": true
},
"version": {
"message": "chore(release): publish %s",
"conventional-commits": true,
"push": false
},
"bootstrap": {
"npmClientArgs": ["--no-package-lock"]
}
},
"version": "independent"
}
1.iii. Modify package.json
Add the following scripts to the package.json
"lerna-version": "lerna version --yes --conventional-commits",
"postversion": "lerna run build",
The following are unnecessary within TFS/Azure DevOps at present:
"lerna-publish": "lerna publish --yes --conventional-commits",
"prepublish": "lerna run build",
1.iv. Modify each project's package.json
Modify name for scope
If using scoping for the project names, change the name to include the scope:
Before:
"name": "my-project"
After:
"name": "@my-scope/my-project"
Add build script
Add the following script to the package.json
{
...
"scripts": {
"build": "ng build my-project --prod"
},
...
}
1.v. Modify each project's ng-package.json/ng-package.prod.json
Modify the dest
property in ng-package.json and ng-package.prod.json to
{
"dest": "./dist",
...
}
2. Contributing Guidelines
For more details on the git commit guidelines and their source, check out: https://github.com/angular/angular.js/blob/master/DEVELOPERS.md#-git-commit-guidelines