2.1.0 • Published 10 months ago

whatbump v2.1.0

Weekly downloads
-
License
MIT
Repository
github
Last release
10 months ago

whatbump

Extremely basic utility to find out what semantic version bump should occur for a given folder based upon conventional commit messages. Outputs major, minor, patch or an empty string based upon what semantic release the commits describe.

Installation:

npm install -g whatbump

Usage:

whatbump [options] [path]

Options:

OptionsDescrioptionDefault
--baseGit ref or sha to compare against when viewing differences.main
--refGit ref of sha to use as the current state.HEAD
--presetChangelog processor to use for determining bump method.conventionalcommits
--type-filterComma separated list of commit types to accept, ignoring all other types.fix, feat, feature, breaking
--changelogOutput changelog body
--jsonOutput both bump level and changelog as a JSON object
--versionStarting semver version number. If not provided, whatbump will look for a package.json in the target directory.
--repoRepo url for creating links in the changelog. If not provided, whatbump will look for it in a package.json in the target directory.
--namePackage name used to prefix the version in the changelog. If not provided, whatbump will look for it in a package.json in the target directory.

API

Note: Invoking the api directly requires supplying all of the below config options. There are no defaults, like above.

import whatbump from 'whatbump';

const {
  level, // bumping level (major, minor, patch)
  version, // new version number
  commits, // array of parsed commits that were found
  changelog, // generated changelog result
} = await whatbump({
  cwd,  // directory to read commits from
  base, // Git ref or sha to compare against when viewing differences.
  ref,  // Git ref of sha to use as the current state
  preset, // Commit analysis preset
  types, // Array of the commit types that should be analyized
  context: {
    version, // current starting semver version
    name, // package name that will prefix the version number in changelogs
    repoUrl  // repo url (for generating changelog links)
  }
});