Socket
Socket
Sign inDemoInstall

release-it

Package Overview
Dependencies
13
Maintainers
1
Versions
393
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.0.0 to 2.0.0

lib/cli.js

19

bin/release.js

@@ -6,7 +6,18 @@ #!/usr/bin/env node

var exitCode = 0,
isDebug = args.indexOf('--debug') !== -1;
release.cli(args).then(function() {
process.exit(0);
}, function(error) {
console.error(error);
process.exit(1);
process.exit(exitCode);
}).catch(function(err) {
exitCode = 1;
if(!isDebug) {
console.error(error);
} else {
throw new Error(err);
}
});
process.on('exit', function() {
process.exit(exitCode);
});

@@ -12,14 +12,21 @@ {

"buildCommand": false,
"distRepo": false,
"distStageDir": ".stage",
"distBase": "dist",
"distFiles": ["**/*"],
"private": false,
"publish": false,
"publishPath": ".",
"forcePublishSourceRepo": false,
"githubTokenRef": "GITHUB_TOKEN",
"githubRelease": false,
"githubReleaseName": "Release %s",
"githubReleaseBodyCommand": "git log --pretty=format:'* %s (%h)' [REV_RANGE]"
"changelogCommand": "git log --pretty=format:'* %s (%h)' [REV_RANGE]",
"dist": {
"repo": false,
"stageDir": ".stage",
"baseDir": "dist",
"files": ["**/*"],
"pkgFiles": null
},
"npm": {
"publish": false,
"publishPath": ".",
"private": false,
"forcePublishSourceRepo": false
},
"github": {
"release": false,
"releaseName": "Release %s",
"tokenRef": "GITHUB_TOKEN"
}
}
var path = require('path'),
_ = require('lodash'),
util = require('./util');
deprecated = require('./deprecated');

@@ -24,2 +24,4 @@ var DEFAULT_CONFIG_PATH = path.resolve(__dirname, '..', 'conf', 'release.json'),

localOptions.pkgFiles = _.isArray(localOptions.pkgFiles) && localOptions.pkgFiles.length === 0 ? false : localOptions.pkgFiles;
return localOptions;

@@ -29,3 +31,3 @@

function getPackageOptions() {
function getNpmPackageOptions() {

@@ -37,3 +39,3 @@ var pkg = {};

} catch(error) {
throw new Error('Cannot find required file: ' + LOCAL_PACKAGE_PATH);
pkg = {};
}

@@ -44,3 +46,2 @@

name: pkg.name,
repository: pkg.repository,
private: pkg.private

@@ -57,18 +58,19 @@ }

var config = {};
var config = {},
_process = {};
config.mergeOptions = function(options) {
this.options = options;
var localOptions = getLocalOptions(options.config),
packageOptions = getPackageOptions(),
npmPackageOptions = getNpmPackageOptions(),
defaultOptions = getDefaultOptions();
var mergedOptions = _.defaultsDeep({}, options, localOptions, packageOptions, defaultOptions);
var mergedOptions = _.defaultsDeep({}, options, localOptions, {npm: npmPackageOptions}, defaultOptions);
mergedOptions.version = util.increment(packageOptions.version, options.increment);
mergedOptions.name = npmPackageOptions.name || path.basename(process.cwd());
mergedOptions.verbose = options['non-interactive'] || mergedOptions.verbose;
mergedOptions = deprecated(mergedOptions);
return (this.options = mergedOptions);

@@ -98,2 +100,11 @@

config.process = Object.create({
get: function(key) {
return _process[key]
},
set: function(key, value) {
_process[key] = value;
}
});
module.exports = Object.create(config);
var util = require('./util'),
config = require('./config'),
inquirer = require('inquirer'),

@@ -7,7 +8,10 @@ when = require('when'),

function shouldPublish(options, subject) {
var hasDistRepo = !!options.distRepo;
var hasDistRepo = !!options.dist.repo;
if(!options.npm.name || !options.npm.version) {
return false;
}
if(subject === 'src') {
return !hasDistRepo || options.forcePublishSourceRepo;
return !hasDistRepo || options.npm.forcePublishSourceRepo;
}
return !options.forcePublishSourceRepo && hasDistRepo;
return !options.npm.forcePublishSourceRepo && hasDistRepo;
}

@@ -34,3 +38,6 @@

message: 'Commit (' + util.format(options.commitMessage, options.version) + ')?',
default: true
default: true,
when: function() {
return config.process.get('has_changes') !== false;
}
},

@@ -61,6 +68,6 @@ task: tasks.commit

name: 'release',
message: 'Create a release on GitHub (' + util.format(options.githubReleaseName, options.version) + ')?',
default: false,
message: 'Create a release on GitHub (' + util.format(options.github.releaseName, options.version) + ')?',
default: true,
when: function(answers) {
return options.githubRelease
return options.github.release
}

@@ -77,3 +84,3 @@ },

when: function() {
return !options.private && shouldPublish(options, subject);
return !options.npm.private && shouldPublish(options, subject);
}

@@ -80,0 +87,0 @@ },

@@ -11,18 +11,29 @@ var util = require('./util'),

var commitRefRe = /#.+$/,
var noop = when.resolve(true),
commitRefRe = /#.+$/,
_githubClient = null;
function isGitRepo() {
return run('git', 'rev-parse --git-dir');
return run('!git', 'rev-parse --git-dir');
}
function hasChanges() {
function getRemoteUrl() {
return run('!git', 'config --get remote.origin.url').then(function(result) {
if(result && result.output) {
return result.output.trim();
}
throw new Error('Could not get remote Git url.');
});
}
function hasChanges(repo) {
// Inverted: reject if run promise is resolved (i.e. `git diff-index` returns exit code 0)
return when.promise(function(resolve, reject) {
return run(
'git',
'diff-index --name-only HEAD --exit-code'
).then(config.isForce() || config.isDryRun() ? resolve : reject, resolve);
}).catch(function() {
throw new Error('No changes to release. Use --force to override.');
return when.promise(function(resolve) {
run('!git', 'diff-index --name-only HEAD --exit-code').then(function() {
if(!config.isDryRun()) {
config.process.set('has_changes', false);
log.warn('Nothing to commit in ' + repo + ' repo. The latest commit will be tagged.');
}
resolve();
}).catch(resolve);
});

@@ -38,12 +49,19 @@ }

run.bind(null, 'git', 'clone', repo, '-b', branch, '--single-branch', dir)
])
]);
}
function stage(file) {
var files = typeof file === 'string' ? file : file.join(' ');
return run('git', 'add', files);
if(file) {
var files = typeof file === 'string' ? file : file.join(' ');
return run('git', 'add', files).catch(function(error) {
log.warn('Could not stage ' + file);
})
} else {
return noop;
}
}
function stageAll() {
return run('git', 'add . --all');
function stageDir(baseDir) {
baseDir = baseDir || '.';
return run('git', util.format('add %s --all', baseDir));
}

@@ -54,3 +72,3 @@

return run(
'git',
'!git',
'status --short --untracked-files=no'

@@ -71,3 +89,6 @@ ).then(function(result) {

path
)
).catch(function(err) {
log.debug(err);
log.warn('Nothing to commit. The latest commit will be tagged.');
})
}

@@ -85,10 +106,20 @@

).catch(function() {
throw new Error('Unable to tag. Does tag "' + version + '" already exist? Use --force to move a tag.');
throw new Error('Could not tag. Does tag "' + version + '" already exist? Use --force to move a tag.');
});
}
function getLatestTag() {
return run('!git', 'describe --tags --abbrev=0').then(function(result) {
var latestTag = result && result.output ? result.output.trim() : null;
config.process.set('prevVersion', latestTag);
return latestTag;
});
}
function push(repository) {
tracker._track('git', 'push');
return run('git', 'push').catch(function(err) {
log.error('Please make sure an upstream remote repository is configured for the current branch. Example commands:\ngit remote add origin ' + (repository.url ? repository.url : '[GIT_REPO_URL]') + '\ngit push --set-upstream origin master');
log.error('Please make sure an upstream remote repository is configured for the current branch. Example commands:\n' +
'git remote add origin ' + repository + '\n' +
'git push --set-upstream origin master');
throw new Error(err);

@@ -108,3 +139,3 @@ })

function initGithubClient(githubTokenRef) {
function initGithubClient() {
if(!_githubClient) {

@@ -124,3 +155,3 @@ _githubClient = new GitHubApi({

type: 'oauth',
token: process.env[githubTokenRef]
token: config.process.get('github_token')
});

@@ -131,22 +162,36 @@ }

function release(options) {
tracker._track('git', 'release');
function getGithubToken(tokenRef) {
var token = process.env[tokenRef];
config.process.set('github_token', token);
return token;
}
var repo = repoPathParse(options.repository.url),
body = when.resolve({result: ''});
if(options.githubReleaseBodyCommand) {
body = run('git describe --tags --abbrev=0 HEAD^1').then(function(result) {
var previousTag = result.output.trim(),
command = options.githubReleaseBodyCommand.replace(/\[REV_RANGE\]/, previousTag + '...' + util.format(options.tagName, options.version) + '^1');
return run(command);
});
function getChangelog(options) {
if(options.changelogCommand) {
var prevTag = config.process.get('prevVersion') || options.prevVersion,
command = options.changelogCommand.replace(/\[REV_RANGE\]/, prevTag + '...HEAD');
return run(command).then(function(result) {
config.process.set('changelog', result.output);
return options;
}).catch(function(err) {
log.warn('Probably the current version in package.json is not a known tag in the repository.');
throw new Error('Could not create changelog from latest tag (' + prevTag + ') to HEAD.');
})
} else {
return noop;
}
}
return body.then(function(result) {
function release(options, remoteUrl) {
//tracker._track('git', 'release');
var githubClient = initGithubClient(options.githubTokenRef),
success = false,
attempts = 3;
var repo = repoPathParse(remoteUrl);
log.execution('node-github releases#createRelease', util.format('%s/%s', repo.owner, repo.repo));
var githubClient = initGithubClient(),
success = false,
attempts = 3;
if(!config.isDryRun()) {
return when.iterate(function(attempt) {

@@ -162,9 +207,12 @@ return attempt + 1;

tag_name: util.format(options.tagName, options.version),
name: util.format(options.githubReleaseName, options.version),
body: result.output
}, function(err, result) {
name: util.format(options.github.releaseName, options.version),
body: config.process.get('changelog')
}, function(err, response) {
if(err) {
log.warn(err.message + ' (Attempt ' + attempt + ' of ' + attempts);
var errObj = JSON.parse(err.message);
log[attempt + 1 < attempts ? 'warn' : 'error'](errObj.message + ' (Attempt ' + (attempt + 1) + ' of ' + attempts + ')');
log[attempt + 1 < attempts ? 'warn' : 'error'](errObj.errors[0].message);
} else {
log.execution('node-github', result.meta.location, result.tag_name, result.name);
log.execution('node-github', response.meta.location, response.tag_name, response.name);
log.verbose(response.body);
success = true;

@@ -176,3 +224,5 @@ }

}, 0);
});
} else {
return noop;
}
}

@@ -182,12 +232,16 @@

isGitRepo: isGitRepo,
getRemoteUrl: getRemoteUrl,
status: status,
clone: clone,
stage: stage,
stageAll: stageAll,
stageDir: stageDir,
commit: commit,
tag: tag,
getLatestTag: getLatestTag,
push: push,
pushTags: pushTags,
getChangelog: getChangelog,
getGithubToken: getGithubToken,
release: release,
hasChanges: hasChanges
};

@@ -1,9 +0,10 @@

var chalk = require('chalk'),
var util = require('util'),
chalk = require('chalk'),
config = require('./config');
function log(message) {
function log() {
console.log.apply(console, arguments);
}
function bold(message) {
function bold() {
log(chalk.bold.apply(chalk, arguments));

@@ -23,10 +24,8 @@ }

function dir(obj) {
for(var prop in obj) {
log(prop + ':', obj[prop]);
}
log(util.inspect(obj));
}
function verbose(message) {
function verbose() {
if(config.isVerbose()) {
log.apply(this, arguments);
log.apply(null, arguments);
}

@@ -41,5 +40,5 @@ }

function debug(message) {
function debug() {
if(config.isDebug()) {
log.apply(this, arguments);
log.apply(null, arguments);
}

@@ -66,3 +65,3 @@ }

verbose: verbose,
verbosedir: verboseDir,
verboseDir: verboseDir,
debug: debug,

@@ -69,0 +68,0 @@ debugDir: debugDir,

@@ -1,27 +0,25 @@

var cliOptions = require('./options'),
var cli = require('./cli'),
log = require('./log'),
config = require('./config'),
tasks = require('./tasks'),
sequence = require('when/sequence'),
tracker = require('./tracker');
function cli(options) {
var opts = cliOptions.parse(options);
return execute(opts);
function fromCli(options) {
return execute(cli.parse(options));
}
function execute(options) {
function execute(cliArgs) {
var opts = config.mergeOptions(options);
var options = config.mergeOptions(cliArgs);
return tracker._askPermission(opts).then(function() {
return tracker.askPermissionAndTrack(options).then(function() {
if(options.version) {
if(cliArgs.version) {
cliOptions.version();
cli.version();
tracker._track('version');
} else if(options.help) {
} else if(cliArgs.help) {
cliOptions.help();
cli.help();
tracker._track('help');

@@ -31,13 +29,13 @@

if(opts.force) {
if(options.force) {
log.warn('Using --force, I sure hope you know what you are doing.');
}
if(opts.debug) {
if(options.debug) {
require('when/monitor/console');
}
log.debugDir(opts);
log.debugDir(options);
return sequence([tasks.releaseSrc, tasks.releaseDist]);
return tasks.run(options);

@@ -58,4 +56,4 @@ }

module.exports = {
cli: cli,
cli: fromCli,
execute: execute
};

@@ -13,6 +13,9 @@ var path = require('path'),

var forcedCmdRe = /^!/;
function run(command, commandArgs) {
var shellCommand = getShellCommand(command),
var shellCommand = getShellCommand(command.replace(forcedCmdRe, '')),
cmd = [].slice.call(arguments).join(' '),
normalizedCmd = cmd.replace(forcedCmdRe, ''),
args = [].slice.call(arguments, 1),

@@ -23,5 +26,5 @@ silentState = shell.config.silent;

log.execution(cmd);
log.execution(normalizedCmd);
if (config.isDryRun()) {
if (normalizedCmd === cmd && config.isDryRun()) {
return noop;

@@ -34,3 +37,3 @@ }

shell.exec(cmd, function(code, output) {
shell.exec(normalizedCmd, function(code, output) {
if (code === 0) {

@@ -97,4 +100,6 @@ resolve({

function bump(file, version) {
log.execution('bump', file, version);
if (!config.isDryRun()) {
if(file) {
log.execution('bump', file, version);
}
if (!config.isDryRun() && file !== false) {
var files = typeof file === 'string' ? [file] : file;

@@ -107,3 +112,3 @@ return when.map(files, function(file) {

}, function(err) {
log.warn('There was a problem reading ' + file);
log.warn('Could not read ' + (err.path || file));
log.debug(err);

@@ -115,3 +120,3 @@ }).then(function(data) {

}).catch(function(err) {
log.warn('There was a problem bumping the version in ' + file);
log.warn('Could not bump version in ' + file);
log.debug(err);

@@ -118,0 +123,0 @@ });

var _ = require('lodash'),
shell = require('./shell'),
log = require('./log'),
config = require('./config'),
git = require('./git'),
enquiry = require('./enquiry'),
when = require('when'),
util = require('./util'),
sequence = require('when/sequence'),
noop = when.resolve.bind(when, true);
function releaseSourceRepo() {
function parseVersion(options) {
var version = util.isValidVersion(options.increment) ? options.increment : options.npm.version;
if(!version) {
return git.getLatestTag().then(function(tag) {
if(tag) {
var nextVersion = util.increment(tag, options.increment);
log.bold(util.format('Latest tag: %s. Next version: %s', tag, nextVersion));
options.version = nextVersion;
return options;
} else {
throw new Error('Error detecting current version from latest tag.');
}
}).catch(function(err) {
console.log(err);
throw new Error('No version provided. Please provide version argument, or make sure there is a tag to derive it from.');
});
} else {
options.prevVersion = version;
options.version = util.increment(version, options.increment);
return options;
}
}
function getRemoteGitUrl(options) {
return git.getRemoteUrl().then(function(remoteUrl) {
options.remoteUrl = remoteUrl;
return options;
}).catch(function(err) {
throw new Error('Unable to get remote Git url.')
});
}
function getChangelog(options) {
if(options.github.release) {
return git.getChangelog(options);
} else {
return options;
}
}
function checkGithubToken(options) {
if(options.github.release) {
var token = git.getGithubToken(options.github.tokenRef);
if(!token) {
throw new Error('About to release to GitHub, but ' + options.github.tokenRef + ' environment variable not set');
}
}
return options;
}
function releaseSourceRepo(options) {
log.bold('Release source repo');
var options = config.getOptions(),
repo = getSrcRepoTasks(options);
var repo = getSrcRepoTasks(options);

@@ -21,8 +74,9 @@ var executeTasks = [

repo.bump,
repo.build,
repo.stage,
repo.hasChanges,
repo.build
repo.stageDir,
repo.hasChanges
];
if(options.distRepo) {
if(options.dist.repo) {
// Before committing to src repo, do some potentially problematic dist repo tasks.

@@ -32,2 +86,7 @@ var distRepoTasks = getDistRepoTasks(options);

executeTasks.push(distRepoTasks.copy);
executeTasks.push(distRepoTasks.pushd);
executeTasks.push(distRepoTasks.bump);
executeTasks.push(distRepoTasks.stageDir);
executeTasks.push(distRepoTasks.hasChanges);
executeTasks.push(distRepoTasks.popd);
}

@@ -56,9 +115,8 @@

function releaseDistRepo() {
function releaseDistRepo(options) {
var options = config.getOptions(),
repo = getDistRepoTasks(options);
var repo = getDistRepoTasks(options);
if(!options.distRepo) {
log.verbose('No Git endpoint provided for `distRepo` (distribution repository).');
if(!options.dist.repo) {
log.verbose('No distRepo provided, done.');
return noop();

@@ -70,6 +128,3 @@ }

var executeTasks = [
repo.pushd,
repo.bump,
repo.stageAll,
repo.hasChanges
repo.pushd
];

@@ -102,9 +157,8 @@

isRepo: git.isGitRepo,
hasChanges: git.hasChanges,
build: shell.build.bind(null, options.buildCommand, options.distBase),
build: shell.build.bind(null, options.buildCommand, options.dist.baseDir),
status: git.status,
stageAll: git.stageAll,
stageDir: git.stageDir,
commit: git.commit.bind(null, '.', options.commitMessage, options.version),
tag: git.tag.bind(null, options.version, options.tagName, options.tagAnnotation),
push: git.push.bind(null, options.repository),
push: git.push.bind(null, options.remoteUrl),
pushTags: git.pushTags,

@@ -117,3 +171,4 @@ popd: shell.popd

var isPublish = !(options['non-interactive'] && !options.publish) && !options.distRepo;
var isStageBuildDir = !!options.buildCommand && !options.dist.repo,
isPublish = !(options['non-interactive'] && !options.publish) && !options.dist.repo;

@@ -123,3 +178,5 @@ return _.extend({}, getGenericTasks(options), {

stage: git.stage.bind(null, options.pkgFiles),
release: options.githubRelease ? git.release.bind(null, options) : noop,
stageDir: isStageBuildDir ? git.stageDir.bind(null, options.dist.baseDir) : noop,
hasChanges: git.hasChanges.bind(null, 'source'),
release: options.github.release ? git.release.bind(null, options, options.remoteUrl) : noop,
publish: isPublish ? shell.npmPublish : noop

@@ -131,11 +188,12 @@ });

var isPublish = !(options['non-interactive'] && !options.publish) && !!options.distRepo,
distPkgFiles = options.distPkgFiles || options.pkgFiles;
var isPublish = !(options['non-interactive'] && !options.publish) && !!options.dist.repo,
distPkgFiles = options.dist.pkgFiles || options.pkgFiles;
return _.extend({}, getGenericTasks(options), {
bump: shell.bump.bind(null, distPkgFiles, options.version),
clone: git.clone.bind(null, options.distRepo, options.distStageDir),
copy: shell.copy.bind(null, options.distFiles, {cwd: options.distBase}, options.distStageDir),
pushd: shell.pushd.bind(null, options.distStageDir),
release: options.githubRelease ? git.release.bind(null, options) : noop,
hasChanges: git.hasChanges.bind(null, 'dist'),
clone: git.clone.bind(null, options.dist.repo, options.dist.stageDir),
copy: shell.copy.bind(null, options.dist.files, {cwd: options.dist.baseDir}, options.dist.stageDir),
pushd: shell.pushd.bind(null, options.dist.stageDir),
release: options.github.release ? git.release.bind(null, options, options.dist.repo) : noop,
publish: isPublish ? shell.npmPublish : noop

@@ -146,4 +204,12 @@ });

module.exports = {
releaseSrc: releaseSourceRepo,
releaseDist: releaseDistRepo
run: function(options) {
return sequence([
parseVersion,
getRemoteGitUrl,
getChangelog,
checkGithubToken,
releaseSourceRepo,
releaseDistRepo
], options)
}
};

@@ -13,4 +13,4 @@ var Insight = require('insight'),

this._options.increment,
this._options.distRepo ? 'distRepo' : 'no-distRepo',
this._options.private ? 'private' : 'public'
this._options.dist.repo ? 'distRepo' : 'no-distRepo',
this._options.npm.private ? 'private' : 'public'
);

@@ -32,3 +32,3 @@ }

Insight.prototype._askPermission = function(options) {
Insight.prototype.askPermissionAndTrack = function(options) {
this._options = options;

@@ -35,0 +35,0 @@ return when.promise(function(resolve) {

var util = require('util'),
semver = require('semver');
function isValidVersion(value) {
return semver.valid(value);
}
function increment(version, increment) {

@@ -17,3 +21,3 @@ increment = increment || 'patch';

} else {
return util.format(template, replacements);
return util.format.apply(null, arguments);
}

@@ -23,4 +27,5 @@ }

module.exports = {
isValidVersion: isValidVersion,
increment: increment,
format: format
};
{
"name": "release-it",
"version": "1.0.0",
"version": "2.0.0",
"description": "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.",

@@ -35,3 +35,3 @@ "keywords": [

"dependencies": {
"chalk": "^1.1.0",
"chalk": "^1.1.1",
"github": "^0.2.4",

@@ -43,3 +43,3 @@ "glob": "^5.0.14",

"lodash": "^3.10.1",
"minimist": "^1.1.3",
"minimist": "^1.2.0",
"mkdirp": "^0.5.1",

@@ -46,0 +46,0 @@ "repo-path-parse": "^1.0.1",

# Release It!
Interactive release tool for Git repositories. Publish to npm. Optionally build and release to a distribution/component repository.
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, publish, done.
Automatically bump version, commit, tag, push, done.
Here's an extended article about [Using Release It!](https://medium.com/@webprolific/using-release-it-60b96515c073)
![Release-It](https://webpro.github.com/release-it/Release-It.gif)

@@ -48,3 +50,3 @@

```bash
release-it --githubReleaseName="Awesome Ants"
release-it --github.releaseName="Awesome Ants"
```

@@ -60,3 +62,3 @@

$ release --help
Release It! v1.0.0
Release It! v2.0.0

@@ -75,3 +77,3 @@ Usage: release <increment> [options]

-n, --non-interactive No interaction (assume default answers to questions)
-p, --publish Publish to npm (only in --non-interactive mode)
-p, --npm.publish Publish to npm (only in --non-interactive mode)
-v, --version Print version number

@@ -95,15 +97,21 @@ -V, --verbose Verbose output

"buildCommand": false,
"distRepo": false,
"distPkgFiles": null, /* Defaults to pkgFiles */
"distStageDir": ".stage",
"distBase": "dist",
"distFiles": ["**/*"],
"private": false,
"publish": false,
"publishPath": ".",
"forcePublishSourceRepo": false,
"githubTokenRef": "GITHUB_TOKEN",
"githubRelease": false,
"githubReleaseName": "Release %s",
"githubReleaseBodyCommand": "git log --pretty=format:'* %s (%h)' [REV_RANGE]"
"changelogCommand": "git log --pretty=format:'* %s (%h)' [REV_RANGE]",
"dist": {
"repo": false,
"stageDir": ".stage",
"baseDir": "dist",
"files": ["**/*"],
"pkgFiles": null
},
"npm": {
"publish": false,
"publishPath": ".",
"private": false,
"forcePublishSourceRepo": false
},
"github": {
"release": false,
"releaseName": "Release %s",
"tokenRef": "GITHUB_TOKEN"
}
}

@@ -122,5 +130,5 @@ ```

* To release to a separate "distribution repo", set `distRepo` to a git endpoint (e.g. `"git@github.com:components/ember.git"`).
* To release to a separate "distribution repo", set `dist.repo` to a git endpoint (e.g. `"git@github.com:components/ember.git"`).
* Note that this can also be a branch, possibly of the same source repository, using `#` notation (e.g. `"git@github.com:webpro/release-it.git#gh-pages"`).
* In case you want to update `distRepo`, but still want to publish the source repository to npm, make sure to set `"forcePublishSourceRepo": true`.
* In case you want to update `dist.repo`, but still want to publish the source repository to npm, make sure to set `"forcePublishSourceRepo": true`.

@@ -138,3 +146,3 @@ ### GitHub

To create [GitHub releases](https://help.github.com/articles/creating-releases/), you'll need to set `githubRelease` to `true`, get a [GitHub access token](https://github.com/settings/tokens), and make this available as the environment variable defined with `githubTokenRef`. With the default settings, you could set it like this:
To create [GitHub releases](https://help.github.com/articles/creating-releases/), you'll need to set `github.release` to `true`, get a [GitHub access token](https://github.com/settings/tokens), and make this available as the environment variable defined with `github.tokenRef`. With the default settings, you could set it like this:

@@ -145,4 +153,6 @@ ```bash

### Local overrides
In non-interactive mode, the release is created only for the source repository.
### Local configuration file
Place a `.release.json` file in your project root, and **Release It** will use it to overwrite default settings. You can use `--config` if you want to use another filename/location. Most options can be set on the command-line (these will have highest priority).

@@ -157,19 +167,20 @@

1. Bump version in `pkgFiles`.
1. Is `buildCommand` provided? Clean `dist.baseDir` and execute the `buildCommand`.
1. Commit changes with `commitMessage` (`%s` is replaced with the new version).
1. Tag commit with `tagName` (and `tagAnnotation`).
1. Push commit and tag.
1. Create release on GitHub (with `githubReleaseName` and output of `githubReleaseBodyCommand`).
1. No `distRepo`? Publish package to npm.
1. Create release on GitHub (with `github.releaseName` and output of `changelogCommand`).
1. No `dist.repo`? Publish package to npm.
Additionally, if a distribution repository is configured:
1. Clean `distBase` and execute the `buildCommand`.
1. Clone `distRepo` in `distStageDir`.
1. Copy `distFiles` from `distBase` to `distRepo`.
1. Bump version, commit, tag, push `distRepo`.
1. Published package to npm.
1. Clone `dist.repo` in `dist.stageDir`.
1. Copy `dist.files` from `dist.baseDir` to `dist.repo`.
1. Bump version in `dist.pkgFiles`, commit, tag, push `dist.repo`.
1. Create release on GitHub (with `github.releaseName` and output of `changelogCommand`).
1. Publish package to npm.
Notes:
* The first 3 steps of the `distRepo` process are actually executed before you are asked to commit anything (even in the source repo), so you know about build, clone, or copy issues as soon as possible.
* In the background, some steps of the distribution repo process are actually executed before you are asked to commit anything (even in the source repo), so you know about build, clone, or copy issues as soon as possible.
* If present, your `"private": true` setting in package.json will be respected and you will not be bothered with the question to publish to npm.

@@ -176,0 +187,0 @@

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc