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

.versionrc.json is not being loaded #371

Closed
flyinbutrs opened this issue May 29, 2019 · 7 comments · Fixed by #378
Closed

.versionrc.json is not being loaded #371

flyinbutrs opened this issue May 29, 2019 · 7 comments · Fixed by #378

Comments

@flyinbutrs
Copy link

flyinbutrs commented May 29, 2019

.versionrc.json is not being loaded currently, only .versionrc. This is my .versionrc.json file currently:

$ cat .versionrc.json
{
  "scripts": {
    "precommit": "yo version-file --force --git"
  }
}

When I run, note that there's no precommit hook executed:

$ npm run release -- --dry-run

> generator-version-file@0.1.0 release /Users/drosenbloom/git/generators/generator-version
> standard-version "--dry-run"

✔ bumping version in package.json from 0.1.0 to 0.1.1
✔ bumping version in package-lock.json from 0.1.0 to 0.1.1
✔ outputting changes to CHANGELOG.md

---
### [0.1.1](https://github.com/flyinbutrs/generator-version-file/compare/v0.1.0...v0.1.1) (2019-05-29)
---

✔ committing package-lock.json and package.json and CHANGELOG.md
✔ tagging release v0.1.1
ℹ Run `git push --follow-tags origin master && npm publish` to publish

But if I move .versionrc.json to .versionrc and retry, it does execute the hook.

$ mv .versionrc.json .versionrc
$ npm run release -- --dry-run

> generator-version-file@0.1.0 release /Users/drosenbloom/git/generators/generator-version
> standard-version "--dry-run"

✔ bumping version in package.json from 0.1.0 to 0.1.1
✔ bumping version in package-lock.json from 0.1.0 to 0.1.1
✔ outputting changes to CHANGELOG.md

---
### [0.1.1](https://github.com/flyinbutrs/generator-version-file/compare/v0.1.0...v0.1.1) (2019-05-29)
---

✔ Running lifecycle script "precommit"
ℹ - execute command: "yo version-file --force --git"
✔ committing package-lock.json and package.json and CHANGELOG.md
✔ tagging release v0.1.1
ℹ Run `git push --follow-tags origin master && npm publish` to publish

Tested on v6.0.1.

$ npm run release -- --version

> generator-version-file@0.1.0 release /Users/drosenbloom/git/generators/generator-version
> standard-version "--version"

6.0.1
flyinbutrs added a commit to flyinbutrs/generator-version-file that referenced this issue May 29, 2019
bug in standard-version@6.0.1 does not load `.versionrc.json`

conventional-changelog/standard-version#371
@stevemao stevemao added the bug label May 30, 2019
jbottigliero pushed a commit that referenced this issue Jun 8, 2019
- Updates the configuration retrieval to support Javascript (`.js`) configurations.
- Javascript configurations MUST export a configuration object _or_ a function (returning a configuration object) as the default export.

closes #371
@jbottigliero
Copy link
Member

Hey! Thanks for the report – this actually isn't supported in the current release, but I've opened a PR that should account for this functionality.

@bcoe
Copy link
Member

bcoe commented Jun 11, 2019

@jbottigliero I'm a bit confused, I think this issue relates to .json format files, not to .js. I have a slight preference for not supporting .js format, as it can lead to bad habits (your configuration shouldn't be a program IMO).

I would however love to fix this bug.

@jbottigliero
Copy link
Member

jbottigliero commented Jun 11, 2019

Whoa, yeah... I’ve confused myself. Taking a second look at this...

Let me review the tests and see what’s going on here!

@jbottigliero
Copy link
Member

Ah, I see the problem here... it's actually resolved in #357 which will land in the next version @bcoe.

I've opened #381 if we want to ensure coverage for now...

...I think tests deserve a bit of a clean-up with the new configuration patterns, but we can save that conversation for another day.

@pdsouza
Copy link

pdsouza commented Aug 6, 2019

I can confirm that .versionrc.json is working correctly in 7.0.0.

@stevemao
Copy link
Member

stevemao commented Aug 7, 2019

Is this addressed? The PR hasn't been merged yet.

@flyinbutrs
Copy link
Author

Yes, it's working in 7.0.0. Not sure what changed, but it definitely works.

jbottigliero pushed a commit that referenced this issue Aug 20, 2019
- Updates the configuration retrieval to support Javascript (`.js`) configurations.
- Javascript configurations MUST export a configuration object _or_ a function (returning a configuration object) as the default export.

closes #371
jbottigliero added a commit that referenced this issue Aug 24, 2019
* feat(configuration): .versionrc.js files are now supported

- Updates the configuration retrieval to support Javascript (`.js`) configurations.
- Javascript configurations MUST export a configuration object _or_ a function (returning a configuration object) as the default export.

closes #371

* docs: Updates README to include details for the new '.versionrc.js' support

* fix: updates error message to be a bit more descriptive and helpful.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging a pull request may close this issue.

5 participants