JSON output for `lerna publish`
See original GitHub issueExpected Behavior
When I run lerna publish
, I would like to get a machine-readable output alongside the regular logging.
Current Behavior
There is no JSON output.
Possible Solution
lerna publish --summary-file lerna-publish.json
This would write the following to lerna-publish.json
:
{
"published": [
{ "name": "@scope/module-a", "version": "1.2.3", "tag": "latest" },
{ "name": "@scope/module-b", "version": "1.1.1", "tag": "latest" }
]
}
Context
The use case for this file is to kick off deployments in CI pipelines that depend on the packages that were just published.
Here is the horrible bash script that I want to kill! 🔥
lerna publish | tee lerna-output.log
# Extract published packages from the output log
published_packages=$(grep -A 1000 'Successfully published' lerna-output.log \
| grep -e '^ - @[a-z]\+/' \
| sed 's/^ - //' \
| sed 's/@\([0-9].*\)$/ \1/'
)
while read -r module_name version; do
echo "Do something with ${module_name}@${version}."
done <<< "${published_packages}"
Issue Analytics
- State:
- Created 4 years ago
- Comments:6 (4 by maintainers)
Top Results From Across the Web
Version and Publish - Lerna
json file at the root of your project under the version key. When you run lerna publish , if a module has been...
Read more >@lerna/output - npm
An internal Lerna tool. Latest version: 6.0.1, last published: 13 days ago. Start using @lerna/output in your project by running `npm i ...
Read more >Top 5 lerna Code Examples - Snyk
mkdirsSync(outputDir); const packages = lerna. ... function main(argv) { // For lerna publication to work, the NPM token must be stored in the...
Read more >lerna/changed - NPM Package Overview - Socket.dev
The output of lerna changed is a list of packages that would be the subjects ... Note: lerna.json configuration for lerna publish and...
Read more >Setting up a monorepo with Lerna for a TypeScript project
Also, create an npm organization so that you can publish the project ... This command will create a lerna.json file with a default...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Closing this as I’m happy enough with reading git tags. Feel free to re-open if you think there’s wider value.
+1 to this. Also for CI and updating comments in PRs, trying to get a result of publishing beta versions right now requires ugly code to reduce the output of
lerna publish
into something meaningful.