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

Question: Are packageFiles in .versionrc not bumped automatically? #533

Closed
zaki-yama opened this issue Jan 25, 2020 · 2 comments · Fixed by #534 or #864
Closed

Question: Are packageFiles in .versionrc not bumped automatically? #533

zaki-yama opened this issue Jan 25, 2020 · 2 comments · Fixed by #534 or #864
Assignees
Labels

Comments

@zaki-yama
Copy link

I'd like to ask you about the expected behavior.

Background

Now I have an manifest.json file under dist directory.

<root>
- dist/
  - manifest.json
- package.json
- .versionrc.js

I'd like to sync versions in both package.json and dist/manifest.json, so I added dist/manifest.json to packageFiles in .versionrc.js.

module.exports = {
  packageFiles: [
    {
      filename: "dist/manifest.json",
      type: "json"
    }
  ],
};

Problem

I ran standard-version (with --dry-run option), but it seems to bump up only package.json and package-lock.json.

$ npx standard-version --dry-run 
✔ bumping version in package.json from 1.0.0 to 1.0.1
✔ bumping version in package-lock.json from 1.0.0 to 1.0.1
✔ created CHANGELOG.md
✔ outputting changes to CHANGELOG.md

Question

Is that the expected behavior?
In README,

packageFiles – User-defined files where versions can be read from and be "bumped".

I couldn't quite understand what "and be "bumped"" meant.
And default packageFiles are bumped because they are merged into bumpFiles.

Workaround

I can bump up by moving dist/manifest.json to bumpFiles.
But I had to contain package.json too (because it overwrote the default values).

module.exports = {
  bumpFiles: [
    {
      filename: "package.json",
      type: "json"
    },
    {
      filename: "dist/manifest.json",
      type: "json"
    }
  ]
};
@jbottigliero
Copy link
Member

Hey @zaki-yama, thanks for the thorough write-up. Your observations seem correct – it looks like we're currently not merging the packageFiles configuration with bumpFiles, we're only doing this when you don't provide packageFiles value. This seems like unexpected behavior to me... and the behavior described in the README is the intended functionality.

Your workaround is valid for now, just consider that without a packageFile option like you had previously the version will be read from one of the available default files (in your case probably package.json).

@jbottigliero jbottigliero self-assigned this Jan 25, 2020
jbottigliero added a commit that referenced this issue Jan 25, 2020
…iles` when no `bumpFiles` argument is specified (default).

- Merges `packageFiles` with `defaults.bumpFiles` before merging in arguments when a `packageFile` argument is present.
- Adds some simple "validation" to updaters and improves error messaging.
- Adds a test case covering #533

closes #533
@zaki-yama
Copy link
Author

@jbottigliero
Thank you very much for your quick response!

jbottigliero added a commit that referenced this issue Oct 19, 2021
…iles` when no `bumpFiles` argument is specified (default).

- Merges `packageFiles` with `defaults.bumpFiles` before merging in arguments when a `packageFile` argument is present.
- Adds some simple "validation" to updaters and improves error messaging.
- Adds a test case covering #533

closes #533
jbottigliero added a commit that referenced this issue Oct 19, 2021
…iles` when no `bumpFiles` argument is specified (default).

- Merges `packageFiles` with `defaults.bumpFiles` before merging in arguments when a `packageFile` argument is present.
- Adds some simple "validation" to updaters and improves error messaging.
- Adds a test case covering #533

closes #533
jbottigliero added a commit that referenced this issue Oct 19, 2021
…iles` when no `bumpFiles` argument is specified (default). (#534)

- Merges `packageFiles` with `defaults.bumpFiles` before merging in arguments when a `packageFile` argument is present.
- Adds some simple "validation" to updaters and improves error messaging.
- Adds a test case covering #533

closes #533
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment