|
|
|
@@ -1,7 +1,7 @@
|
|
|
|
|
const {inspect} = require('util');
|
|
|
|
|
const {toLower, isString, trim} = require('lodash');
|
|
|
|
|
const pkg = require('../../package.json');
|
|
|
|
|
const {RELEASE_TYPE} = require('./constants');
|
|
|
|
|
import {inspect} from 'util';
|
|
|
|
|
import {toLower, isString, trim} from 'lodash';
|
|
|
|
|
import pkg from '../../package.json';
|
|
|
|
|
import {RELEASE_TYPE} from './constants.js';
|
|
|
|
|
|
|
|
|
|
const [homepage] = pkg.homepage.split('#');
|
|
|
|
|
const stringify = (object) =>
|
|
|
|
@@ -10,7 +10,7 @@ const linkify = (file) => `${homepage}/blob/master/${file}`;
|
|
|
|
|
const wordsList = (words) =>
|
|
|
|
|
`${words.slice(0, -1).join(', ')}${words.length > 1 ? ` or ${words[words.length - 1]}` : trim(words[0])}`;
|
|
|
|
|
|
|
|
|
|
module.exports = {
|
|
|
|
|
const exported = {
|
|
|
|
|
ENOGITREPO: ({cwd}) => ({
|
|
|
|
|
message: 'Not running from a git repository.',
|
|
|
|
|
details: `The \`semantic-release\` command must be executed from a Git repository.
|
|
|
|
@@ -19,6 +19,7 @@ The current working directory is \`${cwd}\`.
|
|
|
|
|
|
|
|
|
|
Please verify your CI configuration to make sure the \`semantic-release\` command is executed from the root of the cloned repository.`,
|
|
|
|
|
}),
|
|
|
|
|
|
|
|
|
|
ENOREPOURL: () => ({
|
|
|
|
|
message: 'The `repositoryUrl` option is required.',
|
|
|
|
|
details: `The [repositoryUrl option](${linkify(
|
|
|
|
@@ -29,6 +30,7 @@ Please make sure to add the \`repositoryUrl\` to the [semantic-release configura
|
|
|
|
|
'docs/usage/configuration.md'
|
|
|
|
|
)}).`,
|
|
|
|
|
}),
|
|
|
|
|
|
|
|
|
|
EGITNOPERMISSION: ({options: {repositoryUrl}, branch: {name}}) => ({
|
|
|
|
|
message: 'Cannot push to the Git repository.',
|
|
|
|
|
details: `**semantic-release** cannot push the version tag to the branch \`${name}\` on the remote Git repository with URL \`${repositoryUrl}\`.
|
|
|
|
@@ -40,6 +42,7 @@ This can be caused by:
|
|
|
|
|
'docs/usage/ci-configuration.md#authentication'
|
|
|
|
|
)})`,
|
|
|
|
|
}),
|
|
|
|
|
|
|
|
|
|
EINVALIDTAGFORMAT: ({options: {tagFormat}}) => ({
|
|
|
|
|
message: 'Invalid `tagFormat` option.',
|
|
|
|
|
details: `The [tagFormat](${linkify(
|
|
|
|
@@ -48,6 +51,7 @@ This can be caused by:
|
|
|
|
|
|
|
|
|
|
Your configuration for the \`tagFormat\` option is \`${stringify(tagFormat)}\`.`,
|
|
|
|
|
}),
|
|
|
|
|
|
|
|
|
|
ETAGNOVERSION: ({options: {tagFormat}}) => ({
|
|
|
|
|
message: 'Invalid `tagFormat` option.',
|
|
|
|
|
details: `The [tagFormat](${linkify(
|
|
|
|
@@ -56,6 +60,7 @@ Your configuration for the \`tagFormat\` option is \`${stringify(tagFormat)}\`.`
|
|
|
|
|
|
|
|
|
|
Your configuration for the \`tagFormat\` option is \`${stringify(tagFormat)}\`.`,
|
|
|
|
|
}),
|
|
|
|
|
|
|
|
|
|
EPLUGINCONF: ({type, required, pluginConf}) => ({
|
|
|
|
|
message: `The \`${type}\` plugin configuration is invalid.`,
|
|
|
|
|
details: `The [${type} plugin configuration](${linkify(`docs/usage/plugins.md#${toLower(type)}-plugin`)}) ${
|
|
|
|
@@ -64,6 +69,7 @@ Your configuration for the \`tagFormat\` option is \`${stringify(tagFormat)}\`.`
|
|
|
|
|
|
|
|
|
|
Your configuration for the \`${type}\` plugin is \`${stringify(pluginConf)}\`.`,
|
|
|
|
|
}),
|
|
|
|
|
|
|
|
|
|
EPLUGINSCONF: ({plugin}) => ({
|
|
|
|
|
message: 'The `plugins` configuration is invalid.',
|
|
|
|
|
details: `The [plugins](${linkify(
|
|
|
|
@@ -72,6 +78,7 @@ Your configuration for the \`${type}\` plugin is \`${stringify(pluginConf)}\`.`,
|
|
|
|
|
|
|
|
|
|
The invalid configuration is \`${stringify(plugin)}\`.`,
|
|
|
|
|
}),
|
|
|
|
|
|
|
|
|
|
EPLUGIN: ({pluginName, type}) => ({
|
|
|
|
|
message: `A plugin configured in the step ${type} is not a valid semantic-release plugin.`,
|
|
|
|
|
details: `A valid \`${type}\` **semantic-release** plugin must be a function or an object with a function in the property \`${type}\`.
|
|
|
|
@@ -82,6 +89,7 @@ Please refer to the \`${pluginName}\` and [semantic-release plugins configuratio
|
|
|
|
|
'docs/usage/plugins.md'
|
|
|
|
|
)}) documentation for more details.`,
|
|
|
|
|
}),
|
|
|
|
|
|
|
|
|
|
EANALYZECOMMITSOUTPUT: ({result, pluginName}) => ({
|
|
|
|
|
message: 'The `analyzeCommits` plugin returned an invalid value. It must return a valid semver release type.',
|
|
|
|
|
details: `The \`analyzeCommits\` plugin must return a valid [semver](https://semver.org) release type. The valid values are: ${RELEASE_TYPE.map(
|
|
|
|
@@ -98,6 +106,7 @@ We recommend to report the issue to the \`${pluginName}\` authors, providing the
|
|
|
|
|
'docs/developer-guide/plugin.md'
|
|
|
|
|
)})`,
|
|
|
|
|
}),
|
|
|
|
|
|
|
|
|
|
EGENERATENOTESOUTPUT: ({result, pluginName}) => ({
|
|
|
|
|
message: 'The `generateNotes` plugin returned an invalid value. It must return a `String`.',
|
|
|
|
|
details: `The \`generateNotes\` plugin must return a \`String\`.
|
|
|
|
@@ -112,6 +121,7 @@ We recommend to report the issue to the \`${pluginName}\` authors, providing the
|
|
|
|
|
'docs/developer-guide/plugin.md'
|
|
|
|
|
)})`,
|
|
|
|
|
}),
|
|
|
|
|
|
|
|
|
|
EPUBLISHOUTPUT: ({result, pluginName}) => ({
|
|
|
|
|
message: 'A `publish` plugin returned an invalid value. It must return an `Object`.',
|
|
|
|
|
details: `The \`publish\` plugins must return an \`Object\`.
|
|
|
|
@@ -126,6 +136,7 @@ We recommend to report the issue to the \`${pluginName}\` authors, providing the
|
|
|
|
|
'docs/developer-guide/plugin.md'
|
|
|
|
|
)})`,
|
|
|
|
|
}),
|
|
|
|
|
|
|
|
|
|
EADDCHANNELOUTPUT: ({result, pluginName}) => ({
|
|
|
|
|
message: 'A `addChannel` plugin returned an invalid value. It must return an `Object`.',
|
|
|
|
|
details: `The \`addChannel\` plugins must return an \`Object\`.
|
|
|
|
@@ -140,6 +151,7 @@ We recommend to report the issue to the \`${pluginName}\` authors, providing the
|
|
|
|
|
'docs/developer-guide/plugin.md'
|
|
|
|
|
)})`,
|
|
|
|
|
}),
|
|
|
|
|
|
|
|
|
|
EINVALIDBRANCH: ({branch}) => ({
|
|
|
|
|
message: 'A branch is invalid in the `branches` configuration.',
|
|
|
|
|
details: `Each branch in the [branches configuration](${linkify(
|
|
|
|
@@ -148,6 +160,7 @@ We recommend to report the issue to the \`${pluginName}\` authors, providing the
|
|
|
|
|
|
|
|
|
|
Your configuration for the problematic branch is \`${stringify(branch)}\`.`,
|
|
|
|
|
}),
|
|
|
|
|
|
|
|
|
|
EINVALIDBRANCHNAME: ({branch}) => ({
|
|
|
|
|
message: 'A branch name is invalid in the `branches` configuration.',
|
|
|
|
|
details: `Each branch in the [branches configuration](${linkify(
|
|
|
|
@@ -156,6 +169,7 @@ Your configuration for the problematic branch is \`${stringify(branch)}\`.`,
|
|
|
|
|
|
|
|
|
|
Your configuration for the problematic branch is \`${stringify(branch)}\`.`,
|
|
|
|
|
}),
|
|
|
|
|
|
|
|
|
|
EDUPLICATEBRANCHES: ({duplicates}) => ({
|
|
|
|
|
message: 'The `branches` configuration has duplicate branches.',
|
|
|
|
|
details: `Each branch in the [branches configuration](${linkify(
|
|
|
|
@@ -164,6 +178,7 @@ Your configuration for the problematic branch is \`${stringify(branch)}\`.`,
|
|
|
|
|
|
|
|
|
|
Your configuration contains duplicates for the following branch names: \`${stringify(duplicates)}\`.`,
|
|
|
|
|
}),
|
|
|
|
|
|
|
|
|
|
EMAINTENANCEBRANCH: ({branch}) => ({
|
|
|
|
|
message: 'A maintenance branch is invalid in the `branches` configuration.',
|
|
|
|
|
details: `Each maintenance branch in the [branches configuration](${linkify(
|
|
|
|
@@ -172,6 +187,7 @@ Your configuration contains duplicates for the following branch names: \`${strin
|
|
|
|
|
|
|
|
|
|
Your configuration for the problematic branch is \`${stringify(branch)}\`.`,
|
|
|
|
|
}),
|
|
|
|
|
|
|
|
|
|
EMAINTENANCEBRANCHES: ({branches}) => ({
|
|
|
|
|
message: 'The maintenance branches are invalid in the `branches` configuration.',
|
|
|
|
|
details: `Each maintenance branch in the [branches configuration](${linkify(
|
|
|
|
@@ -180,6 +196,7 @@ Your configuration for the problematic branch is \`${stringify(branch)}\`.`,
|
|
|
|
|
|
|
|
|
|
Your configuration for the problematic branches is \`${stringify(branches)}\`.`,
|
|
|
|
|
}),
|
|
|
|
|
|
|
|
|
|
ERELEASEBRANCHES: ({branches}) => ({
|
|
|
|
|
message: 'The release branches are invalid in the `branches` configuration.',
|
|
|
|
|
details: `A minimum of 1 and a maximum of 3 release branches are required in the [branches configuration](${linkify(
|
|
|
|
@@ -190,6 +207,7 @@ This may occur if your repository does not have a release branch, such as \`mast
|
|
|
|
|
|
|
|
|
|
Your configuration for the problematic branches is \`${stringify(branches)}\`.`,
|
|
|
|
|
}),
|
|
|
|
|
|
|
|
|
|
EPRERELEASEBRANCH: ({branch}) => ({
|
|
|
|
|
message: 'A pre-release branch configuration is invalid in the `branches` configuration.',
|
|
|
|
|
details: `Each pre-release branch in the [branches configuration](${linkify(
|
|
|
|
@@ -198,6 +216,7 @@ Your configuration for the problematic branches is \`${stringify(branches)}\`.`,
|
|
|
|
|
|
|
|
|
|
Your configuration for the problematic branch is \`${stringify(branch)}\`.`,
|
|
|
|
|
}),
|
|
|
|
|
|
|
|
|
|
EPRERELEASEBRANCHES: ({branches}) => ({
|
|
|
|
|
message: 'The pre-release branches are invalid in the `branches` configuration.',
|
|
|
|
|
details: `Each pre-release branch in the [branches configuration](${linkify(
|
|
|
|
@@ -206,6 +225,7 @@ Your configuration for the problematic branch is \`${stringify(branch)}\`.`,
|
|
|
|
|
|
|
|
|
|
Your configuration for the problematic branches is \`${stringify(branches)}\`.`,
|
|
|
|
|
}),
|
|
|
|
|
|
|
|
|
|
EINVALIDNEXTVERSION: ({nextRelease: {version}, branch: {name, range}, commits, validBranches}) => ({
|
|
|
|
|
message: `The release \`${version}\` on branch \`${name}\` cannot be published as it is out of range.`,
|
|
|
|
|
details: `Based on the releases published on other branches, only versions within the range \`${range}\` can be published from branch \`${name}\`.
|
|
|
|
@@ -221,6 +241,7 @@ A valid branch could be ${wordsList(validBranches.map(({name}) => `\`${name}\``)
|
|
|
|
|
|
|
|
|
|
See the [workflow configuration documentation](${linkify('docs/usage/workflow-configuration.md')}) for more details.`,
|
|
|
|
|
}),
|
|
|
|
|
|
|
|
|
|
EINVALIDMAINTENANCEMERGE: ({nextRelease: {channel, gitTag, version}, branch: {mergeRange, name}}) => ({
|
|
|
|
|
message: `The release \`${version}\` on branch \`${name}\` cannot be published as it is out of range.`,
|
|
|
|
|
details: `Only releases within the range \`${mergeRange}\` can be merged into the maintenance branch \`${name}\` and published to the \`${channel}\` distribution channel.
|
|
|
|
@@ -230,3 +251,30 @@ The branch \`${name}\` head should be [reset](https://git-scm.com/docs/git-reset
|
|
|
|
|
See the [workflow configuration documentation](${linkify('docs/usage/workflow-configuration.md')}) for more details.`,
|
|
|
|
|
}),
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
export default exported;
|
|
|
|
|
|
|
|
|
|
export const {
|
|
|
|
|
ENOGITREPO,
|
|
|
|
|
ENOREPOURL,
|
|
|
|
|
EGITNOPERMISSION,
|
|
|
|
|
EINVALIDTAGFORMAT,
|
|
|
|
|
ETAGNOVERSION,
|
|
|
|
|
EPLUGINCONF,
|
|
|
|
|
EPLUGINSCONF,
|
|
|
|
|
EPLUGIN,
|
|
|
|
|
EANALYZECOMMITSOUTPUT,
|
|
|
|
|
EGENERATENOTESOUTPUT,
|
|
|
|
|
EPUBLISHOUTPUT,
|
|
|
|
|
EADDCHANNELOUTPUT,
|
|
|
|
|
EINVALIDBRANCH,
|
|
|
|
|
EINVALIDBRANCHNAME,
|
|
|
|
|
EDUPLICATEBRANCHES,
|
|
|
|
|
EMAINTENANCEBRANCH,
|
|
|
|
|
EMAINTENANCEBRANCHES,
|
|
|
|
|
ERELEASEBRANCHES,
|
|
|
|
|
EPRERELEASEBRANCH,
|
|
|
|
|
EPRERELEASEBRANCHES,
|
|
|
|
|
EINVALIDNEXTVERSION,
|
|
|
|
|
EINVALIDMAINTENANCEMERGE,
|
|
|
|
|
} = exported;
|
|
|
|
|