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

fix: Resolve whatBump is not a function error #105

Conversation

oluwatobiss
Copy link
Contributor

@oluwatobiss oluwatobiss commented Oct 27, 2024

This PR does the following:

  • Resolve the ERROR whatBump is not a function error by resolving the pending preset promise and passing the appropriate whatBump argument to bumper.bump().
  • Allow using any config file to optionally configure release-it to skip releasing a version. (Any accepted variation of a whatBump: false configuration option would do the job.

.release-it.json Example

{
  "plugins": {
    "@release-it/conventional-changelog": {
      "preset": {
        "name": "conventionalcommits"
      },
      "whatBump": false
    }
  }
}

.release-it.js Example

module.exports = {
  plugins: {
    "@release-it/conventional-changelog": {
      preset: {
        name: "conventionalcommits",
      },
      whatBump: false,
    }
  }
}
Passing test's result
$ npm run test

> @release-it/[email protected] test
> node --test test.js

✔ should generate changelog using recommended bump (minor) (4839.2414ms)
✔ should generate changelog using recommended bump (patch) (2408.4955ms)
✔ should support tag suffix (2023.5232ms)
✔ should respect --no-increment and return previous, identical changelog (3402.4726ms)
✔ should ignore recommended bump (option) (2069.2052ms)
✔ should use provided pre-release id (1880.802ms)
- Git commit
✔ Git commit
- Git tag
✔ Git tag
- Git commit
✔ Git commit
- Git tag
✔ Git tag
- Git commit
✔ Git commit
- Git tag
✔ Git tag
- Git commit
✔ Git commit
- Git tag
✔ Git tag
✔ should follow conventional commit strategy with prereleaase (6971.9425ms)
✔ should use provided pre-release id (pre-release continuation) (1997.6218ms)
✔ should use provided pre-release id (next pre-release) (1672.1806ms)
✔ should use recommended bump (after pre-rerelease) (1865.4596ms)
✔ should follow strict semver (pre-release continuation) (1931.4418ms)
✔ should follow strict semver (pre-release continuation, conventionalcommits) (1892.9996ms)
✔ should use provided increment (1562.8889ms)
✔ should use provided version (ignore recommended bump) (1402.5338ms)
✔ should not throw with Git plugin disabled (886.8307ms)
- Git tag
✔ Git tag
✔ should write and update infile (4177.3786ms)
✔ should reject if conventional bump passes error (1171.7179ms)
✔ should reject if conventional changelog has error (1179.4039ms)
✔ should not write infile in dry run (1311.7151ms)
✔ should not write infile if set to false (1382.9401ms)
✔ should not bump when recommended bump returns null (4800.0704ms)
✔ should not bump when whatBump === false (2380.4874ms)
﹣ should pass parserOpts and writerOpts (0.1167ms) # SKIP
ℹ tests 23
ℹ suites 0
ℹ pass 22
ℹ fail 0
ℹ cancelled 0
ℹ skipped 1
ℹ todo 0
ℹ duration_ms 55225.2853

Resolves #101, resolves #103

Copy link

pkg-pr-new bot commented Oct 28, 2024

Open in Stackblitz

yarn add https://pkg.pr.new/@release-it/[email protected]

commit: 2b9ccd2

@webpro
Copy link
Contributor

webpro commented Oct 28, 2024

Thanks a lot, @oluwatobiss! This looks promising.

One thing I don't really like is the "undefined" string, how about the false boolean?


Would like a helping hand here, so cc-ing @ayZagen, @will-stone, @egilsster, @LinuCC, @splincode, @tefanobartoletti, @andi1984-ds, @janbiasi, @chris-dura, @Tomas2D. Any chance you could give this a shot:

npm install -D https://pkg.pr.new/@release-it/[email protected]

@andi1984-ds
Copy link

I can confirm that this version fixes the issue on my side.

@oluwatobiss
Copy link
Contributor Author

Thanks a lot, @oluwatobiss! This looks promising.

One thing I don't really like is the "undefined" string, how about the false boolean?

Would like a helping hand here, so cc-ing @ayZagen, @will-stone, @egilsster, @LinuCC, @splincode, @tefanobartoletti, @andi1984-ds, @janbiasi, @chris-dura, @Tomas2D. Any chance you could give this a shot:

npm install -D https://pkg.pr.new/@release-it/[email protected]

Sure! false looks neater. I will update it now.

@oluwatobiss
Copy link
Contributor Author

Updated!

@egilsster
Copy link

9.0.1 fixed most of our woes, but one project was still having issues. The version above solves those 🎉 thanks for addressing this!

@webpro webpro merged commit 5e0af0c into release-it:master Oct 29, 2024
11 checks passed
@webpro
Copy link
Contributor

webpro commented Oct 29, 2024

Released v9.0.2

Thanks a lot @oluwatobiss, you saved all of us! 🙏

@oluwatobiss oluwatobiss deleted the fix/resolve-whatBump-is-not-a-function-error branch October 29, 2024 17:18
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

Successfully merging this pull request may close these issues.

ERROR whatBump is not a function getting ERROR whatBump is not a function
4 participants