Generic CLI tool to automate versioning and package publishing-related tasks.
—
Release It!'s configuration system provides hierarchical configuration loading, validation, and context management. Configuration can be specified through CLI arguments, configuration files, package.json, and environment variables.
Main configuration management class with loading, merging, and context operations.
/**
* Configuration management class
* Handles loading, merging, and validation of configuration options
*/
class Config {
/**
* Create new configuration instance
* @param config - Initial configuration object
*/
constructor(config?: any);
/**
* Initialize configuration by loading from files and applying defaults
* Must be called before using other methods
*/
init(): Promise<void>;
/**
* Get configuration context with optional nested path
* @param path - Optional dot-notation path to nested value
* @returns Configuration value or entire context
*/
getContext(path?: string): any;
/**
* Set context options by merging with existing context
* @param options - Options to merge into context
*/
setContext(options: any): void;
/**
* Set CI mode flag
* @param value - CI mode boolean, defaults to true
*/
setCI(value?: boolean): void;
/** Get default configuration object */
get defaultConfig(): any;
/** Check if running in dry-run mode */
get isDryRun(): boolean;
/** Check if version should be incremented */
get isIncrement(): boolean;
/** Check if verbose output is enabled */
get isVerbose(): boolean;
/** Get verbosity level (0, 1, or 2) */
get verbosityLevel(): number;
/** Check if debug mode is enabled */
get isDebug(): boolean;
/** Check if running in CI environment */
get isCI(): boolean;
/** Check if only prompting for version */
get isPromptOnlyVersion(): boolean;
/** Check if only printing release version */
get isReleaseVersion(): boolean;
/** Check if only printing changelog */
get isChangelog(): boolean;
/** Get resolved configuration options */
get options(): any;
/** Get loaded local configuration */
get localConfig(): any;
}Release It! supports multiple configuration file formats and locations.
interface ConfigurationOptions {
/** Git plugin configuration */
git?: GitOptions;
/** npm plugin configuration */
npm?: NpmOptions;
/** GitHub plugin configuration */
github?: GitHubOptions;
/** GitLab plugin configuration */
gitlab?: GitLabOptions;
/** Version plugin configuration */
version?: VersionOptions;
/** Hook commands configuration */
hooks?: HooksOptions;
/** Plugin loading and configuration */
plugins?: PluginConfig;
}
interface GitOptions {
/** Enable/disable Git plugin */
disabled?: boolean;
/** Require clean working directory */
requireCleanWorkingDir?: boolean;
/** Required branch pattern */
requireBranch?: string | string[];
/** Require upstream branch */
requireUpstream?: boolean;
/** Require commits since last tag */
requireCommits?: boolean;
/** Include untracked files when staging */
addUntrackedFiles?: boolean;
/** Enable commit creation */
commit?: boolean;
/** Commit message template */
commitMessage?: string;
/** Additional commit arguments */
commitArgs?: string[];
/** Enable tag creation */
tag?: boolean;
/** Tag annotation template */
tagAnnotation?: string;
/** Additional tag arguments */
tagArgs?: string[];
/** Enable push to remote */
push?: boolean;
/** Push repository or URL */
pushRepo?: string;
/** Additional push arguments */
pushArgs?: string[];
}
interface NpmOptions {
/** Enable/disable npm plugin */
disabled?: boolean;
/** Skip registry and authentication checks */
skipChecks?: boolean;
/** Ignore version in package.json */
ignoreVersion?: boolean;
/** Enable/disable publishing */
publish?: boolean;
/** npm tag for published version */
tag?: string;
/** One-time password for 2FA */
otp?: string;
/** Registry timeout in seconds */
timeout?: number;
/** Additional npm version arguments */
versionArgs?: string[];
/** Allow same version in npm version */
allowSameVersion?: boolean;
/** Path to publish (defaults to current directory) */
publishPath?: string;
/** Additional npm publish arguments */
publishArgs?: string[];
}Configuration files are searched in the following order:
--config option.release-it.json.release-it.js.release-it.yaml.release-it.ymlpackage.json (release-it property)Usage Examples:
import { Config } from "release-it";
// Create and initialize configuration
const config = new Config({
increment: "minor",
"dry-run": true
});
await config.init();
// Get configuration values
const isDryRun = config.isDryRun;
const gitOptions = config.getContext("git");
const commitMessage = config.getContext("git.commitMessage");
// Set context for templates
config.setContext({
version: "1.2.0",
changelog: "Bug fixes and improvements"
});
// Enable CI mode
config.setCI(true);JSON Configuration (.release-it.json):
{
"git": {
"requireCleanWorkingDir": true,
"commitMessage": "Release ${version}",
"tagAnnotation": "Release ${version}\\n\\n${changelog}",
"push": true
},
"npm": {
"publish": true,
"skipChecks": false
},
"github": {
"release": true,
"assets": ["dist/*.zip"]
},
"hooks": {
"before:init": "npm test",
"after:release": "npm run deploy"
}
}Package.json Configuration:
{
"name": "my-package",
"version": "1.0.0",
"release-it": {
"git": {
"commitMessage": "chore: release v${version}"
},
"npm": {
"publish": false
}
}
}JavaScript Configuration (.release-it.js):
module.exports = {
git: {
requireCleanWorkingDir: false,
commitMessage: "Release ${version}",
push: true
},
npm: {
publish: true
},
hooks: {
"before:init": ["npm test", "npm run lint"],
"after:release": "echo Successfully released ${version}"
}
};Configuration can be influenced by environment variables:
CI=true - Enables CI mode automaticallyNODE_DEBUG=release-it - Enables debug outputRelease It! supports configuration inheritance through the extends property:
{
"extends": "@company/release-config",
"git": {
"push": false
}
}Install with Tessl CLI
npx tessl i tessl/npm-release-it