Security News
JSR Working Group Kicks Off with Ambitious Roadmap and Plans for Open Governance
At its inaugural meeting, the JSR Working Group outlined plans for an open governance model and a roadmap to enhance JavaScript package management.
release-it
Advanced tools
Interactive release tool for Git repositories. Increment version, commit, tag, push, build, publish to npm. Supports to build and release to a distribution/component repository.
release-it is a versatile command-line tool for automating versioning and package publishing. It simplifies the release process by handling version bumps, changelogs, Git tags, and publishing to npm and other platforms.
Version Bumping
Automatically bumps the version of your project. In this example, it bumps the minor version.
release-it minor
Changelog Generation
Generates a changelog based on the commits since the last release.
release-it --changelog
Git Tagging
Creates a new Git tag for the release.
release-it --git.tag
NPM Publishing
Publishes the package to the npm registry.
release-it --npm.publish
Custom Hooks
Allows you to define custom hooks to run at various points in the release process.
{ "hooks": { "before:init": "echo 'This is a custom hook'" } }
standard-version is a tool for versioning and changelog generation based on conventional commits. It focuses on standardizing the release process and is less customizable compared to release-it.
semantic-release automates the versioning and package publishing process based on the commit history. It is highly configurable and integrates with CI/CD pipelines, making it more suitable for complex workflows compared to release-it.
lerna is a tool for managing JavaScript projects with multiple packages. It can handle versioning and publishing for monorepos, offering more advanced features for multi-package repositories compared to release-it.
Interactive release tool for Git repositories. Options: run build command first, release to distribution repository (or branch), create GitHub release, publish to npm.
Automatically bump version, commit, tag, push, done.
Here's an extended article about Using Release It!
Obviously, Release It has released itself. Cool, heh?! There's also a Grunt plugin.
npm install release-it -g
Release a new patch (increments from e.g. 1.0.4
to 1.0.5
):
release-it
Release a patch, minor, major, or specific version:
release-it minor
release-it 0.8.3
release-it 2.0.0-rc.3
Create a pre-release using prerelease
, prepatch
, preminor
, or premajor
:
release-it premajor --prereleaseId="beta"
release-it premajor
The first example would increment from e.g. 1.0.6
to 2.0.0-beta.0
, the second from 2.0.0-beta.0
to 2.0.0-beta.1
.
See node-semver for more details.
You can also do a "dry run", which won't write/touch anything, but does output the commands it would execute, and show the interactivity:
release-it --dry-run
For automation and CI purposes, you can use the "non-interactive" mode:
release-it --non-interactive
Release It can do a lot out-of-the-box, but has plenty of options to configure it. The basics:
$ release-it --help
Release It! v2.7.0
Usage: release <increment> [options]
Use e.g. "release minor" directly as shorthand for "release --increment=minor".
Options:
-c, --config Path to local configuration options [default: ".release.json"]
-d, --dry-run Do not touch or write anything, but show the commands and interactivity
-e, --debug Output exceptions
-f, --force Force tagging with Git
-h, --help Print help
-i, --increment Increment "major", "minor", "patch", or "pre*" version; or specify version [default: "patch"]
-m, --message Commit message [default: "Release %s"]
-n, --non-interactive No interaction (assume default answers to questions)
--prereleaseId Identifier for pre-releases (e.g. "beta" in "1.0.0-beta.1")
-p, --npm.publish Auto-publish to npm (only relevant in --non-interactive mode)
--npm.tag Register published package with given tag (default: "latest")
-v, --version Print version number
-V, --verbose Verbose output
All default settings below can be overridden by your own config file.
Put a .release.json
file in your project root, and Release It will pick it up.
You can use --config
if you want to use another path.
Options can also be set on the command-line (these will have highest priority). Example:
release-it minor --src.tagName='v%s' --github.release
Here is the full list of settings:
{
"non-interactive": false,
"dry-run": false,
"verbose": false,
"force": false,
"pkgFiles": ["package.json"],
"increment": "patch",
"prereleaseId": null,
"buildCommand": false,
"changelogCommand": "git log --pretty=format:\"* %s (%h)\" [REV_RANGE]",
"requireCleanWorkingDir": false,
"src": {
"commitMessage": "Release %s",
"tagName": "%s",
"tagAnnotation": "Release %s",
"pushRepo": null,
"beforeStartCommand": false,
"beforeStageCommand": false,
"afterReleaseCommand": false,
"githubAssets": false
},
"dist": {
"repo": false,
"stageDir": ".stage",
"baseDir": "dist",
"files": ["**/*"],
"pkgFiles": null,
"commitMessage": "Release %s",
"tagName": "%s",
"tagAnnotation": "Release %s",
"beforeStageCommand": false,
"afterReleaseCommand": false,
"githubAssets": false
},
"npm": {
"publish": false,
"publishPath": ".",
"tag": "latest",
"private": false,
"forcePublishSourceRepo": false
},
"github": {
"release": false,
"releaseName": "Release %s",
"preRelease": false,
"draft": false,
"tokenRef": "GITHUB_TOKEN"
},
"prompt": {
"src": {
"status": false,
"commit": true,
"tag": true,
"push": true,
"release": true,
"publish": false
},
"dist": {
"status": false,
"commit": true,
"tag": true,
"push": true,
"release": true,
"publish": false
}
}
}
Notes:
"private": true
setting in package.json will be respected and you will not be bothered with the question to publish to npm.src.pushRepo
has a falsey value, the default git push
is used when pushing to the remote.
Otherwise, it's the url or name of a remote as in git push <src.pushRepo>
.dist.pkgFiles
has a falsey value, it will take the value of pkgFiles
.prompt
booleans represent the default answers to the interactive questions.The command hooks are executed from the directory of the src
or dist
repository, respectively:
src.beforeStartCommand
- before version bumpsrc.beforeStageCommand
and dist.beforeStageCommand
- before buildCommand
buildCommand
- before files are staged for commitsrc.afterReleaseCommand
and dist.afterReleaseCommand
- after release/publish stepsAll commands can use configuration variables (like template strings):
"buildCommand": "tar -czvf foo-${src.tagName}.tar.gz ",
"afterReleaseCommand": "echo Successfully released ${version} to ${dist.repo}."
Some projects use a special distribution repository. There might be multiple reasons to do.
Notes:
dist.repo
to a git endpoint (e.g. "git@github.com:components/ember.git"
).#
notation (e.g. "git@github.com:webpro/release-it.git#gh-pages"
).dist.repo
, but still want to publish the source repository to npm, make sure to set "forcePublishSourceRepo": true
.The tool assumes you've configured your SSH keys and remotes correctly. In case you need to configure things for GitHub, the following pages might be of help.
To create GitHub releases,
you'll need to set github.release
to true
,get a GitHub access token,
and make this available as the environment variable defined with github.tokenRef
. You can set it like this:
export GITHUB_TOKEN="f941e0..."
In non-interactive mode, the release is created only for the source repository.
To keep you in control, many steps need your confirmation before execution. This is what happens if you answer "Yes" to each question:
With the current repository:
pkgFiles
.buildCommand
provided? Clean dist.baseDir
and execute the buildCommand
.src.commitMessage
(%s
is replaced with the new version).src.tagName
(and src.tagAnnotation
).github.releaseName
and output of changelogCommand
).dist.repo
? Publish package to npm.Additionally, if a distribution repository is configured:
dist.repo
in dist.stageDir
.dist.files
from dist.baseDir
to dist.repo
.dist.pkgFiles
, commit, tag, push dist.repo
.github.releaseName
and output of changelogCommand
).Major dependencies:
The following Grunt plugins have been a source of inspiration:
Why did I need to create yet another "release" tool/plugin? I think this tool stands out:
FAQs
Generic CLI tool to automate versioning and package publishing-related tasks.
The npm package release-it receives a total of 385,952 weekly downloads. As such, release-it popularity was classified as popular.
We found that release-it demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer 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.
Security News
At its inaugural meeting, the JSR Working Group outlined plans for an open governance model and a roadmap to enhance JavaScript package management.
Security News
Research
An advanced npm supply chain attack is leveraging Ethereum smart contracts for decentralized, persistent malware control, evading traditional defenses.
Security News
Research
Attackers are impersonating Sindre Sorhus on npm with a fake 'chalk-node' package containing a malicious backdoor to compromise developers' projects.