Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add [file] parameter to --package flag. #293

Open
anselmbradford opened this issue Sep 27, 2024 · 5 comments
Open

Add [file] parameter to --package flag. #293

anselmbradford opened this issue Sep 27, 2024 · 5 comments

Comments

@anselmbradford
Copy link

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

@anselmbradford
Copy link
Author

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?

@ljharb
Copy link
Contributor

ljharb commented Oct 16, 2024

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

@anselmbradford
Copy link
Author

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).

@ljharb
Copy link
Contributor

ljharb commented Oct 17, 2024

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?

@anselmbradford
Copy link
Author

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).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants