Specifying latest version with Lerna monorepos
See original GitHub issueHi!
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 aversion
property) or--package packages/neutrino/package.json
- the
--package
option automatically falling back to other locations, if there is noversion
in that file (eg it could scan the workspace directories, or know to trylerna.json
) - adding a
--lerna-version
option that specifically useslerna.json
Thoughts? (I’m happy to open a PR if/when a design direction is agreed 😃)
CC @eliperelman
Issue Analytics
- State:
- Created 4 years ago
- Reactions:2
- Comments:6 (1 by maintainers)
@edmorley I’ve added support for
--package [file]
in1.13.0
. Let me know if this solves your issue.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.)