Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Specifying latest version with Lerna monorepos

See original GitHub issue


We use Lerna with our monorepo. As such the repo root package.json does not contain a version property, and instead the packages live under packages/* thanks to Yarn’s workspaces feature.

This means that we cannot pass --package to auto-changelog, otherwise we get the following error: auto-changelog: Generating changelog…TypeError: Invalid Version: vundefined

As a workaround, we’re planning on using something like this: auto-changelog --latest-version $(jq -r .version lerna.json)

…however I was wondering whether this is something that you’d be open to auto-changelog supporting? (If only because using bash subcommands makes the package.json script not compatible with Windows.)

Possible options:

  • the --package option accepting arguments, so that we could pass --package lerna.json (since it also happens to contain a version property) or --package packages/neutrino/package.json
  • the --package option automatically falling back to other locations, if there is no version in that file (eg it could scan the workspace directories, or know to try lerna.json)
  • adding a --lerna-version option that specifically uses lerna.json

Thoughts? (I’m happy to open a PR if/when a design direction is agreed 😃)

CC @eliperelman

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:2
  • Comments:6 (1 by maintainers)

github_iconTop GitHub Comments

cookpetecommented, Apr 16, 2019

@edmorley I’ve added support for --package [file] in 1.13.0. Let me know if this solves your issue.

edmorleycommented, Apr 13, 2019

That would fix the error when running auto-changelog --package, however then the changes for the about-to-be-released version are not included in the README. (The pupose of --package or --latest-version is to be able to tell auto-changelog what the new version number is, since at that point in the release process the package and/or git tag does not exist for it to be able to infer itself.)

Read more comments on GitHub >

github_iconTop Results From Across the Web

Lerna: Documentation
Lerna is a fast modern build system for managing and publishing multiple JavaScript/TypeScript packages from the same repository.
Read more >
How To Manage Monorepos With Lerna - DigitalOcean
Step 1 — Installing Lerna and Initializing the Project​​ In this step, you will install Lerna and set up your project. With Lerna,...
Read more >
Setting up a monorepo with Lerna for a TypeScript project
The lerna create command will guide us through the creation of a new package. It requires your new package's name to be passed...
Read more >
Automatic versioning in a Lerna monorepo using Github actions
Integrate Lerna in a CI flow to automatically version and publish packages using Github actions. Tagged with lerna, javascript, npm, github.
Read more >
Lerna is a fast, modern build system for managing ... - GitHub
Lerna is a fast modern build system for managing and publishing multiple JavaScript/TypeScript packages from the same repository.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Post

No results found

github_iconTop Related Hashnode Post

No results found