cookpete/auto-changelog

Add [file] parameter to --package flag.

Opened this issue · 5 comments

As shown here, the -p/--package flag can take a file path.

The README usage docs should be updated to show this.

Maybe related to #291, which describes missing docs in the usage section of https://github.com/cookpete/auto-changelog/blob/master/README.md

I have a monorepo setup like

package.json
src/package.json

The root package.json is private, and the src/package.json has a version number.
I want the auto-changelog to run from the root package.json, but read and update the src/package.json.
When I use "version": "auto-changelog --package src/package.json" it's still writing a version to the root package.json instead of src/package.json.

What am I missing?

In your command, you'd run cd src && auto-changelog. I'm not sure anything more is needed.

In your command, you'd run cd src && auto-changelog. I'm not sure anything more is needed.

Hmm, so I tried adding this to the root package.json

"scripts": {
   …
   "version": "cd src && auto-changelog"
}

And running yarn version (I'm using yarn), and it's still bumping the version in the root package.json, not src/package.json. I also tried "version": "cd src && auto-changelog -package package.json" and "cd src && auto-changelog -package src/package.json" (where it complained the path was not correct—b/c it already cd'd into src).

hmm, i wonder if there's some npm env vars being looked at. what if you had a script in src/package.json that runs auto-changelog, and you cd src && npm run that?

Thanks, I ended up taking this advice roughly. Unfortunately that means the auto-changelog config ends up having to be in src/package.json (I'd prefer to keep it in the root).