chore(package): update xo to version 0.24.0
This commit is contained in:
parent
9d310c958b
commit
d10268a8fa
@ -3,7 +3,7 @@
|
|||||||
// Bad news: We have to write plain ES5 in this file
|
// Bad news: We have to write plain ES5 in this file
|
||||||
// Good news: It's the only file of the entire project
|
// Good news: It's the only file of the entire project
|
||||||
|
|
||||||
/* eslint-disable no-var, promise/prefer-await-to-then, prefer-destructuring */
|
/* eslint-disable no-var */
|
||||||
|
|
||||||
var semver = require('semver');
|
var semver = require('semver');
|
||||||
var execa = require('execa');
|
var execa = require('execa');
|
||||||
|
4
cli.js
4
cli.js
@ -1,4 +1,4 @@
|
|||||||
const {argv, env, stderr} = require('process');
|
const {argv, env, stderr} = require('process'); // eslint-disable-line node/prefer-global/process
|
||||||
const util = require('util');
|
const util = require('util');
|
||||||
const hideSensitive = require('./lib/hide-sensitive');
|
const hideSensitive = require('./lib/hide-sensitive');
|
||||||
|
|
||||||
@ -51,12 +51,14 @@ Usage:
|
|||||||
// Debug must be enabled before other requires in order to work
|
// Debug must be enabled before other requires in order to work
|
||||||
require('debug').enable('semantic-release:*');
|
require('debug').enable('semantic-release:*');
|
||||||
}
|
}
|
||||||
|
|
||||||
await require('.')(opts);
|
await require('.')(opts);
|
||||||
return 0;
|
return 0;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
if (error.name !== 'YError') {
|
if (error.name !== 'YError') {
|
||||||
stderr.write(hideSensitive(env)(util.inspect(error, {colors: true})));
|
stderr.write(hideSensitive(env)(util.inspect(error, {colors: true})));
|
||||||
}
|
}
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
2
index.js
2
index.js
@ -64,6 +64,7 @@ async function run(context, plugins) {
|
|||||||
);
|
);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
logger[options.dryRun ? 'warn' : 'success'](
|
logger[options.dryRun ? 'warn' : 'success'](
|
||||||
`Run automated release from branch ${ciBranch}${options.dryRun ? ' in dry-run mode' : ''}`
|
`Run automated release from branch ${ciBranch}${options.dryRun ? ' in dry-run mode' : ''}`
|
||||||
);
|
);
|
||||||
@ -82,6 +83,7 @@ async function run(context, plugins) {
|
|||||||
);
|
);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
throw error;
|
throw error;
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
@ -60,6 +60,7 @@ function release({release}) {
|
|||||||
if (release.length === 0) {
|
if (release.length === 0) {
|
||||||
return release;
|
return release;
|
||||||
}
|
}
|
||||||
|
|
||||||
const breakpoints = release.length > 2 ? ['minor', 'major'] : ['major'];
|
const breakpoints = release.length > 2 ? ['minor', 'major'] : ['major'];
|
||||||
|
|
||||||
// The intial bound is the last release from the base branch of `FIRST_RELEASE` (1.0.0)
|
// The intial bound is the last release from the base branch of `FIRST_RELEASE` (1.0.0)
|
||||||
@ -80,6 +81,7 @@ function release({release}) {
|
|||||||
// The upper bound is the lowest version between `nextFirstVersion` and the default upper bound
|
// The upper bound is the lowest version between `nextFirstVersion` and the default upper bound
|
||||||
bound = lowest(nextFirstVersion, upperBound);
|
bound = lowest(nextFirstVersion, upperBound);
|
||||||
}
|
}
|
||||||
|
|
||||||
const diff = bound ? semverDiff(min, bound) : null;
|
const diff = bound ? semverDiff(min, bound) : null;
|
||||||
return {
|
return {
|
||||||
...rest,
|
...rest,
|
||||||
|
@ -1,10 +1,9 @@
|
|||||||
const url = require('url');
|
|
||||||
const {inspect} = require('util');
|
const {inspect} = require('util');
|
||||||
const {toLower, isString, trim} = require('lodash');
|
const {toLower, isString, trim} = require('lodash');
|
||||||
const pkg = require('../../package.json');
|
const pkg = require('../../package.json');
|
||||||
const {RELEASE_TYPE} = require('./constants');
|
const {RELEASE_TYPE} = require('./constants');
|
||||||
|
|
||||||
const homepage = url.format({...url.parse(pkg.homepage), hash: null});
|
const [homepage] = pkg.homepage.split('#');
|
||||||
const stringify = obj => (isString(obj) ? obj : inspect(obj, {breakLength: Infinity, depth: 2, maxArrayLength: 5}));
|
const stringify = obj => (isString(obj) ? obj : inspect(obj, {breakLength: Infinity, depth: 2, maxArrayLength: 5}));
|
||||||
const linkify = file => `${homepage}/blob/master/${file}`;
|
const linkify = file => `${homepage}/blob/master/${file}`;
|
||||||
const wordsList = words =>
|
const wordsList = words =>
|
||||||
@ -211,8 +210,8 @@ The following commit${commits.length > 1 ? 's are' : ' is'} responsible for the
|
|||||||
${commits.map(({commit: {short}, subject}) => `- ${subject} (${short})`).join('\n')}
|
${commits.map(({commit: {short}, subject}) => `- ${subject} (${short})`).join('\n')}
|
||||||
|
|
||||||
${
|
${
|
||||||
commits.length > 1 ? 'Those commits' : 'This commit'
|
commits.length > 1 ? 'Those commits' : 'This commit'
|
||||||
} should be moved to a valid branch with [git merge](https://git-scm.com/docs/git-merge) or [git cherry-pick](https://git-scm.com/docs/git-cherry-pick) and removed from branch \`${name}\` with [git revert](https://git-scm.com/docs/git-revert) or [git reset](https://git-scm.com/docs/git-reset).
|
} should be moved to a valid branch with [git merge](https://git-scm.com/docs/git-merge) or [git cherry-pick](https://git-scm.com/docs/git-cherry-pick) and removed from branch \`${name}\` with [git revert](https://git-scm.com/docs/git-revert) or [git reset](https://git-scm.com/docs/git-reset).
|
||||||
|
|
||||||
A valid branch could be ${wordsList(validBranches.map(({name}) => `\`${name}\``))}.
|
A valid branch could be ${wordsList(validBranches.map(({name}) => `\`${name}\``))}.
|
||||||
|
|
||||||
|
@ -59,6 +59,7 @@ module.exports = {
|
|||||||
// Regenerate the release notes
|
// Regenerate the release notes
|
||||||
context.nextRelease.notes = await generateNotes(context);
|
context.nextRelease.notes = await generateNotes(context);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Call the next prepare plugin with the updated `nextRelease`
|
// Call the next prepare plugin with the updated `nextRelease`
|
||||||
return context;
|
return context;
|
||||||
},
|
},
|
||||||
|
@ -30,6 +30,7 @@ module.exports = async (context, opts) => {
|
|||||||
if (options.ci === false) {
|
if (options.ci === false) {
|
||||||
options.noCi = true;
|
options.noCi = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
const pluginsPath = {};
|
const pluginsPath = {};
|
||||||
let extendPaths;
|
let extendPaths;
|
||||||
({extends: extendPaths, ...options} = options);
|
({extends: extendPaths, ...options} = options);
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
const {parse, format} = require('url');
|
const {parse, format} = require('url'); // eslint-disable-line node/no-deprecated-api
|
||||||
const {isNil} = require('lodash');
|
const {isNil} = require('lodash');
|
||||||
const hostedGitInfo = require('hosted-git-info');
|
const hostedGitInfo = require('hosted-git-info');
|
||||||
const {verifyAuth} = require('./git');
|
const {verifyAuth} = require('./git');
|
||||||
|
@ -99,6 +99,7 @@ async function isRefInHistory(ref, branch, findRebasedTags, execaOpts) {
|
|||||||
);
|
);
|
||||||
return (await getBranchCommits(branch, execaOpts)).some(matches(pick(tagCommit, ['message', 'author'])));
|
return (await getBranchCommits(branch, execaOpts)).some(matches(pick(tagCommit, ['message', 'author'])));
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -57,10 +57,12 @@ module.exports = (context, pluginsPath) => {
|
|||||||
plugin ? [plugin[0], Object.assign(plugin[1], options[type])] : plugin
|
plugin ? [plugin[0], Object.assign(plugin[1], options[type])] : plugin
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!validateStep({required}, options[type])) {
|
if (!validateStep({required}, options[type])) {
|
||||||
errors.push(getError('EPLUGINCONF', {type, required, pluginConf: options[type]}));
|
errors.push(getError('EPLUGINCONF', {type, required, pluginConf: options[type]}));
|
||||||
return pluginsConf;
|
return pluginsConf;
|
||||||
}
|
}
|
||||||
|
|
||||||
pluginOpts = options[type];
|
pluginOpts = options[type];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -40,9 +40,11 @@ module.exports = (context, type, pluginOpt, pluginsPath) => {
|
|||||||
if (outputValidator && !outputValidator(result)) {
|
if (outputValidator && !outputValidator(result)) {
|
||||||
throw getError(`E${type.toUpperCase()}OUTPUT`, {result, pluginName});
|
throw getError(`E${type.toUpperCase()}OUTPUT`, {result, pluginName});
|
||||||
}
|
}
|
||||||
|
|
||||||
logger.success(`Completed step "${type}" of plugin "${pluginName}"`);
|
logger.success(`Completed step "${type}" of plugin "${pluginName}"`);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
logger.warn(`Skip step "${type}" of plugin "${pluginName}" in dry-run mode`);
|
logger.warn(`Skip step "${type}" of plugin "${pluginName}" in dry-run mode`);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
logger.error(`Failed step "${type}" of plugin "${pluginName}"`);
|
logger.error(`Failed step "${type}" of plugin "${pluginName}"`);
|
||||||
|
@ -44,6 +44,7 @@ module.exports = (steps, {settleAll = false, getNextInput = identity, transform
|
|||||||
throw error;
|
throw error;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Prepare input for the next step, passing the input of the last iteration (or initial parameter for the first iteration) and the result of the current one
|
// Prepare input for the next step, passing the input of the last iteration (or initial parameter for the first iteration) and the result of the current one
|
||||||
return getNextInput(lastInput, result);
|
return getNextInput(lastInput, result);
|
||||||
},
|
},
|
||||||
@ -52,5 +53,6 @@ module.exports = (steps, {settleAll = false, getNextInput = identity, transform
|
|||||||
if (errors.length > 0) {
|
if (errors.length > 0) {
|
||||||
throw new AggregateError(errors);
|
throw new AggregateError(errors);
|
||||||
}
|
}
|
||||||
|
|
||||||
return results;
|
return results;
|
||||||
};
|
};
|
||||||
|
@ -12,6 +12,7 @@ const validateSteps = conf => {
|
|||||||
) {
|
) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
conf = castArray(conf);
|
conf = castArray(conf);
|
||||||
|
|
||||||
if (conf.length !== 1) {
|
if (conf.length !== 1) {
|
||||||
@ -39,6 +40,7 @@ function validateStep({required}, conf) {
|
|||||||
if (required) {
|
if (required) {
|
||||||
return conf.length >= 1 && validateSteps(conf);
|
return conf.length >= 1 && validateSteps(conf);
|
||||||
}
|
}
|
||||||
|
|
||||||
return conf.length === 0 || validateSteps(conf);
|
return conf.length === 0 || validateSteps(conf);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -59,6 +61,7 @@ function parseConfig(plugin) {
|
|||||||
} else {
|
} else {
|
||||||
path = plugin;
|
path = plugin;
|
||||||
}
|
}
|
||||||
|
|
||||||
return [path, config || {}];
|
return [path, config || {}];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -59,6 +59,7 @@ function getFirstVersion(versions, lowerBranches) {
|
|||||||
if (lowerVersion[0]) {
|
if (lowerVersion[0]) {
|
||||||
return versions.sort(semver.compare).find(version => semver.gt(version, lowerVersion[0]));
|
return versions.sort(semver.compare).find(version => semver.gt(version, lowerVersion[0]));
|
||||||
}
|
}
|
||||||
|
|
||||||
return getEarliestVersion(versions);
|
return getEarliestVersion(versions);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -68,7 +68,7 @@
|
|||||||
"sinon": "^7.1.1",
|
"sinon": "^7.1.1",
|
||||||
"stream-buffers": "^3.0.2",
|
"stream-buffers": "^3.0.2",
|
||||||
"tempy": "^0.2.1",
|
"tempy": "^0.2.1",
|
||||||
"xo": "^0.23.0"
|
"xo": "^0.24.0"
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=8.3"
|
"node": ">=8.3"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user