![Introducing Enhanced Alert Actions and Triage Functionality](https://cdn.sanity.io/images/cgdhsj6q/production/fe71306d515f85de6139b46745ea7180362324f0-2530x946.png?w=800&fit=max&auto=format)
Product
Introducing Enhanced Alert Actions and Triage Functionality
Socket now supports four distinct alert actions instead of the previous two, and alert triaging allows users to override the actions taken for all individual alerts.
conventional-recommended-bump
Advanced tools
Package description
The conventional-recommended-bump npm package is a tool that analyzes conventional-style commit messages (like those used by AngularJS) to determine the type of version bump (major, minor, or patch) that should be recommended based on the changes made. It is often used in automated versioning and release workflows to ensure semantic versioning practices are followed.
Determining the type of version bump
This feature allows you to determine whether your next release should be a major, minor, or patch version. The code sample shows how to use the package with the Angular preset to get a recommendation.
const conventionalRecommendedBump = require('conventional-recommended-bump');
conventionalRecommendedBump({
preset: 'angular'
}, (error, recommendation) => {
console.log(recommendation.releaseType);
});
Customizable preset options
This feature allows you to customize the preset options for analyzing commit messages. The code sample demonstrates how to specify a custom header pattern and correspondence for the Angular preset.
const conventionalRecommendedBump = require('conventional-recommended-bump');
conventionalRecommendedBump({
preset: 'angular',
config: {
headerPattern: /^\[(.*)\] (.*)$/,
headerCorrespondence: ['type', 'subject']
}
}, (error, recommendation) => {
console.log(recommendation.releaseType);
});
Using a custom parser
This feature allows you to use a custom parser for commit messages. The code sample shows how to pass custom parser options to the package.
const conventionalRecommendedBump = require('conventional-recommended-bump');
const customParserOpts = require('./custom-parser-opts');
conventionalRecommendedBump({
parserOpts: customParserOpts
}, (error, recommendation) => {
console.log(recommendation.releaseType);
});
semantic-release is an npm package that automates the versioning and package publishing process based on semantic versioning and conventional commit messages. It is more comprehensive than conventional-recommended-bump as it includes the entire release workflow, not just the recommendation for version bumps.
standard-version is an automated versioning tool that adheres to Semantic Versioning and uses conventional commit messages to determine version bumps. It is similar to conventional-recommended-bump but also handles the generation of changelogs and tagging of releases.
release-it is a generic CLI tool for automating versioning and package publishing. It supports conventional commits and can determine version bumps, but it also includes a wide range of release-related tasks, making it more versatile than conventional-recommended-bump.
Readme
Get a recommended version bump based on conventional commits.
Got the idea from https://github.com/conventional-changelog/conventional-changelog/pull/29
npm install conventional-recommended-bump
const conventionalRecommendedBump = require(`conventional-recommended-bump`);
conventionalRecommendedBump({
preset: `angular`
}, (error, recommendation) => {
console.log(recommendation.releaseType); // 'major'
});
npm install --global conventional-recommended-bump
conventional-recommended-bump --help
conventionalRecommendedBump(options, [parserOpts,] callback);
parserOpts
is optional.
In the case you don't want to provide parserOpts
, then callback
must be provided as the second argument.
options
is an object with the following properties:
Type: boolean
Default: true
If true
, reverted commits will be ignored.
Type: string
It's recommended to use a preset so you don't have to define everything yourself.
The value is passed to conventional-changelog-preset-loader
.
Type: object
This should serve as default values for other arguments of conventional-recommended-bump
so you don't need to rewrite the same or similar config across your projects.
NOTE: config
option will be overwritten by the value loaded by conventional-changelog-preset-loader
if the preset
options is set.
Type: function
A function that takes parsed commits as an argument.
whatBump(commits) {};
commits
is an array of all commits from last semver tag to HEAD
as parsed by conventional-commits-parser
This should return an object including but not limited to level
and reason
. level
is a number
indicating what bump it should be and reason
is the reason of such release.
Type: string
Specify a prefix for the git tag that will be taken into account during the comparison.
For instance if your version tag is prefixed by version/
instead of v
you would specifying --tagPrefix=version/
using the CLI, or version/
as the value of the tagPrefix
option.
Type: string
Specify the name of a package in a Lerna-managed repository. The package name will be used when fetching all changes to a package since the last time that package was released.
For instance if your project contained a package named conventional-changelog
, you could have only commits that have happened since the last release of conventional-changelog
was tagged by specifying --lernaPackage=conventional-changelog
using the CLI, or conventional-changelog
as the value of the lernaPackage
option.
Type: object
See the conventional-commits-parser documentation for available options.
Type: function
callback(error, recommendation) {};
recommendation
is an object
with a single property, releaseType
.
releaseType
is a string
: Possible values: major
, minor
and patch
, or undefined
if whatBump
does not return sa valid level
property, or the level
property is not set by whatBump
.
To assist users of conventional-recommended-bump
with debugging the behavior of this module we use the debug utility package to print information about the release process to the console. To enable debug message printing, the environment variable DEBUG
, which is the variable used by the debug
package, must be set to a value configured by the package containing the debug messages to be printed.
To print debug messages on a unix system set the environment variable DEBUG
with the name of this package prior to executing conventional-recommended-bump
:
DEBUG=conventional-recommended-bump conventional-recommended-bump
On the Windows command line you may do:
set DEBUG=conventional-recommended-bump
conventional-recommended-bump
We only support Long-Term Support versions of Node.
We specifically limit our support to LTS versions of Node, not because this package won't work on other versions, but because we have a limited amount of time, and supporting LTS offers the greatest return on that investment.
It's possible this package will work correctly on newer versions of Node. It may even be possible to use this package on older versions of Node, though that's more unlikely as we'll make every effort to take advantage of features available in the oldest LTS version we support.
As each Node LTS version reaches its end-of-life we will remove that version from the node
engines
property of our package's package.json
file. Removing a Node version is considered a breaking change and will entail the publishing of a new major version of this package. We will not accept any requests to support an end-of-life version of Node. Any merge requests or issues supporting an end-of-life version of Node will be closed.
We will accept code that allows this package to run on newer, non-LTS, versions of Node. Furthermore, we will attempt to ensure our own changes work on the latest version of Node. To help in that commitment, our continuous integration setup runs against all LTS versions of Node in addition the most recent Node release; called current.
JavaScript package managers should allow you to install this package with any version of Node, with, at most, a warning if your version of Node does not fall within the range specified by our node
engines
property. If you encounter issues installing this package, please report the issue to your package manager.
Please read our contributing guide to see how you may contribute to this project.
MIT © Steve Mao
FAQs
Get a recommended version bump based on conventional commits.
We found that conventional-recommended-bump demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 4 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Socket now supports four distinct alert actions instead of the previous two, and alert triaging allows users to override the actions taken for all individual alerts.
Security News
Polyfill.io has been serving malware for months via its CDN, after the project's open source maintainer sold the service to a company based in China.
Security News
OpenSSF is warning open source maintainers to stay vigilant against reputation farming on GitHub, where users artificially inflate their status by manipulating interactions on closed issues and PRs.