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

Package.json dependency #38

Open
1am opened this issue Jan 31, 2018 · 3 comments
Open

Package.json dependency #38

1am opened this issue Jan 31, 2018 · 3 comments

Comments

@1am
Copy link

1am commented Jan 31, 2018

Hello,

I've tried to use generate-changelog for my non nodejs project but it fails with Error: valid package.json not found. I've looked through the issues of this repository and found Fails when no version is specified in package.json #24 and I can't really understand why there's a need for package.json at all if all you need to get list of changes for parsing is git log v0.1...HEAD --pretty=format:'%H: %s' --reverse called from bash.

@robinjoseph08
Copy link
Contributor

Hey @1am,

When this module was first written, it was only made to support Node projects, so that's why there were a lot assumptions made about how this package would be used, including things like having a package.json to pull out the current version of that project. Since then though, we've actually started using this package for all kinds of projects, but we've had to make workarounds to get it to work (e.g. having a very minimal package.json in all of our non-Node repos) that really aren't the best.

After #25 was implemented, the package.json was no longer a hard dependency since it would just print the date instead of a semver version number. However, we didn't actually remove the requirement that a package.json needed to exist. This is a bug and should be fixed.

Long-term, I think it would be great to be able to provide a way to pass in the current version of any arbitrary package through the CLI and still apply semver version bumps that way. For example, if I have a CLI package (my-cli) that responds to a -v flag, I could use changelog -p -v $(my-cli -v) -f CHANGELOG.md. But that can be added later. First step is the package.json problem.

We'll try our best to get to it soon, but we also gladly welcome PRs if you want to help!

@ScottBrenner
Copy link
Contributor

Hi, any updates here?

@owen2345
Copy link

I added this step before changelog and worked:

- name: Create required package.json
  run: test -f package.json || echo '{}' >package.json

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

No branches or pull requests

4 participants