Back to Release It

Configuration

docs/configuration.md

20.0.13.1 KB
Original Source

Configuration

Out of the box, release-it has sane defaults. See the configuration options to configure it.

Put only the options to override in a configuration file. Here is a list of file names where release-it looks for configuration in the root of the project:

  • .release-it.json
  • .release-it.ts
  • .release-it.js (or .cjs; export the configuration object: module.exports = {})
  • .release-it.yaml (or .yml)
  • .release-it.toml
  • package.json (in the release-it property)

Use --config path/release-it.json to use another configuration file location.

An example .release-it.json:

json
{
  "$schema": "https://unpkg.com/release-it@20/schema/release-it.json",
  "git": {
    "commitMessage": "chore: release v${version}"
  },
  "github": {
    "release": true
  }
}

The configuration can also be stored in a release-it property in package.json:

json
{
  "name": "my-package",
  "devDependencies": {
    "release-it": "*"
  },
  "release-it": {
    "github": {
      "release": true
    }
  }
}

Typescript config files are supported, providing typing hints to the config:

ts
import type { Config } from 'release-it';

export default {
  git: {
    commit: true,
    tag: true,
    push: true
  },
  github: {
    release: true
  },
  npm: {
    publish: true
  }
} satisfies Config;

Or, use YAML in .release-it.yml:

yaml
git:
  requireCleanWorkingDir: false

TOML is also supported in .release-it.toml:

toml
[hooks]
"before:init" = "npm test"

Configuration options

Release-it has plenty of options. See the following tables for plugin configuration options:

Extend Configuration

You can extend a configuration from a remote source using the extends option. The following formats are supported:

  • github:owner/repo: Get the config from the default branch (main) in the repo at Github.
  • github:owner/repo#tag: Get the config from the specified tag in the repo at Github.
  • github:owner/repo:subdir#tag: Get the config from the specified tag in the repo sub dir at Github.

And support other schema, either gitlab:, bitbucket:, or https:.

For example, to extend a configuration from a GitHub repository:

json
{
  "$schema": "https://unpkg.com/release-it@20/schema/release-it.json",
  "extends": "github:release-it/release-it-configuration"
}

Get more information at c12 documents.

Setting options via CLI

Any option can also be set on the command-line, and will have highest priority. Example:

bash
release-it minor --git.requireBranch=main --github.release

Boolean arguments can be negated by using the no- prefix:

bash
release-it --no-npm.publish

Also plugin options can be set from the command line:

bash
release-it --no-plugins.@release-it/keep-a-changelog.strictLatest