Need help to find correct configuration for monorepo project.
See original GitHub issueI am unable to find out correct configuration to publish(to artifactory) only those components where file is modified.
Below is the command executed after I change any src file of component: git add . git cz (commitzen)
Below is the command I execute for testing, building and publishing component:
npm install
node_modules/.bin/ng lint component1 --force=true --format=json > component1_lint-out.json
node_modules/.bin/ng test component1 --code-coverage --browsers ChromeHeadless
node_modules/.bin/ng lint component2 --force=true --format=json > component2_lint-out.json
node_modules/.bin/ng test component2 --code-coverage --browsers ChromeHeadless
node_modules/.bin/ng lint component3 --force=true --format=json > component3_lint-out.json
node_modules/.bin/ng test component3 --code-coverage --browsers ChromeHeadless
node_modules/.bin/ng build component1
node_modules/.bin/ng build component2
node_modules/.bin/ng build component3
npx semantic-release -e semantic-release-monorepo
here only component1 gets published to JFrog Artifactory
Here I wanted to avoid building each component, and instead of that have config in root package.json to achieve that.
I have following monorepo project structure:
master-project(Project root)
|_-> apps
|_-> e2e
|_-> libs
|_-> projects
|_-> component1 -> package.json
|_-> component2 -> package.json
|_-> component3 -> package.json
|_-> package.json
project root package.json content:
{
"name": "master-project",
"version": "0.0.0-semantically-released",
"scripts": {
"ng": "ng",
"start": "ng serve",
"build": "ng build",
"test": "ng test",
"lint": "ng lint",
"e2e": "ng e2e"
},
"private": false,
"dependencies": {
"@angular/animations": "^6.1.0",
"@angular/common": "^6.1.0",
"@angular/compiler": "^6.1.0",
"@angular/core": "^6.1.0",
"@angular/forms": "^6.1.0",
"@angular/http": "^6.1.0",
"@angular/platform-browser": "^6.1.0",
"@angular/platform-browser-dynamic": "^6.1.0",
"@angular/router": "^6.1.0",
"core-js": "^2.5.4",
"rxjs": "^6.0.0"
},
"devDependencies": {
"@angular-devkit/build-angular": "~0.7.0",
"@angular-devkit/build-ng-packagr": "~0.7.0",
"@angular/cli": "~6.1.1",
"@angular/compiler-cli": "^6.1.0",
"@angular/language-service": "^6.1.0",
"@semantic-release/changelog": "github:semantic-release/changelog",
"@types/jasmine": "~2.8.6",
"@types/jasminewd2": "~2.0.3",
"@types/node": "~8.9.4",
"codelyzer": "~4.2.1",
"cz-conventional-changelog": "^2.1.0",
"jasmine-core": "~2.99.1",
"jasmine-spec-reporter": "~4.2.1",
"karma": "~1.7.1",
"karma-chrome-launcher": "~2.2.0",
"karma-coverage-istanbul-reporter": "^2.0.0",
"karma-jasmine": "~1.1.1",
"karma-jasmine-html-reporter": "^0.2.2",
"karma-sonarqube-reporter": "^1.0.4",
"ng-packagr": "^3.0.0",
"protractor": "~5.3.0",
"semantic-release": "^15.9.16",
"semantic-release-gerrit": "^1.1.4",
"semantic-release-monorepo": "^6.1.1",
"ts-node": "~5.0.1"
},
"config": {
"commitizen": {
"path": "./node_modules/cz-conventional-changelog"
}
},
"release": {
"monorepo": {
"analyzeCommits": "@semantic-release/commit-analyzer",
"generateNotes": [{
"path": "semantic-release-gerrit",
"gerritUrl": "https://gerrit.com/#/admin/projects/master-project"
}]
},
"verifyConditions": "@semantic-release/npm",
"analyzeCommits": "@semantic-release/commit-analyzer",
"generateNotes": [{
"path": "semantic-release-gerrit",
"gerritUrl": "https://gerrit.com/#/admin/projects/master-project"
}],
"prepare": [{
"path": "@semantic-release/changelog",
"changelogFile": "docs/changelog.md"
},
"@semantic-release/npm"
],
"publish": "@semantic-release/npm",
"success": false,
"fail": false,
"pkgRoot": "./dist/component1/",
"npmPublish": true,
"tarballDir": "dist",
"branch": "master"
},
"repository": {
"type": "git",
"url": "https://gerrit.com/a/master-project.git"
}
}
component1 package.json content:
{
"name": "component1",
"version": "0.0.1-semantically-released",
"peerDependencies": {
"@angular/common": "^6.0.0-rc.0 || ^6.0.0",
"@angular/core": "^6.0.0-rc.0 || ^6.0.0"
}
}
I know “pkgRoot”: “./dist/component1/” is the one which is causing only component1 to publish. But if I try “pkgRoot”: [“./dist/component1/”, “./dist/component2/”, “./dist/component3/”] it is throwing error.
Please suggest on how to achieve:
- Publish only those component where actully file got changed.
- Version bump (minor or major or patch) only for specific component where file got changed.
Help wanted!
Issue Analytics
- State:
- Created 5 years ago
- Comments:6 (3 by maintainers)
Top GitHub Comments
Thanks @pmowrer for your input. And yes integrating lerna did help. Right now I am testing it, and results are on positive side.
Hi @swapniljv!
Both points listed is exactly why
semantic-release-monorepo
exists!I would suggest using
lerna
to runsemantic-release-monorepo
across each package in your monorepro. See README for more details.