Compare commits
11
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
66cc2b4c7f | ||
|
|
1632e1adac | ||
|
|
0390af32b6 | ||
|
|
e58b76e700 | ||
|
|
5e228a1cd1 | ||
|
|
23d2bc2842 | ||
|
|
b4200b05cd | ||
|
|
ea52e1775a | ||
|
|
5edff69580 | ||
|
|
6e4beb8314 | ||
|
|
ebad322318 |
@@ -31,8 +31,6 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
node-version: ${{ matrix.node-version }}
|
node-version: ${{ matrix.node-version }}
|
||||||
cache: npm
|
cache: npm
|
||||||
- name: Ensure dependencies are compatible with the version of node
|
|
||||||
run: echo 'engine-strict=true' >> .npmrc
|
|
||||||
- run: npm ci
|
- run: npm ci
|
||||||
- run: npm run test:ci
|
- run: npm run test:ci
|
||||||
|
|
||||||
@@ -45,6 +43,9 @@ jobs:
|
|||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
- uses: actions/setup-node@v2
|
- uses: actions/setup-node@v2
|
||||||
with:
|
with:
|
||||||
|
node-version: 16
|
||||||
cache: npm
|
cache: npm
|
||||||
- run: npm ci
|
- run: npm ci
|
||||||
|
- name: Ensure dependencies are compatible with the version of node
|
||||||
|
run: npx ls-engines@0.4
|
||||||
- run: npm run lint
|
- run: npm run lint
|
||||||
|
|||||||
+12
-7
@@ -1,11 +1,16 @@
|
|||||||
#!/usr/bin/env node// Bad news: We have to write plain ES5 in this file
|
#!/usr/bin/env node
|
||||||
import semver from 'semver';
|
|
||||||
|
|
||||||
import execa from 'execa';
|
// Bad news: We have to write plain ES5 in this file
|
||||||
import findVersions from 'find-versions';
|
// Good news: It's the only file of the entire project
|
||||||
import pkg from '../package.json';
|
|
||||||
|
|
||||||
const MIN_GIT_VERSION = '2.7.1';
|
/* eslint-disable no-var */
|
||||||
|
|
||||||
|
var semver = require('semver');
|
||||||
|
var execa = require('execa');
|
||||||
|
var findVersions = require('find-versions');
|
||||||
|
var pkg = require('../package.json');
|
||||||
|
|
||||||
|
var MIN_GIT_VERSION = '2.7.1';
|
||||||
|
|
||||||
if (!semver.satisfies(process.version, pkg.engines.node)) {
|
if (!semver.satisfies(process.version, pkg.engines.node)) {
|
||||||
console.error(
|
console.error(
|
||||||
@@ -18,7 +23,7 @@ See https://github.com/semantic-release/semantic-release/blob/master/docs/suppor
|
|||||||
|
|
||||||
execa('git', ['--version'])
|
execa('git', ['--version'])
|
||||||
.then(({stdout}) => {
|
.then(({stdout}) => {
|
||||||
const gitVersion = findVersions(stdout)[0];
|
var gitVersion = findVersions(stdout)[0];
|
||||||
if (semver.lt(gitVersion, MIN_GIT_VERSION)) {
|
if (semver.lt(gitVersion, MIN_GIT_VERSION)) {
|
||||||
console.error(`[semantic-release]: Git version ${MIN_GIT_VERSION} is required. Found ${gitVersion}.`);
|
console.error(`[semantic-release]: Git version ${MIN_GIT_VERSION} is required. Found ${gitVersion}.`);
|
||||||
process.exit(1);
|
process.exit(1);
|
||||||
|
|||||||
@@ -1,9 +1,6 @@
|
|||||||
import util from 'util';
|
const {argv, env, stderr} = require('process'); // eslint-disable-line node/prefer-global/process
|
||||||
import hideSensitive from './lib/hide-sensitive';
|
const util = require('util');
|
||||||
import yargs from 'yargs';
|
const hideSensitive = require('./lib/hide-sensitive');
|
||||||
import debug from 'debug';
|
|
||||||
|
|
||||||
import run from '.';
|
|
||||||
|
|
||||||
const stringList = {
|
const stringList = {
|
||||||
type: 'string',
|
type: 'string',
|
||||||
@@ -14,8 +11,8 @@ const stringList = {
|
|||||||
: values.reduce((values, value) => values.concat(value.split(',').map((value) => value.trim())), []),
|
: values.reduce((values, value) => values.concat(value.split(',').map((value) => value.trim())), []),
|
||||||
};
|
};
|
||||||
|
|
||||||
export default async () => {
|
module.exports = async () => {
|
||||||
const cli = yargs
|
const cli = require('yargs')
|
||||||
.command('$0', 'Run automated package publishing', (yargs) => {
|
.command('$0', 'Run automated package publishing', (yargs) => {
|
||||||
yargs.demandCommand(0, 0).usage(`Run automated package publishing
|
yargs.demandCommand(0, 0).usage(`Run automated package publishing
|
||||||
|
|
||||||
@@ -44,7 +41,7 @@ Usage:
|
|||||||
.exitProcess(false);
|
.exitProcess(false);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const {help, version, ...options} = cli.parse(process.argv.slice(2));
|
const {help, version, ...options} = cli.parse(argv.slice(2));
|
||||||
|
|
||||||
if (Boolean(help) || Boolean(version)) {
|
if (Boolean(help) || Boolean(version)) {
|
||||||
return 0;
|
return 0;
|
||||||
@@ -52,14 +49,14 @@ Usage:
|
|||||||
|
|
||||||
if (options.debug) {
|
if (options.debug) {
|
||||||
// Debug must be enabled before other requires in order to work
|
// Debug must be enabled before other requires in order to work
|
||||||
debug.enable('semantic-release:*');
|
require('debug').enable('semantic-release:*');
|
||||||
}
|
}
|
||||||
|
|
||||||
await run(options);
|
await require('.')(options);
|
||||||
return 0;
|
return 0;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
if (error.name !== 'YError') {
|
if (error.name !== 'YError') {
|
||||||
process.stderr.write(hideSensitive(process.env)(util.inspect(error, {colors: true})));
|
stderr.write(hideSensitive(env)(util.inspect(error, {colors: true})));
|
||||||
}
|
}
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
## Environment variables
|
## Environment variables
|
||||||
|
|
||||||
The [Authentication](../usage/ci-configuration.md#authentication) environment variables can be configured with [Secret Variables](https://help.github.com/en/articles/virtual-environments-for-github-actions#creating-and-using-secrets-encrypted-variables).
|
The [Authentication](../usage/ci-configuration.md#authentication) environment variables can be configured with [Secret Variables](https://docs.github.com/en/actions/reference/encrypted-secrets).
|
||||||
|
|
||||||
In this example a publish type [`NPM_TOKEN`](https://docs.npmjs.com/creating-and-viewing-authentication-tokens) is required to publish a package to the npm registry. GitHub Actions [automatically populate](https://help.github.com/en/articles/virtual-environments-for-github-actions#github_token-secret) a [`GITHUB_TOKEN`](https://help.github.com/en/articles/creating-a-personal-access-token-for-the-command-line) environment variable which can be used in Workflows.
|
In this example a publish type [`NPM_TOKEN`](https://docs.npmjs.com/creating-and-viewing-authentication-tokens) is required to publish a package to the npm registry. GitHub Actions [automatically populate](https://help.github.com/en/articles/virtual-environments-for-github-actions#github_token-secret) a [`GITHUB_TOKEN`](https://help.github.com/en/articles/creating-a-personal-access-token-for-the-command-line) environment variable which can be used in Workflows.
|
||||||
|
|
||||||
|
|||||||
@@ -58,4 +58,4 @@ A `package.json` is required only for [local](../usage/installation.md#local-ins
|
|||||||
"semantic-release": "^18.0.0"
|
"semantic-release": "^18.0.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
**semantic-release** is written using the latest [ECMAScript 2017](https://www.ecma-international.org/publications/standards/Ecma-262.htm) features, without transpilation which requires **requires Node version 14.17 or higher**.
|
**semantic-release** is written using the latest [ECMAScript 2017](https://www.ecma-international.org/publications/standards/Ecma-262.htm) features, without transpilation which requires **requires Node version 14.17 or higher**.
|
||||||
|
|
||||||
**semantic-release** is meant to be used in a CI environment as a development support tool, not as a production dependency. Therefore the only constraint is to run the `semantic-release` in a CI environment providing Node 14.17 or higher.
|
**semantic-release** is meant to be used in a CI environment as a development support tool, not as a production dependency. Therefore, the only constraint is to run the `semantic-release` in a CI environment providing Node 14.17 or higher.
|
||||||
|
|
||||||
See our [Node Support Policy](node-support-policy.md) for our long-term promise regarding Node version support.
|
See our [Node Support Policy](node-support-policy.md) for our long-term promise regarding Node version support.
|
||||||
|
|
||||||
|
|||||||
@@ -1,28 +1,25 @@
|
|||||||
import lodash from 'lodash'
|
const {pick} = require('lodash');
|
||||||
const {pick} = lodash
|
const marked = require('marked');
|
||||||
import marked from 'marked';
|
const TerminalRenderer = require('marked-terminal');
|
||||||
import TerminalRenderer from 'marked-terminal';
|
const envCi = require('env-ci');
|
||||||
import envCi from 'env-ci';
|
const hookStd = require('hook-std');
|
||||||
import hookStd from 'hook-std';
|
const semver = require('semver');
|
||||||
import semver from 'semver';
|
const AggregateError = require('aggregate-error');
|
||||||
import AggregateError from 'aggregate-error';
|
const pkg = require('./package.json');
|
||||||
import pkg from './package.json';
|
const hideSensitive = require('./lib/hide-sensitive');
|
||||||
import hideSensitive from './lib/hide-sensitive';
|
const getConfig = require('./lib/get-config');
|
||||||
import getConfig from './lib/get-config';
|
const verify = require('./lib/verify');
|
||||||
import verify from './lib/verify';
|
const getNextVersion = require('./lib/get-next-version');
|
||||||
import getNextVersion from './lib/get-next-version';
|
const getCommits = require('./lib/get-commits');
|
||||||
import getCommits from './lib/get-commits';
|
const getLastRelease = require('./lib/get-last-release');
|
||||||
import getLastRelease from './lib/get-last-release';
|
const getReleaseToAdd = require('./lib/get-release-to-add');
|
||||||
import getReleaseToAdd from './lib/get-release-to-add';
|
const {extractErrors, makeTag} = require('./lib/utils');
|
||||||
import {extractErrors, makeTag} from './lib/utils';
|
const getGitAuthUrl = require('./lib/get-git-auth-url');
|
||||||
import getGitAuthUrl from './lib/get-git-auth-url';
|
const getBranches = require('./lib/branches');
|
||||||
import getBranches from './lib/branches';
|
const getLogger = require('./lib/get-logger');
|
||||||
import getLogger from './lib/get-logger';
|
const {verifyAuth, isBranchUpToDate, getGitHead, tag, push, pushNotes, getTagHead, addNote} = require('./lib/git');
|
||||||
|
const getError = require('./lib/get-error');
|
||||||
import {verifyAuth, isBranchUpToDate, getGitHead, tag, push, pushNotes, getTagHead, addNote} from './lib/git';
|
const {COMMIT_NAME, COMMIT_EMAIL} = require('./lib/definitions/constants');
|
||||||
|
|
||||||
import getError from './lib/get-error';
|
|
||||||
import {COMMIT_NAME, COMMIT_EMAIL} from './lib/definitions/constants';
|
|
||||||
|
|
||||||
marked.setOptions({renderer: new TerminalRenderer()});
|
marked.setOptions({renderer: new TerminalRenderer()});
|
||||||
|
|
||||||
@@ -242,7 +239,7 @@ async function callFail(context, plugins, err) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export default async (cliOptions = {}, {cwd = process.cwd(), env = process.env, stdout, stderr} = {}) => {
|
module.exports = async (cliOptions = {}, {cwd = process.cwd(), env = process.env, stdout, stderr} = {}) => {
|
||||||
const {unhook} = hookStd(
|
const {unhook} = hookStd(
|
||||||
{silent: false, streams: [process.stdout, process.stderr, stdout, stderr].filter(Boolean)},
|
{silent: false, streams: [process.stdout, process.stderr, stdout, stderr].filter(Boolean)},
|
||||||
hideSensitive(env)
|
hideSensitive(env)
|
||||||
|
|||||||
@@ -1,9 +1,8 @@
|
|||||||
import lodash from 'lodash'
|
const {isString, remove, omit, mapValues, template} = require('lodash');
|
||||||
const {isString, remove, omit, mapValues, template} = lodash
|
const micromatch = require('micromatch');
|
||||||
import micromatch from 'micromatch';
|
const {getBranches} = require('../git');
|
||||||
import {getBranches} from '../git.js';
|
|
||||||
|
|
||||||
export default async (repositoryUrl, {cwd}, branches) => {
|
module.exports = async (repositoryUrl, {cwd}, branches) => {
|
||||||
const gitBranches = await getBranches(repositoryUrl, {cwd});
|
const gitBranches = await getBranches(repositoryUrl, {cwd});
|
||||||
|
|
||||||
return branches.reduce(
|
return branches.reduce(
|
||||||
|
|||||||
@@ -1,12 +1,10 @@
|
|||||||
import lodash from 'lodash'
|
const {template, escapeRegExp} = require('lodash');
|
||||||
const {template, escapeRegExp} = lodash
|
const semver = require('semver');
|
||||||
import semver from 'semver';
|
const pReduce = require('p-reduce');
|
||||||
import pReduce from 'p-reduce';
|
const debug = require('debug')('semantic-release:get-tags');
|
||||||
import debugFactory from 'debug';
|
const {getTags, getNote} = require('../../lib/git');
|
||||||
const debug = debugFactory('semantic-release:get-tags');
|
|
||||||
import {getTags, getNote} from '../../lib/git.js';
|
|
||||||
|
|
||||||
export default async ({cwd, env, options: {tagFormat}}, branches) => {
|
module.exports = async ({cwd, env, options: {tagFormat}}, branches) => {
|
||||||
// Generate a regex to parse tags formatted with `tagFormat`
|
// Generate a regex to parse tags formatted with `tagFormat`
|
||||||
// by replacing the `version` variable in the template by `(.+)`.
|
// by replacing the `version` variable in the template by `(.+)`.
|
||||||
// The `tagFormat` is compiled with space as the `version` as it's an invalid tag character,
|
// The `tagFormat` is compiled with space as the `version` as it's an invalid tag character,
|
||||||
|
|||||||
+10
-11
@@ -1,15 +1,14 @@
|
|||||||
import lodash from 'lodash'
|
const {isString, isRegExp} = require('lodash');
|
||||||
const {isString, isRegExp} = lodash
|
const AggregateError = require('aggregate-error');
|
||||||
import AggregateError from 'aggregate-error';
|
const pEachSeries = require('p-each-series');
|
||||||
import pEachSeries from 'p-each-series';
|
const DEFINITIONS = require('../definitions/branches');
|
||||||
import DEFINITIONS from '../definitions/branches.js';
|
const getError = require('../get-error');
|
||||||
import getError from '../get-error.js';
|
const {fetch, fetchNotes, verifyBranchName} = require('../git');
|
||||||
import {fetch, fetchNotes, verifyBranchName} from '../git.js';
|
const expand = require('./expand');
|
||||||
import expand from './expand.js';
|
const getTags = require('./get-tags');
|
||||||
import getTags from './get-tags.js';
|
const normalize = require('./normalize');
|
||||||
import normalize from './normalize.js';
|
|
||||||
|
|
||||||
export default async (repositoryUrl, ciBranch, context) => {
|
module.exports = async (repositoryUrl, ciBranch, context) => {
|
||||||
const {cwd, env} = context;
|
const {cwd, env} = context;
|
||||||
|
|
||||||
const remoteBranches = await expand(
|
const remoteBranches = await expand(
|
||||||
|
|||||||
@@ -1,9 +1,7 @@
|
|||||||
import lodash from 'lodash'
|
const {sortBy, isNil} = require('lodash');
|
||||||
const {sortBy, isNil} = lodash
|
const semverDiff = require('semver-diff');
|
||||||
import semverDiff from 'semver-diff';
|
const {FIRST_RELEASE, RELEASE_TYPE} = require('../definitions/constants');
|
||||||
import {FIRST_RELEASE, RELEASE_TYPE} from '../definitions/constants.js';
|
const {
|
||||||
|
|
||||||
import {
|
|
||||||
tagsToVersions,
|
tagsToVersions,
|
||||||
isMajorRange,
|
isMajorRange,
|
||||||
getUpperBound,
|
getUpperBound,
|
||||||
@@ -13,7 +11,7 @@ import {
|
|||||||
getLatestVersion,
|
getLatestVersion,
|
||||||
getFirstVersion,
|
getFirstVersion,
|
||||||
getRange,
|
getRange,
|
||||||
} from '../utils.js';
|
} = require('../utils');
|
||||||
|
|
||||||
function maintenance({maintenance, release}) {
|
function maintenance({maintenance, release}) {
|
||||||
return sortBy(
|
return sortBy(
|
||||||
@@ -105,11 +103,4 @@ function prerelease({prerelease}) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
const exported = {
|
module.exports = {maintenance, release, prerelease};
|
||||||
maintenance,
|
|
||||||
release,
|
|
||||||
prerelease,
|
|
||||||
};
|
|
||||||
|
|
||||||
export default exported;
|
|
||||||
export {maintenance, release, prerelease};
|
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
import lodash from 'lodash'
|
const {isNil, uniqBy} = require('lodash');
|
||||||
const {isNil, uniqBy} = lodash
|
const semver = require('semver');
|
||||||
import semver from 'semver';
|
const {isMaintenanceRange} = require('../utils');
|
||||||
import {isMaintenanceRange} from '../utils.js';
|
|
||||||
|
|
||||||
const maintenance = {
|
const maintenance = {
|
||||||
filter: ({name, range}) => (!isNil(range) && range !== false) || isMaintenanceRange(name),
|
filter: ({name, range}) => (!isNil(range) && range !== false) || isMaintenanceRange(name),
|
||||||
@@ -21,11 +20,4 @@ const release = {
|
|||||||
branchesValidator: (branches) => branches.length <= 3 && branches.length > 0,
|
branchesValidator: (branches) => branches.length <= 3 && branches.length > 0,
|
||||||
};
|
};
|
||||||
|
|
||||||
const exported = {
|
module.exports = {maintenance, prerelease, release};
|
||||||
maintenance,
|
|
||||||
prerelease,
|
|
||||||
release,
|
|
||||||
};
|
|
||||||
|
|
||||||
export default exported;
|
|
||||||
export {maintenance, prerelease, release};
|
|
||||||
|
|||||||
@@ -16,20 +16,7 @@ const SECRET_MIN_SIZE = 5;
|
|||||||
|
|
||||||
const GIT_NOTE_REF = 'semantic-release';
|
const GIT_NOTE_REF = 'semantic-release';
|
||||||
|
|
||||||
const exported = {
|
module.exports = {
|
||||||
RELEASE_TYPE,
|
|
||||||
FIRST_RELEASE,
|
|
||||||
FIRSTPRERELEASE,
|
|
||||||
COMMIT_NAME,
|
|
||||||
COMMIT_EMAIL,
|
|
||||||
RELEASE_NOTES_SEPARATOR,
|
|
||||||
SECRET_REPLACEMENT,
|
|
||||||
SECRET_MIN_SIZE,
|
|
||||||
GIT_NOTE_REF,
|
|
||||||
};
|
|
||||||
|
|
||||||
export default exported;
|
|
||||||
export {
|
|
||||||
RELEASE_TYPE,
|
RELEASE_TYPE,
|
||||||
FIRST_RELEASE,
|
FIRST_RELEASE,
|
||||||
FIRSTPRERELEASE,
|
FIRSTPRERELEASE,
|
||||||
|
|||||||
@@ -1,8 +1,7 @@
|
|||||||
import {inspect} from 'util';
|
const {inspect} = require('util');
|
||||||
import lodash from 'lodash'
|
const {toLower, isString, trim} = require('lodash');
|
||||||
const {toLower, isString, trim} = lodash
|
const pkg = require('../../package.json');
|
||||||
import pkg from '../../package.json';
|
const {RELEASE_TYPE} = require('./constants');
|
||||||
import {RELEASE_TYPE} from './constants.js';
|
|
||||||
|
|
||||||
const [homepage] = pkg.homepage.split('#');
|
const [homepage] = pkg.homepage.split('#');
|
||||||
const stringify = (object) =>
|
const stringify = (object) =>
|
||||||
@@ -11,7 +10,7 @@ const linkify = (file) => `${homepage}/blob/master/${file}`;
|
|||||||
const wordsList = (words) =>
|
const wordsList = (words) =>
|
||||||
`${words.slice(0, -1).join(', ')}${words.length > 1 ? ` or ${words[words.length - 1]}` : trim(words[0])}`;
|
`${words.slice(0, -1).join(', ')}${words.length > 1 ? ` or ${words[words.length - 1]}` : trim(words[0])}`;
|
||||||
|
|
||||||
const exported = {
|
module.exports = {
|
||||||
ENOGITREPO: ({cwd}) => ({
|
ENOGITREPO: ({cwd}) => ({
|
||||||
message: 'Not running from a git repository.',
|
message: 'Not running from a git repository.',
|
||||||
details: `The \`semantic-release\` command must be executed from a Git repository.
|
details: `The \`semantic-release\` command must be executed from a Git repository.
|
||||||
@@ -20,7 +19,6 @@ 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.`,
|
Please verify your CI configuration to make sure the \`semantic-release\` command is executed from the root of the cloned repository.`,
|
||||||
}),
|
}),
|
||||||
|
|
||||||
ENOREPOURL: () => ({
|
ENOREPOURL: () => ({
|
||||||
message: 'The `repositoryUrl` option is required.',
|
message: 'The `repositoryUrl` option is required.',
|
||||||
details: `The [repositoryUrl option](${linkify(
|
details: `The [repositoryUrl option](${linkify(
|
||||||
@@ -31,7 +29,6 @@ Please make sure to add the \`repositoryUrl\` to the [semantic-release configura
|
|||||||
'docs/usage/configuration.md'
|
'docs/usage/configuration.md'
|
||||||
)}).`,
|
)}).`,
|
||||||
}),
|
}),
|
||||||
|
|
||||||
EGITNOPERMISSION: ({options: {repositoryUrl}, branch: {name}}) => ({
|
EGITNOPERMISSION: ({options: {repositoryUrl}, branch: {name}}) => ({
|
||||||
message: 'Cannot push to the Git repository.',
|
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}\`.
|
details: `**semantic-release** cannot push the version tag to the branch \`${name}\` on the remote Git repository with URL \`${repositoryUrl}\`.
|
||||||
@@ -43,7 +40,6 @@ This can be caused by:
|
|||||||
'docs/usage/ci-configuration.md#authentication'
|
'docs/usage/ci-configuration.md#authentication'
|
||||||
)})`,
|
)})`,
|
||||||
}),
|
}),
|
||||||
|
|
||||||
EINVALIDTAGFORMAT: ({options: {tagFormat}}) => ({
|
EINVALIDTAGFORMAT: ({options: {tagFormat}}) => ({
|
||||||
message: 'Invalid `tagFormat` option.',
|
message: 'Invalid `tagFormat` option.',
|
||||||
details: `The [tagFormat](${linkify(
|
details: `The [tagFormat](${linkify(
|
||||||
@@ -52,7 +48,6 @@ This can be caused by:
|
|||||||
|
|
||||||
Your configuration for the \`tagFormat\` option is \`${stringify(tagFormat)}\`.`,
|
Your configuration for the \`tagFormat\` option is \`${stringify(tagFormat)}\`.`,
|
||||||
}),
|
}),
|
||||||
|
|
||||||
ETAGNOVERSION: ({options: {tagFormat}}) => ({
|
ETAGNOVERSION: ({options: {tagFormat}}) => ({
|
||||||
message: 'Invalid `tagFormat` option.',
|
message: 'Invalid `tagFormat` option.',
|
||||||
details: `The [tagFormat](${linkify(
|
details: `The [tagFormat](${linkify(
|
||||||
@@ -61,7 +56,6 @@ Your configuration for the \`tagFormat\` option is \`${stringify(tagFormat)}\`.`
|
|||||||
|
|
||||||
Your configuration for the \`tagFormat\` option is \`${stringify(tagFormat)}\`.`,
|
Your configuration for the \`tagFormat\` option is \`${stringify(tagFormat)}\`.`,
|
||||||
}),
|
}),
|
||||||
|
|
||||||
EPLUGINCONF: ({type, required, pluginConf}) => ({
|
EPLUGINCONF: ({type, required, pluginConf}) => ({
|
||||||
message: `The \`${type}\` plugin configuration is invalid.`,
|
message: `The \`${type}\` plugin configuration is invalid.`,
|
||||||
details: `The [${type} plugin configuration](${linkify(`docs/usage/plugins.md#${toLower(type)}-plugin`)}) ${
|
details: `The [${type} plugin configuration](${linkify(`docs/usage/plugins.md#${toLower(type)}-plugin`)}) ${
|
||||||
@@ -70,7 +64,6 @@ Your configuration for the \`tagFormat\` option is \`${stringify(tagFormat)}\`.`
|
|||||||
|
|
||||||
Your configuration for the \`${type}\` plugin is \`${stringify(pluginConf)}\`.`,
|
Your configuration for the \`${type}\` plugin is \`${stringify(pluginConf)}\`.`,
|
||||||
}),
|
}),
|
||||||
|
|
||||||
EPLUGINSCONF: ({plugin}) => ({
|
EPLUGINSCONF: ({plugin}) => ({
|
||||||
message: 'The `plugins` configuration is invalid.',
|
message: 'The `plugins` configuration is invalid.',
|
||||||
details: `The [plugins](${linkify(
|
details: `The [plugins](${linkify(
|
||||||
@@ -79,7 +72,6 @@ Your configuration for the \`${type}\` plugin is \`${stringify(pluginConf)}\`.`,
|
|||||||
|
|
||||||
The invalid configuration is \`${stringify(plugin)}\`.`,
|
The invalid configuration is \`${stringify(plugin)}\`.`,
|
||||||
}),
|
}),
|
||||||
|
|
||||||
EPLUGIN: ({pluginName, type}) => ({
|
EPLUGIN: ({pluginName, type}) => ({
|
||||||
message: `A plugin configured in the step ${type} is not a valid semantic-release plugin.`,
|
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}\`.
|
details: `A valid \`${type}\` **semantic-release** plugin must be a function or an object with a function in the property \`${type}\`.
|
||||||
@@ -90,7 +82,6 @@ Please refer to the \`${pluginName}\` and [semantic-release plugins configuratio
|
|||||||
'docs/usage/plugins.md'
|
'docs/usage/plugins.md'
|
||||||
)}) documentation for more details.`,
|
)}) documentation for more details.`,
|
||||||
}),
|
}),
|
||||||
|
|
||||||
EANALYZECOMMITSOUTPUT: ({result, pluginName}) => ({
|
EANALYZECOMMITSOUTPUT: ({result, pluginName}) => ({
|
||||||
message: 'The `analyzeCommits` plugin returned an invalid value. It must return a valid semver release type.',
|
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(
|
details: `The \`analyzeCommits\` plugin must return a valid [semver](https://semver.org) release type. The valid values are: ${RELEASE_TYPE.map(
|
||||||
@@ -107,7 +98,6 @@ We recommend to report the issue to the \`${pluginName}\` authors, providing the
|
|||||||
'docs/developer-guide/plugin.md'
|
'docs/developer-guide/plugin.md'
|
||||||
)})`,
|
)})`,
|
||||||
}),
|
}),
|
||||||
|
|
||||||
EGENERATENOTESOUTPUT: ({result, pluginName}) => ({
|
EGENERATENOTESOUTPUT: ({result, pluginName}) => ({
|
||||||
message: 'The `generateNotes` plugin returned an invalid value. It must return a `String`.',
|
message: 'The `generateNotes` plugin returned an invalid value. It must return a `String`.',
|
||||||
details: `The \`generateNotes\` plugin must return a \`String\`.
|
details: `The \`generateNotes\` plugin must return a \`String\`.
|
||||||
@@ -122,7 +112,6 @@ We recommend to report the issue to the \`${pluginName}\` authors, providing the
|
|||||||
'docs/developer-guide/plugin.md'
|
'docs/developer-guide/plugin.md'
|
||||||
)})`,
|
)})`,
|
||||||
}),
|
}),
|
||||||
|
|
||||||
EPUBLISHOUTPUT: ({result, pluginName}) => ({
|
EPUBLISHOUTPUT: ({result, pluginName}) => ({
|
||||||
message: 'A `publish` plugin returned an invalid value. It must return an `Object`.',
|
message: 'A `publish` plugin returned an invalid value. It must return an `Object`.',
|
||||||
details: `The \`publish\` plugins must return an \`Object\`.
|
details: `The \`publish\` plugins must return an \`Object\`.
|
||||||
@@ -137,7 +126,6 @@ We recommend to report the issue to the \`${pluginName}\` authors, providing the
|
|||||||
'docs/developer-guide/plugin.md'
|
'docs/developer-guide/plugin.md'
|
||||||
)})`,
|
)})`,
|
||||||
}),
|
}),
|
||||||
|
|
||||||
EADDCHANNELOUTPUT: ({result, pluginName}) => ({
|
EADDCHANNELOUTPUT: ({result, pluginName}) => ({
|
||||||
message: 'A `addChannel` plugin returned an invalid value. It must return an `Object`.',
|
message: 'A `addChannel` plugin returned an invalid value. It must return an `Object`.',
|
||||||
details: `The \`addChannel\` plugins must return an \`Object\`.
|
details: `The \`addChannel\` plugins must return an \`Object\`.
|
||||||
@@ -152,7 +140,6 @@ We recommend to report the issue to the \`${pluginName}\` authors, providing the
|
|||||||
'docs/developer-guide/plugin.md'
|
'docs/developer-guide/plugin.md'
|
||||||
)})`,
|
)})`,
|
||||||
}),
|
}),
|
||||||
|
|
||||||
EINVALIDBRANCH: ({branch}) => ({
|
EINVALIDBRANCH: ({branch}) => ({
|
||||||
message: 'A branch is invalid in the `branches` configuration.',
|
message: 'A branch is invalid in the `branches` configuration.',
|
||||||
details: `Each branch in the [branches configuration](${linkify(
|
details: `Each branch in the [branches configuration](${linkify(
|
||||||
@@ -161,7 +148,6 @@ We recommend to report the issue to the \`${pluginName}\` authors, providing the
|
|||||||
|
|
||||||
Your configuration for the problematic branch is \`${stringify(branch)}\`.`,
|
Your configuration for the problematic branch is \`${stringify(branch)}\`.`,
|
||||||
}),
|
}),
|
||||||
|
|
||||||
EINVALIDBRANCHNAME: ({branch}) => ({
|
EINVALIDBRANCHNAME: ({branch}) => ({
|
||||||
message: 'A branch name is invalid in the `branches` configuration.',
|
message: 'A branch name is invalid in the `branches` configuration.',
|
||||||
details: `Each branch in the [branches configuration](${linkify(
|
details: `Each branch in the [branches configuration](${linkify(
|
||||||
@@ -170,7 +156,6 @@ Your configuration for the problematic branch is \`${stringify(branch)}\`.`,
|
|||||||
|
|
||||||
Your configuration for the problematic branch is \`${stringify(branch)}\`.`,
|
Your configuration for the problematic branch is \`${stringify(branch)}\`.`,
|
||||||
}),
|
}),
|
||||||
|
|
||||||
EDUPLICATEBRANCHES: ({duplicates}) => ({
|
EDUPLICATEBRANCHES: ({duplicates}) => ({
|
||||||
message: 'The `branches` configuration has duplicate branches.',
|
message: 'The `branches` configuration has duplicate branches.',
|
||||||
details: `Each branch in the [branches configuration](${linkify(
|
details: `Each branch in the [branches configuration](${linkify(
|
||||||
@@ -179,7 +164,6 @@ Your configuration for the problematic branch is \`${stringify(branch)}\`.`,
|
|||||||
|
|
||||||
Your configuration contains duplicates for the following branch names: \`${stringify(duplicates)}\`.`,
|
Your configuration contains duplicates for the following branch names: \`${stringify(duplicates)}\`.`,
|
||||||
}),
|
}),
|
||||||
|
|
||||||
EMAINTENANCEBRANCH: ({branch}) => ({
|
EMAINTENANCEBRANCH: ({branch}) => ({
|
||||||
message: 'A maintenance branch is invalid in the `branches` configuration.',
|
message: 'A maintenance branch is invalid in the `branches` configuration.',
|
||||||
details: `Each maintenance branch in the [branches configuration](${linkify(
|
details: `Each maintenance branch in the [branches configuration](${linkify(
|
||||||
@@ -188,7 +172,6 @@ Your configuration contains duplicates for the following branch names: \`${strin
|
|||||||
|
|
||||||
Your configuration for the problematic branch is \`${stringify(branch)}\`.`,
|
Your configuration for the problematic branch is \`${stringify(branch)}\`.`,
|
||||||
}),
|
}),
|
||||||
|
|
||||||
EMAINTENANCEBRANCHES: ({branches}) => ({
|
EMAINTENANCEBRANCHES: ({branches}) => ({
|
||||||
message: 'The maintenance branches are invalid in the `branches` configuration.',
|
message: 'The maintenance branches are invalid in the `branches` configuration.',
|
||||||
details: `Each maintenance branch in the [branches configuration](${linkify(
|
details: `Each maintenance branch in the [branches configuration](${linkify(
|
||||||
@@ -197,7 +180,6 @@ Your configuration for the problematic branch is \`${stringify(branch)}\`.`,
|
|||||||
|
|
||||||
Your configuration for the problematic branches is \`${stringify(branches)}\`.`,
|
Your configuration for the problematic branches is \`${stringify(branches)}\`.`,
|
||||||
}),
|
}),
|
||||||
|
|
||||||
ERELEASEBRANCHES: ({branches}) => ({
|
ERELEASEBRANCHES: ({branches}) => ({
|
||||||
message: 'The release branches are invalid in the `branches` configuration.',
|
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(
|
details: `A minimum of 1 and a maximum of 3 release branches are required in the [branches configuration](${linkify(
|
||||||
@@ -208,7 +190,6 @@ This may occur if your repository does not have a release branch, such as \`mast
|
|||||||
|
|
||||||
Your configuration for the problematic branches is \`${stringify(branches)}\`.`,
|
Your configuration for the problematic branches is \`${stringify(branches)}\`.`,
|
||||||
}),
|
}),
|
||||||
|
|
||||||
EPRERELEASEBRANCH: ({branch}) => ({
|
EPRERELEASEBRANCH: ({branch}) => ({
|
||||||
message: 'A pre-release branch configuration is invalid in the `branches` configuration.',
|
message: 'A pre-release branch configuration is invalid in the `branches` configuration.',
|
||||||
details: `Each pre-release branch in the [branches configuration](${linkify(
|
details: `Each pre-release branch in the [branches configuration](${linkify(
|
||||||
@@ -217,7 +198,6 @@ Your configuration for the problematic branches is \`${stringify(branches)}\`.`,
|
|||||||
|
|
||||||
Your configuration for the problematic branch is \`${stringify(branch)}\`.`,
|
Your configuration for the problematic branch is \`${stringify(branch)}\`.`,
|
||||||
}),
|
}),
|
||||||
|
|
||||||
EPRERELEASEBRANCHES: ({branches}) => ({
|
EPRERELEASEBRANCHES: ({branches}) => ({
|
||||||
message: 'The pre-release branches are invalid in the `branches` configuration.',
|
message: 'The pre-release branches are invalid in the `branches` configuration.',
|
||||||
details: `Each pre-release branch in the [branches configuration](${linkify(
|
details: `Each pre-release branch in the [branches configuration](${linkify(
|
||||||
@@ -226,7 +206,6 @@ Your configuration for the problematic branch is \`${stringify(branch)}\`.`,
|
|||||||
|
|
||||||
Your configuration for the problematic branches is \`${stringify(branches)}\`.`,
|
Your configuration for the problematic branches is \`${stringify(branches)}\`.`,
|
||||||
}),
|
}),
|
||||||
|
|
||||||
EINVALIDNEXTVERSION: ({nextRelease: {version}, branch: {name, range}, commits, validBranches}) => ({
|
EINVALIDNEXTVERSION: ({nextRelease: {version}, branch: {name, range}, commits, validBranches}) => ({
|
||||||
message: `The release \`${version}\` on branch \`${name}\` cannot be published as it is out of range.`,
|
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}\`.
|
details: `Based on the releases published on other branches, only versions within the range \`${range}\` can be published from branch \`${name}\`.
|
||||||
@@ -242,7 +221,6 @@ A valid branch could be ${wordsList(validBranches.map(({name}) => `\`${name}\``)
|
|||||||
|
|
||||||
See the [workflow configuration documentation](${linkify('docs/usage/workflow-configuration.md')}) for more details.`,
|
See the [workflow configuration documentation](${linkify('docs/usage/workflow-configuration.md')}) for more details.`,
|
||||||
}),
|
}),
|
||||||
|
|
||||||
EINVALIDMAINTENANCEMERGE: ({nextRelease: {channel, gitTag, version}, branch: {mergeRange, name}}) => ({
|
EINVALIDMAINTENANCEMERGE: ({nextRelease: {channel, gitTag, version}, branch: {mergeRange, name}}) => ({
|
||||||
message: `The release \`${version}\` on branch \`${name}\` cannot be published as it is out of range.`,
|
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.
|
details: `Only releases within the range \`${mergeRange}\` can be merged into the maintenance branch \`${name}\` and published to the \`${channel}\` distribution channel.
|
||||||
@@ -252,30 +230,3 @@ 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.`,
|
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;
|
|
||||||
|
|||||||
@@ -1,18 +1,17 @@
|
|||||||
import lodash from 'lodash'
|
/* eslint require-atomic-updates: off */
|
||||||
const {isString, isPlainObject} = lodash
|
|
||||||
|
|
||||||
import {getGitHead} from '../git.js';
|
const {isString, isPlainObject} = require('lodash');
|
||||||
import hideSensitive from '../hide-sensitive.js';
|
const {getGitHead} = require('../git');
|
||||||
import {hideSensitiveValues} from '../utils.js';
|
const hideSensitive = require('../hide-sensitive');
|
||||||
import {RELEASE_TYPE, RELEASE_NOTES_SEPARATOR} from './constants.js';
|
const {hideSensitiveValues} = require('../utils');
|
||||||
|
const {RELEASE_TYPE, RELEASE_NOTES_SEPARATOR} = require('./constants');
|
||||||
|
|
||||||
const exported = {
|
module.exports = {
|
||||||
verifyConditions: {
|
verifyConditions: {
|
||||||
required: false,
|
required: false,
|
||||||
dryRun: true,
|
dryRun: true,
|
||||||
pipelineConfig: () => ({settleAll: true}),
|
pipelineConfig: () => ({settleAll: true}),
|
||||||
},
|
},
|
||||||
|
|
||||||
analyzeCommits: {
|
analyzeCommits: {
|
||||||
default: ['@semantic-release/commit-analyzer'],
|
default: ['@semantic-release/commit-analyzer'],
|
||||||
required: true,
|
required: true,
|
||||||
@@ -30,13 +29,11 @@ const exported = {
|
|||||||
}, -1)
|
}, -1)
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
|
|
||||||
verifyRelease: {
|
verifyRelease: {
|
||||||
required: false,
|
required: false,
|
||||||
dryRun: true,
|
dryRun: true,
|
||||||
pipelineConfig: () => ({settleAll: true}),
|
pipelineConfig: () => ({settleAll: true}),
|
||||||
},
|
},
|
||||||
|
|
||||||
generateNotes: {
|
generateNotes: {
|
||||||
required: false,
|
required: false,
|
||||||
dryRun: true,
|
dryRun: true,
|
||||||
@@ -52,7 +49,6 @@ const exported = {
|
|||||||
}),
|
}),
|
||||||
postprocess: (results, {env}) => hideSensitive(env)(results.filter(Boolean).join(RELEASE_NOTES_SEPARATOR)),
|
postprocess: (results, {env}) => hideSensitive(env)(results.filter(Boolean).join(RELEASE_NOTES_SEPARATOR)),
|
||||||
},
|
},
|
||||||
|
|
||||||
prepare: {
|
prepare: {
|
||||||
required: false,
|
required: false,
|
||||||
dryRun: false,
|
dryRun: false,
|
||||||
@@ -71,7 +67,6 @@ const exported = {
|
|||||||
},
|
},
|
||||||
}),
|
}),
|
||||||
},
|
},
|
||||||
|
|
||||||
publish: {
|
publish: {
|
||||||
required: false,
|
required: false,
|
||||||
dryRun: false,
|
dryRun: false,
|
||||||
@@ -85,7 +80,6 @@ const exported = {
|
|||||||
}),
|
}),
|
||||||
}),
|
}),
|
||||||
},
|
},
|
||||||
|
|
||||||
addChannel: {
|
addChannel: {
|
||||||
required: false,
|
required: false,
|
||||||
dryRun: false,
|
dryRun: false,
|
||||||
@@ -99,14 +93,12 @@ const exported = {
|
|||||||
}),
|
}),
|
||||||
}),
|
}),
|
||||||
},
|
},
|
||||||
|
|
||||||
success: {
|
success: {
|
||||||
required: false,
|
required: false,
|
||||||
dryRun: false,
|
dryRun: false,
|
||||||
pipelineConfig: () => ({settleAll: true}),
|
pipelineConfig: () => ({settleAll: true}),
|
||||||
preprocess: ({releases, env, ...inputs}) => ({...inputs, env, releases: hideSensitiveValues(env, releases)}),
|
preprocess: ({releases, env, ...inputs}) => ({...inputs, env, releases: hideSensitiveValues(env, releases)}),
|
||||||
},
|
},
|
||||||
|
|
||||||
fail: {
|
fail: {
|
||||||
required: false,
|
required: false,
|
||||||
dryRun: false,
|
dryRun: false,
|
||||||
@@ -114,17 +106,3 @@ const exported = {
|
|||||||
preprocess: ({errors, env, ...inputs}) => ({...inputs, env, errors: hideSensitiveValues(env, errors)}),
|
preprocess: ({errors, env, ...inputs}) => ({...inputs, env, errors: hideSensitiveValues(env, errors)}),
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
export default exported;
|
|
||||||
|
|
||||||
export const {
|
|
||||||
verifyConditions,
|
|
||||||
analyzeCommits,
|
|
||||||
verifyRelease,
|
|
||||||
generateNotes,
|
|
||||||
prepare,
|
|
||||||
publish,
|
|
||||||
addChannel,
|
|
||||||
success,
|
|
||||||
fail,
|
|
||||||
} = exported;
|
|
||||||
|
|||||||
+3
-4
@@ -1,6 +1,5 @@
|
|||||||
import debugFactory from 'debug';
|
const debug = require('debug')('semantic-release:get-commits');
|
||||||
const debug = debugFactory('semantic-release:get-commits');
|
const {getCommits} = require('./git');
|
||||||
import {getCommits} from './git.js';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieve the list of commits on the current branch since the commit sha associated with the last release, or all the commits of the current branch if there is no last released version.
|
* Retrieve the list of commits on the current branch since the commit sha associated with the last release, or all the commits of the current branch if there is no last released version.
|
||||||
@@ -9,7 +8,7 @@ import {getCommits} from './git.js';
|
|||||||
*
|
*
|
||||||
* @return {Promise<Array<Object>>} The list of commits on the branch `branch` since the last release.
|
* @return {Promise<Array<Object>>} The list of commits on the branch `branch` since the last release.
|
||||||
*/
|
*/
|
||||||
export default async ({cwd, env, lastRelease: {gitHead: from}, nextRelease: {gitHead: to = 'HEAD'} = {}, logger}) => {
|
module.exports = async ({cwd, env, lastRelease: {gitHead: from}, nextRelease: {gitHead: to = 'HEAD'} = {}, logger}) => {
|
||||||
if (from) {
|
if (from) {
|
||||||
debug('Use from: %s', from);
|
debug('Use from: %s', from);
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
+10
-12
@@ -1,18 +1,16 @@
|
|||||||
import lodash from 'lodash'
|
const {castArray, pickBy, isNil, isString, isPlainObject} = require('lodash');
|
||||||
const {castArray, pickBy, isNil, isString, isPlainObject} = lodash
|
const readPkgUp = require('read-pkg-up');
|
||||||
import readPkgUp from 'read-pkg-up';
|
const {cosmiconfig} = require('cosmiconfig');
|
||||||
import {cosmiconfig} from 'cosmiconfig';
|
const resolveFrom = require('resolve-from');
|
||||||
import resolveFrom from 'resolve-from';
|
const debug = require('debug')('semantic-release:config');
|
||||||
import debugFactory from 'debug';
|
const {repoUrl} = require('./git');
|
||||||
const debug = debugFactory('semantic-release:config');
|
const PLUGINS_DEFINITIONS = require('./definitions/plugins');
|
||||||
import {repoUrl} from './git.js';
|
const plugins = require('./plugins');
|
||||||
import PLUGINS_DEFINITIONS from './definitions/plugins.js';
|
const {validatePlugin, parseConfig} = require('./plugins/utils');
|
||||||
import plugins from './plugins';
|
|
||||||
import {validatePlugin, parseConfig} from './plugins/utils.js';
|
|
||||||
|
|
||||||
const CONFIG_NAME = 'release';
|
const CONFIG_NAME = 'release';
|
||||||
|
|
||||||
export default async (context, cliOptions) => {
|
module.exports = async (context, cliOptions) => {
|
||||||
const {cwd, env} = context;
|
const {cwd, env} = context;
|
||||||
const {config, filepath} = (await cosmiconfig(CONFIG_NAME).search(cwd)) || {};
|
const {config, filepath} = (await cosmiconfig(CONFIG_NAME).search(cwd)) || {};
|
||||||
|
|
||||||
|
|||||||
+3
-3
@@ -1,7 +1,7 @@
|
|||||||
import SemanticReleaseError from '@semantic-release/error';
|
const SemanticReleaseError = require('@semantic-release/error');
|
||||||
import ERROR_DEFINITIONS from './definitions/errors.js';
|
const ERROR_DEFINITIONS = require('./definitions/errors');
|
||||||
|
|
||||||
export default (code, ctx = {}) => {
|
module.exports = (code, ctx = {}) => {
|
||||||
const {message, details} = ERROR_DEFINITIONS[code](ctx);
|
const {message, details} = ERROR_DEFINITIONS[code](ctx);
|
||||||
return new SemanticReleaseError(message, code, details);
|
return new SemanticReleaseError(message, code, details);
|
||||||
};
|
};
|
||||||
|
|||||||
+8
-10
@@ -1,10 +1,8 @@
|
|||||||
import {format} from 'url';
|
const {parse, format} = require('url'); // eslint-disable-line node/no-deprecated-api
|
||||||
import lodash from 'lodash'
|
const {isNil} = require('lodash');
|
||||||
const {isNil} = lodash
|
const hostedGitInfo = require('hosted-git-info');
|
||||||
import hostedGitInfo from 'hosted-git-info';
|
const {verifyAuth} = require('./git');
|
||||||
import {verifyAuth} from './git.js';
|
const debug = require('debug')('semantic-release:get-git-auth-url');
|
||||||
import debugFactory from 'debug';
|
|
||||||
const debug = debugFactory('semantic-release:get-git-auth-url');
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Machinery to format a repository URL with the given credentials
|
* Machinery to format a repository URL with the given credentials
|
||||||
@@ -18,7 +16,7 @@ const debug = debugFactory('semantic-release:get-git-auth-url');
|
|||||||
function formatAuthUrl(protocol, repositoryUrl, gitCredentials) {
|
function formatAuthUrl(protocol, repositoryUrl, gitCredentials) {
|
||||||
const [match, auth, host, basePort, path] =
|
const [match, auth, host, basePort, path] =
|
||||||
/^(?!.+:\/\/)(?:(?<auth>.*)@)?(?<host>.*?):(?<port>\d+)?:?\/?(?<path>.*)$/.exec(repositoryUrl) || [];
|
/^(?!.+:\/\/)(?:(?<auth>.*)@)?(?<host>.*?):(?<port>\d+)?:?\/?(?<path>.*)$/.exec(repositoryUrl) || [];
|
||||||
const {port, hostname, ...parsed} = new URL(
|
const {port, hostname, ...parsed} = parse(
|
||||||
match ? `ssh://${auth ? `${auth}@` : ''}${host}${basePort ? `:${basePort}` : ''}/${path}` : repositoryUrl
|
match ? `ssh://${auth ? `${auth}@` : ''}${host}${basePort ? `:${basePort}` : ''}/${path}` : repositoryUrl
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -59,7 +57,7 @@ async function ensureValidAuthUrl({cwd, env, branch}, authUrl) {
|
|||||||
*
|
*
|
||||||
* @return {String} The formatted Git repository URL.
|
* @return {String} The formatted Git repository URL.
|
||||||
*/
|
*/
|
||||||
export default async (context) => {
|
module.exports = async (context) => {
|
||||||
const {cwd, env, branch} = context;
|
const {cwd, env, branch} = context;
|
||||||
const GIT_TOKENS = {
|
const GIT_TOKENS = {
|
||||||
GIT_CREDENTIALS: undefined,
|
GIT_CREDENTIALS: undefined,
|
||||||
@@ -77,7 +75,7 @@ export default async (context) => {
|
|||||||
|
|
||||||
let {repositoryUrl} = context.options;
|
let {repositoryUrl} = context.options;
|
||||||
const info = hostedGitInfo.fromUrl(repositoryUrl, {noGitPlus: true});
|
const info = hostedGitInfo.fromUrl(repositoryUrl, {noGitPlus: true});
|
||||||
const {protocol, ...parsed} = new URL(repositoryUrl);
|
const {protocol, ...parsed} = parse(repositoryUrl);
|
||||||
|
|
||||||
if (info && info.getDefaultRepresentation() === 'shortcut') {
|
if (info && info.getDefaultRepresentation() === 'shortcut') {
|
||||||
// Expand shorthand URLs (such as `owner/repo` or `gitlab:owner/repo`)
|
// Expand shorthand URLs (such as `owner/repo` or `gitlab:owner/repo`)
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
import lodash from 'lodash'
|
const {isUndefined} = require('lodash');
|
||||||
const {isUndefined} = lodash
|
const semver = require('semver');
|
||||||
import semver from 'semver';
|
const {makeTag, isSameChannel} = require('./utils');
|
||||||
import {makeTag, isSameChannel} from './utils.js';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Last release.
|
* Last release.
|
||||||
@@ -27,7 +26,7 @@ import {makeTag, isSameChannel} from './utils.js';
|
|||||||
*
|
*
|
||||||
* @return {LastRelease} The last tagged release or empty object if none is found.
|
* @return {LastRelease} The last tagged release or empty object if none is found.
|
||||||
*/
|
*/
|
||||||
export default ({branch, options: {tagFormat}}, {before} = {}) => {
|
module.exports = ({branch, options: {tagFormat}}, {before} = {}) => {
|
||||||
const [{version, gitTag, channels} = {}] = branch.tags
|
const [{version, gitTag, channels} = {}] = branch.tags
|
||||||
.filter(
|
.filter(
|
||||||
(tag) =>
|
(tag) =>
|
||||||
|
|||||||
+3
-3
@@ -1,7 +1,7 @@
|
|||||||
import {Signale} from 'signale';
|
const {Signale} = require('signale');
|
||||||
import figures from 'figures';
|
const figures = require('figures');
|
||||||
|
|
||||||
export default ({stdout, stderr}) =>
|
module.exports = ({stdout, stderr}) =>
|
||||||
new Signale({
|
new Signale({
|
||||||
config: {displayTimestamp: true, underlineMessage: false, displayLabel: false},
|
config: {displayTimestamp: true, underlineMessage: false, displayLabel: false},
|
||||||
disabled: false,
|
disabled: false,
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
import semver from 'semver';
|
const semver = require('semver');
|
||||||
import {FIRST_RELEASE, FIRSTPRERELEASE} from './definitions/constants.js';
|
const {FIRST_RELEASE, FIRSTPRERELEASE} = require('./definitions/constants');
|
||||||
import {isSameChannel, getLatestVersion, tagsToVersions, highest} from './utils.js';
|
const {isSameChannel, getLatestVersion, tagsToVersions, highest} = require('./utils');
|
||||||
|
|
||||||
export default ({branch, nextRelease: {type, channel}, lastRelease, logger}) => {
|
module.exports = ({branch, nextRelease: {type, channel}, lastRelease, logger}) => {
|
||||||
let version;
|
let version;
|
||||||
if (lastRelease.version) {
|
if (lastRelease.version) {
|
||||||
const {major, minor, patch} = semver.parse(lastRelease.version);
|
const {major, minor, patch} = semver.parse(lastRelease.version);
|
||||||
|
|||||||
@@ -1,9 +1,8 @@
|
|||||||
import lodash from 'lodash'
|
const {uniqBy, intersection} = require('lodash');
|
||||||
const {uniqBy, intersection} = lodash
|
const semver = require('semver');
|
||||||
import semver from 'semver';
|
const semverDiff = require('semver-diff');
|
||||||
import semverDiff from 'semver-diff';
|
const getLastRelease = require('./get-last-release');
|
||||||
import getLastRelease from './get-last-release.js';
|
const {makeTag, getLowerBound} = require('./utils');
|
||||||
import {makeTag, getLowerBound} from './utils.js';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Find releases that have been merged from from a higher branch but not added on the channel of the current branch.
|
* Find releases that have been merged from from a higher branch but not added on the channel of the current branch.
|
||||||
@@ -12,7 +11,7 @@ import {makeTag, getLowerBound} from './utils.js';
|
|||||||
*
|
*
|
||||||
* @return {Array<Object>} Last release and next release to be added on the channel of the current branch.
|
* @return {Array<Object>} Last release and next release to be added on the channel of the current branch.
|
||||||
*/
|
*/
|
||||||
export default (context) => {
|
module.exports = (context) => {
|
||||||
const {
|
const {
|
||||||
branch,
|
branch,
|
||||||
branches,
|
branches,
|
||||||
|
|||||||
+6
-30
@@ -1,9 +1,8 @@
|
|||||||
import gitLogParser from 'git-log-parser';
|
const gitLogParser = require('git-log-parser');
|
||||||
import getStream from 'get-stream';
|
const getStream = require('get-stream');
|
||||||
import execa from 'execa';
|
const execa = require('execa');
|
||||||
import debugFactory from 'debug';
|
const debug = require('debug')('semantic-release:git');
|
||||||
const debug = debugFactory('semantic-release:git');
|
const {GIT_NOTE_REF} = require('./definitions/constants');
|
||||||
import {GIT_NOTE_REF} from './definitions/constants.js';
|
|
||||||
|
|
||||||
Object.assign(gitLogParser.fields, {hash: 'H', message: 'B', gitTags: 'd', committerDate: {key: 'ci', type: Date}});
|
Object.assign(gitLogParser.fields, {hash: 'H', message: 'B', gitTags: 'd', committerDate: {key: 'ci', type: Date}});
|
||||||
|
|
||||||
@@ -329,30 +328,7 @@ async function addNote(note, ref, execaOptions) {
|
|||||||
await execa('git', ['notes', '--ref', GIT_NOTE_REF, 'add', '-f', '-m', JSON.stringify(note), ref], execaOptions);
|
await execa('git', ['notes', '--ref', GIT_NOTE_REF, 'add', '-f', '-m', JSON.stringify(note), ref], execaOptions);
|
||||||
}
|
}
|
||||||
|
|
||||||
const exported = {
|
module.exports = {
|
||||||
getTagHead,
|
|
||||||
getTags,
|
|
||||||
getCommits,
|
|
||||||
getBranches,
|
|
||||||
isRefExists,
|
|
||||||
fetch,
|
|
||||||
fetchNotes,
|
|
||||||
getGitHead,
|
|
||||||
repoUrl,
|
|
||||||
isGitRepo,
|
|
||||||
verifyAuth,
|
|
||||||
tag,
|
|
||||||
push,
|
|
||||||
pushNotes,
|
|
||||||
verifyTagName,
|
|
||||||
isBranchUpToDate,
|
|
||||||
verifyBranchName,
|
|
||||||
getNote,
|
|
||||||
addNote,
|
|
||||||
};
|
|
||||||
|
|
||||||
export default exported;
|
|
||||||
export {
|
|
||||||
getTagHead,
|
getTagHead,
|
||||||
getTags,
|
getTags,
|
||||||
getCommits,
|
getCommits,
|
||||||
|
|||||||
@@ -1,8 +1,7 @@
|
|||||||
import lodash from 'lodash'
|
const {escapeRegExp, size, isString} = require('lodash');
|
||||||
const {escapeRegExp, size, isString} = lodash
|
const {SECRET_REPLACEMENT, SECRET_MIN_SIZE} = require('./definitions/constants');
|
||||||
import {SECRET_REPLACEMENT, SECRET_MIN_SIZE} from './definitions/constants.js';
|
|
||||||
|
|
||||||
export default (env) => {
|
module.exports = (env) => {
|
||||||
const toReplace = Object.keys(env).filter((envVar) => {
|
const toReplace = Object.keys(env).filter((envVar) => {
|
||||||
// https://github.com/semantic-release/semantic-release/issues/1558
|
// https://github.com/semantic-release/semantic-release/issues/1558
|
||||||
if (envVar === 'GOPRIVATE') {
|
if (envVar === 'GOPRIVATE') {
|
||||||
|
|||||||
@@ -1,13 +1,12 @@
|
|||||||
import lodash from 'lodash'
|
const {identity, isPlainObject, omit, castArray, isNil, isString} = require('lodash');
|
||||||
const {identity, isPlainObject, omit, castArray, isNil, isString} = lodash
|
const AggregateError = require('aggregate-error');
|
||||||
import AggregateError from 'aggregate-error';
|
const getError = require('../get-error');
|
||||||
import getError from '../get-error.js';
|
const PLUGINS_DEFINITIONS = require('../definitions/plugins');
|
||||||
import PLUGINS_DEFINITIONS from '../definitions/plugins.js';
|
const {validatePlugin, validateStep, loadPlugin, parseConfig} = require('./utils');
|
||||||
import {validatePlugin, validateStep, loadPlugin, parseConfig} from './utils.js';
|
const pipeline = require('./pipeline');
|
||||||
import pipeline from './pipeline.js';
|
const normalize = require('./normalize');
|
||||||
import normalize from './normalize.js';
|
|
||||||
|
|
||||||
export default (context, pluginsPath) => {
|
module.exports = (context, pluginsPath) => {
|
||||||
let {options, logger} = context;
|
let {options, logger} = context;
|
||||||
const errors = [];
|
const errors = [];
|
||||||
|
|
||||||
|
|||||||
@@ -1,13 +1,11 @@
|
|||||||
import lodash from 'lodash'
|
const {isPlainObject, isFunction, noop, cloneDeep, omit} = require('lodash');
|
||||||
const {isPlainObject, isFunction, noop, cloneDeep, omit} = lodash
|
const debug = require('debug')('semantic-release:plugins');
|
||||||
import debugFactory from 'debug';
|
const getError = require('../get-error');
|
||||||
const debug = debugFactory('semantic-release:plugins');
|
const {extractErrors} = require('../utils');
|
||||||
import getError from '../get-error.js';
|
const PLUGINS_DEFINITIONS = require('../definitions/plugins');
|
||||||
import {extractErrors} from '../utils.js';
|
const {loadPlugin, parseConfig} = require('./utils');
|
||||||
import PLUGINS_DEFINITIONS from '../definitions/plugins.js';
|
|
||||||
import {loadPlugin, parseConfig} from './utils.js';
|
|
||||||
|
|
||||||
export default (context, type, pluginOpt, pluginsPath) => {
|
module.exports = (context, type, pluginOpt, pluginsPath) => {
|
||||||
const {stdout, stderr, options, logger} = context;
|
const {stdout, stderr, options, logger} = context;
|
||||||
if (!pluginOpt) {
|
if (!pluginOpt) {
|
||||||
return noop;
|
return noop;
|
||||||
|
|||||||
@@ -1,8 +1,7 @@
|
|||||||
import lodash from 'lodash'
|
const {identity} = require('lodash');
|
||||||
const {identity} = lodash
|
const pReduce = require('p-reduce');
|
||||||
import pReduce from 'p-reduce';
|
const AggregateError = require('aggregate-error');
|
||||||
import AggregateError from 'aggregate-error';
|
const {extractErrors} = require('../utils');
|
||||||
import {extractErrors} from '../utils.js';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A Function that execute a list of function sequencially. If at least one Function ins the pipeline throws an Error or rejects, the pipeline function rejects as well.
|
* A Function that execute a list of function sequencially. If at least one Function ins the pipeline throws an Error or rejects, the pipeline function rejects as well.
|
||||||
@@ -26,7 +25,7 @@ import {extractErrors} from '../utils.js';
|
|||||||
*
|
*
|
||||||
* @return {Pipeline} A Function that execute the `steps` sequencially
|
* @return {Pipeline} A Function that execute the `steps` sequencially
|
||||||
*/
|
*/
|
||||||
export default (steps, {settleAll = false, getNextInput = identity, transform = identity} = {}) => async (input) => {
|
module.exports = (steps, {settleAll = false, getNextInput = identity, transform = identity} = {}) => async (input) => {
|
||||||
const results = [];
|
const results = [];
|
||||||
const errors = [];
|
const errors = [];
|
||||||
await pReduce(
|
await pReduce(
|
||||||
|
|||||||
+4
-13
@@ -1,7 +1,6 @@
|
|||||||
import {dirname} from 'path';
|
const {dirname} = require('path');
|
||||||
import lodash from 'lodash'
|
const {isString, isFunction, castArray, isArray, isPlainObject, isNil} = require('lodash');
|
||||||
const {isString, isFunction, castArray, isArray, isPlainObject, isNil} = lodash
|
const resolveFrom = require('resolve-from');
|
||||||
import resolveFrom from 'resolve-from';
|
|
||||||
|
|
||||||
const validateSteps = (conf) => {
|
const validateSteps = (conf) => {
|
||||||
return conf.every((conf) => {
|
return conf.every((conf) => {
|
||||||
@@ -66,12 +65,4 @@ function parseConfig(plugin) {
|
|||||||
return [path, config || {}];
|
return [path, config || {}];
|
||||||
}
|
}
|
||||||
|
|
||||||
const exported = {
|
module.exports = {validatePlugin, validateStep, loadPlugin, parseConfig};
|
||||||
validatePlugin,
|
|
||||||
validateStep,
|
|
||||||
loadPlugin,
|
|
||||||
parseConfig,
|
|
||||||
};
|
|
||||||
|
|
||||||
export default exported;
|
|
||||||
export {validatePlugin, validateStep, loadPlugin, parseConfig};
|
|
||||||
|
|||||||
+4
-24
@@ -1,7 +1,6 @@
|
|||||||
import lodash from 'lodash'
|
const {isFunction, union, template} = require('lodash');
|
||||||
const {isFunction, union, template} = lodash
|
const semver = require('semver');
|
||||||
import semver from 'semver';
|
const hideSensitive = require('./hide-sensitive');
|
||||||
import hideSensitive from './hide-sensitive.js';
|
|
||||||
|
|
||||||
function extractErrors(err) {
|
function extractErrors(err) {
|
||||||
return err && isFunction(err[Symbol.iterator]) ? [...err] : [err];
|
return err && isFunction(err[Symbol.iterator]) ? [...err] : [err];
|
||||||
@@ -83,26 +82,7 @@ function isSameChannel(channel, otherChannel) {
|
|||||||
return channel === otherChannel || (!channel && !otherChannel);
|
return channel === otherChannel || (!channel && !otherChannel);
|
||||||
}
|
}
|
||||||
|
|
||||||
const exported = {
|
module.exports = {
|
||||||
extractErrors,
|
|
||||||
hideSensitiveValues,
|
|
||||||
tagsToVersions,
|
|
||||||
isMajorRange,
|
|
||||||
isMaintenanceRange,
|
|
||||||
getUpperBound,
|
|
||||||
getLowerBound,
|
|
||||||
highest,
|
|
||||||
lowest,
|
|
||||||
getLatestVersion,
|
|
||||||
getEarliestVersion,
|
|
||||||
getFirstVersion,
|
|
||||||
getRange,
|
|
||||||
makeTag,
|
|
||||||
isSameChannel,
|
|
||||||
};
|
|
||||||
|
|
||||||
export default exported;
|
|
||||||
export {
|
|
||||||
extractErrors,
|
extractErrors,
|
||||||
hideSensitiveValues,
|
hideSensitiveValues,
|
||||||
tagsToVersions,
|
tagsToVersions,
|
||||||
|
|||||||
+5
-6
@@ -1,10 +1,9 @@
|
|||||||
import lodash from 'lodash'
|
const {template, isString, isPlainObject} = require('lodash');
|
||||||
const {template, isString, isPlainObject} = lodash
|
const AggregateError = require('aggregate-error');
|
||||||
import AggregateError from 'aggregate-error';
|
const {isGitRepo, verifyTagName} = require('./git');
|
||||||
import {isGitRepo, verifyTagName} from './git.js';
|
const getError = require('./get-error');
|
||||||
import getError from './get-error.js';
|
|
||||||
|
|
||||||
export default async (context) => {
|
module.exports = async (context) => {
|
||||||
const {
|
const {
|
||||||
cwd,
|
cwd,
|
||||||
env,
|
env,
|
||||||
|
|||||||
Generated
+959
-5850
File diff suppressed because it is too large
Load Diff
+12
-15
@@ -1,6 +1,5 @@
|
|||||||
{
|
{
|
||||||
"name": "semantic-release",
|
"name": "semantic-release",
|
||||||
"type": "module",
|
|
||||||
"description": "Automated semver compliant package publishing",
|
"description": "Automated semver compliant package publishing",
|
||||||
"version": "0.0.0-development",
|
"version": "0.0.0-development",
|
||||||
"author": "Stephan Bönnemann <stephan@boennemann.me> (http://boennemann.me)",
|
"author": "Stephan Bönnemann <stephan@boennemann.me> (http://boennemann.me)",
|
||||||
@@ -21,11 +20,11 @@
|
|||||||
"Pierre Vanduynslager (https://twitter.com/@pvdlg_)"
|
"Pierre Vanduynslager (https://twitter.com/@pvdlg_)"
|
||||||
],
|
],
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@semantic-release/commit-analyzer": "^8.0.0",
|
"@semantic-release/commit-analyzer": "^9.0.0",
|
||||||
"@semantic-release/error": "^2.2.0",
|
"@semantic-release/error": "^3.0.0",
|
||||||
"@semantic-release/github": "^7.0.0",
|
"@semantic-release/github": "^8.0.0",
|
||||||
"@semantic-release/npm": "^7.0.0",
|
"@semantic-release/npm": "^8.0.0",
|
||||||
"@semantic-release/release-notes-generator": "^9.0.0",
|
"@semantic-release/release-notes-generator": "^10.0.0",
|
||||||
"aggregate-error": "^3.0.0",
|
"aggregate-error": "^3.0.0",
|
||||||
"cosmiconfig": "^7.0.0",
|
"cosmiconfig": "^7.0.0",
|
||||||
"debug": "^4.0.0",
|
"debug": "^4.0.0",
|
||||||
@@ -52,21 +51,20 @@
|
|||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"ava": "3.15.0",
|
"ava": "3.15.0",
|
||||||
"cjs2esm": "^2.0.0",
|
|
||||||
"clear-module": "4.1.1",
|
"clear-module": "4.1.1",
|
||||||
"codecov": "3.8.2",
|
"codecov": "3.8.3",
|
||||||
"delay": "5.0.0",
|
"delay": "5.0.0",
|
||||||
"dockerode": "3.3.0",
|
"dockerode": "3.3.1",
|
||||||
"file-url": "3.0.0",
|
"file-url": "3.0.0",
|
||||||
"fs-extra": "10.0.0",
|
"fs-extra": "9.1.0",
|
||||||
"got": "11.8.2",
|
"got": "11.8.2",
|
||||||
"js-yaml": "4.1.0",
|
"js-yaml": "4.1.0",
|
||||||
"mockserver-client": "5.11.2",
|
"mockserver-client": "5.11.2",
|
||||||
"nock": "13.1.1",
|
"nock": "13.1.3",
|
||||||
"nyc": "15.1.0",
|
"nyc": "15.1.0",
|
||||||
"p-retry": "4.6.1",
|
"p-retry": "4.6.1",
|
||||||
"proxyquire": "2.1.3",
|
"proxyquire": "2.1.3",
|
||||||
"sinon": "11.1.1",
|
"sinon": "11.1.2",
|
||||||
"stream-buffers": "3.0.2",
|
"stream-buffers": "3.0.2",
|
||||||
"tempy": "1.0.1",
|
"tempy": "1.0.1",
|
||||||
"xo": "0.29.1"
|
"xo": "0.29.1"
|
||||||
@@ -94,7 +92,7 @@
|
|||||||
"version"
|
"version"
|
||||||
],
|
],
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"exports": "./index.js",
|
"main": "index.js",
|
||||||
"nyc": {
|
"nyc": {
|
||||||
"include": [
|
"include": [
|
||||||
"lib/**/*.js",
|
"lib/**/*.js",
|
||||||
@@ -131,8 +129,7 @@
|
|||||||
"prettier": true,
|
"prettier": true,
|
||||||
"space": true,
|
"space": true,
|
||||||
"rules": {
|
"rules": {
|
||||||
"unicorn/string-content": "off",
|
"unicorn/string-content": "off"
|
||||||
"import/extensions": "off"
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"renovate": {
|
"renovate": {
|
||||||
|
|||||||
@@ -1,8 +1,7 @@
|
|||||||
import test from 'ava';
|
const test = require('ava');
|
||||||
import lodash from 'lodash'
|
const {union} = require('lodash');
|
||||||
const {union} = lodash
|
const semver = require('semver');
|
||||||
import semver from 'semver';
|
const proxyquire = require('proxyquire');
|
||||||
import proxyquire from 'proxyquire';
|
|
||||||
|
|
||||||
const getBranch = (branches, branch) => branches.find(({name}) => name === branch);
|
const getBranch = (branches, branch) => branches.find(({name}) => name === branch);
|
||||||
const release = (branches, name, version) => getBranch(branches, name).tags.push({version});
|
const release = (branches, name, version) => getBranch(branches, name).tags.push({version});
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import test from 'ava';
|
const test = require('ava');
|
||||||
import expand from '../../lib/branches/expand.js';
|
const expand = require('../../lib/branches/expand');
|
||||||
import {gitRepo, gitCommits, gitCheckout, gitPush} from '../helpers/git-utils.js';
|
const {gitRepo, gitCommits, gitCheckout, gitPush} = require('../helpers/git-utils');
|
||||||
|
|
||||||
test('Expand branches defined with globs', async (t) => {
|
test('Expand branches defined with globs', async (t) => {
|
||||||
const {cwd, repositoryUrl} = await gitRepo(true);
|
const {cwd, repositoryUrl} = await gitRepo(true);
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import test from 'ava';
|
const test = require('ava');
|
||||||
import getTags from '../../lib/branches/get-tags.js';
|
const getTags = require('../../lib/branches/get-tags');
|
||||||
import {gitRepo, gitCommits, gitTagVersion, gitCheckout, gitAddNote} from '../helpers/git-utils.js';
|
const {gitRepo, gitCommits, gitTagVersion, gitCheckout, gitAddNote} = require('../helpers/git-utils');
|
||||||
|
|
||||||
test('Get the valid tags', async (t) => {
|
test('Get the valid tags', async (t) => {
|
||||||
const {cwd} = await gitRepo();
|
const {cwd} = await gitRepo();
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import test from 'ava';
|
const test = require('ava');
|
||||||
import normalize from '../../lib/branches/normalize.js';
|
const normalize = require('../../lib/branches/normalize');
|
||||||
|
|
||||||
const toTags = (versions) => versions.map((version) => ({version}));
|
const toTags = (versions) => versions.map((version) => ({version}));
|
||||||
|
|
||||||
|
|||||||
+16
-17
@@ -1,17 +1,16 @@
|
|||||||
import test from 'ava';
|
const test = require('ava');
|
||||||
import lodash from 'lodash'
|
const {escapeRegExp} = require('lodash');
|
||||||
const {escapeRegExp} = lodash
|
|
||||||
const proxyquire = require('proxyquire').noPreserveCache();
|
const proxyquire = require('proxyquire').noPreserveCache();
|
||||||
import sinon from 'sinon';
|
const {stub} = require('sinon');
|
||||||
import {SECRET_REPLACEMENT} from '../lib/definitions/constants.js';
|
const {SECRET_REPLACEMENT} = require('../lib/definitions/constants');
|
||||||
|
|
||||||
test.beforeEach((t) => {
|
test.beforeEach((t) => {
|
||||||
t.context.logs = '';
|
t.context.logs = '';
|
||||||
t.context.errors = '';
|
t.context.errors = '';
|
||||||
t.context.stdout = sinon.stubprocess.stdout, 'write').callsFake((value) => {
|
t.context.stdout = stub(process.stdout, 'write').callsFake((value) => {
|
||||||
t.context.logs += value.toString();
|
t.context.logs += value.toString();
|
||||||
});
|
});
|
||||||
t.context.stderr = sinon.stubprocess.stderr, 'write').callsFake((value) => {
|
t.context.stderr = stub(process.stderr, 'write').callsFake((value) => {
|
||||||
t.context.errors += value.toString();
|
t.context.errors += value.toString();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@@ -22,7 +21,7 @@ test.afterEach.always((t) => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
test.serial('Pass options to semantic-release API', async (t) => {
|
test.serial('Pass options to semantic-release API', async (t) => {
|
||||||
const run = sinon.stub).resolves(true);
|
const run = stub().resolves(true);
|
||||||
const argv = [
|
const argv = [
|
||||||
'',
|
'',
|
||||||
'',
|
'',
|
||||||
@@ -88,7 +87,7 @@ test.serial('Pass options to semantic-release API', async (t) => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
test.serial('Pass options to semantic-release API with alias arguments', async (t) => {
|
test.serial('Pass options to semantic-release API with alias arguments', async (t) => {
|
||||||
const run = sinon.stub).resolves(true);
|
const run = stub().resolves(true);
|
||||||
const argv = [
|
const argv = [
|
||||||
'',
|
'',
|
||||||
'',
|
'',
|
||||||
@@ -121,7 +120,7 @@ test.serial('Pass options to semantic-release API with alias arguments', async (
|
|||||||
});
|
});
|
||||||
|
|
||||||
test.serial('Pass unknown options to semantic-release API', async (t) => {
|
test.serial('Pass unknown options to semantic-release API', async (t) => {
|
||||||
const run = sinon.stub).resolves(true);
|
const run = stub().resolves(true);
|
||||||
const argv = ['', '', '--bool', '--first-option', 'value1', '--second-option', 'value2', '--second-option', 'value3'];
|
const argv = ['', '', '--bool', '--first-option', 'value1', '--second-option', 'value2', '--second-option', 'value3'];
|
||||||
const cli = proxyquire('../cli', {'.': run, process: {...process, argv}});
|
const cli = proxyquire('../cli', {'.': run, process: {...process, argv}});
|
||||||
|
|
||||||
@@ -135,7 +134,7 @@ test.serial('Pass unknown options to semantic-release API', async (t) => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
test.serial('Pass empty Array to semantic-release API for list option set to "false"', async (t) => {
|
test.serial('Pass empty Array to semantic-release API for list option set to "false"', async (t) => {
|
||||||
const run = sinon.stub).resolves(true);
|
const run = stub().resolves(true);
|
||||||
const argv = ['', '', '--publish', 'false'];
|
const argv = ['', '', '--publish', 'false'];
|
||||||
const cli = proxyquire('../cli', {'.': run, process: {...process, argv}});
|
const cli = proxyquire('../cli', {'.': run, process: {...process, argv}});
|
||||||
|
|
||||||
@@ -147,7 +146,7 @@ test.serial('Pass empty Array to semantic-release API for list option set to "fa
|
|||||||
});
|
});
|
||||||
|
|
||||||
test.serial('Do not set properties in option for which arg is not in command line', async (t) => {
|
test.serial('Do not set properties in option for which arg is not in command line', async (t) => {
|
||||||
const run = sinon.stub).resolves(true);
|
const run = stub().resolves(true);
|
||||||
const argv = ['', '', '-b', 'master'];
|
const argv = ['', '', '-b', 'master'];
|
||||||
const cli = proxyquire('../cli', {'.': run, process: {...process, argv}});
|
const cli = proxyquire('../cli', {'.': run, process: {...process, argv}});
|
||||||
|
|
||||||
@@ -164,7 +163,7 @@ test.serial('Do not set properties in option for which arg is not in command lin
|
|||||||
});
|
});
|
||||||
|
|
||||||
test.serial('Display help', async (t) => {
|
test.serial('Display help', async (t) => {
|
||||||
const run = sinon.stub).resolves(true);
|
const run = stub().resolves(true);
|
||||||
const argv = ['', '', '--help'];
|
const argv = ['', '', '--help'];
|
||||||
const cli = proxyquire('../cli', {'.': run, process: {...process, argv}});
|
const cli = proxyquire('../cli', {'.': run, process: {...process, argv}});
|
||||||
|
|
||||||
@@ -175,7 +174,7 @@ test.serial('Display help', async (t) => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
test.serial('Return error exitCode and prints help if called with a command', async (t) => {
|
test.serial('Return error exitCode and prints help if called with a command', async (t) => {
|
||||||
const run = sinon.stub).resolves(true);
|
const run = stub().resolves(true);
|
||||||
const argv = ['', '', 'pre'];
|
const argv = ['', '', 'pre'];
|
||||||
const cli = proxyquire('../cli', {'.': run, process: {...process, argv}});
|
const cli = proxyquire('../cli', {'.': run, process: {...process, argv}});
|
||||||
|
|
||||||
@@ -187,7 +186,7 @@ test.serial('Return error exitCode and prints help if called with a command', as
|
|||||||
});
|
});
|
||||||
|
|
||||||
test.serial('Return error exitCode if multiple plugin are set for single plugin', async (t) => {
|
test.serial('Return error exitCode if multiple plugin are set for single plugin', async (t) => {
|
||||||
const run = sinon.stub).resolves(true);
|
const run = stub().resolves(true);
|
||||||
const argv = ['', '', '--analyze-commits', 'analyze1', 'analyze2'];
|
const argv = ['', '', '--analyze-commits', 'analyze1', 'analyze2'];
|
||||||
const cli = proxyquire('../cli', {'.': run, process: {...process, argv}});
|
const cli = proxyquire('../cli', {'.': run, process: {...process, argv}});
|
||||||
|
|
||||||
@@ -199,7 +198,7 @@ test.serial('Return error exitCode if multiple plugin are set for single plugin'
|
|||||||
});
|
});
|
||||||
|
|
||||||
test.serial('Return error exitCode if semantic-release throw error', async (t) => {
|
test.serial('Return error exitCode if semantic-release throw error', async (t) => {
|
||||||
const run = sinon.stub).rejects(new Error('semantic-release error'));
|
const run = stub().rejects(new Error('semantic-release error'));
|
||||||
const argv = ['', ''];
|
const argv = ['', ''];
|
||||||
const cli = proxyquire('../cli', {'.': run, process: {...process, argv}});
|
const cli = proxyquire('../cli', {'.': run, process: {...process, argv}});
|
||||||
|
|
||||||
@@ -211,7 +210,7 @@ test.serial('Return error exitCode if semantic-release throw error', async (t) =
|
|||||||
|
|
||||||
test.serial('Hide sensitive environment variable values from the logs', async (t) => {
|
test.serial('Hide sensitive environment variable values from the logs', async (t) => {
|
||||||
const env = {MY_TOKEN: 'secret token'};
|
const env = {MY_TOKEN: 'secret token'};
|
||||||
const run = sinon.stub).rejects(new Error(`Throw error: Exposing token ${env.MY_TOKEN}`));
|
const run = stub().rejects(new Error(`Throw error: Exposing token ${env.MY_TOKEN}`));
|
||||||
const argv = ['', ''];
|
const argv = ['', ''];
|
||||||
const cli = proxyquire('../cli', {'.': run, process: {...process, argv, env: {...process.env, ...env}}});
|
const cli = proxyquire('../cli', {'.': run, process: {...process, argv, env: {...process.env, ...env}}});
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import test from 'ava';
|
const test = require('ava');
|
||||||
import {maintenance, prerelease, release} from '../../lib/definitions/branches.js';
|
const {maintenance, prerelease, release} = require('../../lib/definitions/branches');
|
||||||
|
|
||||||
test('A "maintenance" branch is identified by having a "range" property or a "name" formatted like "N.x", "N.x.x" or "N.N.x"', (t) => {
|
test('A "maintenance" branch is identified by having a "range" property or a "name" formatted like "N.x", "N.x.x" or "N.N.x"', (t) => {
|
||||||
t.true(maintenance.filter({name: '1.x.x'}));
|
t.true(maintenance.filter({name: '1.x.x'}));
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import test from 'ava';
|
const test = require('ava');
|
||||||
import plugins from '../../lib/definitions/plugins.js';
|
const plugins = require('../../lib/definitions/plugins');
|
||||||
import {RELEASE_NOTES_SEPARATOR, SECRET_REPLACEMENT} from '../../lib/definitions/constants.js';
|
const {RELEASE_NOTES_SEPARATOR, SECRET_REPLACEMENT} = require('../../lib/definitions/constants');
|
||||||
|
|
||||||
test('The "analyzeCommits" plugin output must be either undefined or a valid semver release type', (t) => {
|
test('The "analyzeCommits" plugin output must be either undefined or a valid semver release type', (t) => {
|
||||||
t.false(plugins.analyzeCommits.outputValidator('invalid'));
|
t.false(plugins.analyzeCommits.outputValidator('invalid'));
|
||||||
|
|||||||
Vendored
+1
-1
@@ -1 +1 @@
|
|||||||
export default () => {};
|
module.exports = () => {};
|
||||||
|
|||||||
Vendored
+1
-5
@@ -1,4 +1,4 @@
|
|||||||
const exported = {
|
module.exports = {
|
||||||
verifyConditions: () => {},
|
verifyConditions: () => {},
|
||||||
getLastRelease: () => {},
|
getLastRelease: () => {},
|
||||||
analyzeCommits: () => {},
|
analyzeCommits: () => {},
|
||||||
@@ -6,7 +6,3 @@ const exported = {
|
|||||||
generateNotes: () => {},
|
generateNotes: () => {},
|
||||||
publish: () => {},
|
publish: () => {},
|
||||||
};
|
};
|
||||||
|
|
||||||
export default exported;
|
|
||||||
|
|
||||||
export const {verifyConditions, getLastRelease, analyzeCommits, verifyRelease, generateNotes, publish} = exported;
|
|
||||||
|
|||||||
+2
-2
@@ -1,4 +1,4 @@
|
|||||||
import SemanticReleaseError from '@semantic-release/error';
|
const SemanticReleaseError = require('@semantic-release/error');
|
||||||
|
|
||||||
class InheritedError extends SemanticReleaseError {
|
class InheritedError extends SemanticReleaseError {
|
||||||
constructor(message, code) {
|
constructor(message, code) {
|
||||||
@@ -9,6 +9,6 @@ class InheritedError extends SemanticReleaseError {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export default () => {
|
module.exports = () => {
|
||||||
throw new InheritedError('Inherited error', 'EINHERITED');
|
throw new InheritedError('Inherited error', 'EINHERITED');
|
||||||
};
|
};
|
||||||
|
|||||||
Vendored
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
export default () => {
|
module.exports = () => {
|
||||||
const error = new Error('a');
|
const error = new Error('a');
|
||||||
error.errorProperty = 'errorProperty';
|
error.errorProperty = 'errorProperty';
|
||||||
throw error;
|
throw error;
|
||||||
|
|||||||
Vendored
+2
-2
@@ -1,5 +1,5 @@
|
|||||||
import AggregateError from 'aggregate-error';
|
const AggregateError = require('aggregate-error');
|
||||||
|
|
||||||
export default () => {
|
module.exports = () => {
|
||||||
throw new AggregateError([new Error('a'), new Error('b')]);
|
throw new AggregateError([new Error('a'), new Error('b')]);
|
||||||
};
|
};
|
||||||
|
|||||||
Vendored
+1
-1
@@ -1 +1 @@
|
|||||||
export default (pluginConfig, context) => context;
|
module.exports = (pluginConfig, context) => context;
|
||||||
|
|||||||
Vendored
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
export default (pluginConfig, {env, logger}) => {
|
module.exports = (pluginConfig, {env, logger}) => {
|
||||||
console.log(`Console: Exposing token ${env.MY_TOKEN}`);
|
console.log(`Console: Exposing token ${env.MY_TOKEN}`);
|
||||||
logger.log(`Log: Exposing token ${env.MY_TOKEN}`);
|
logger.log(`Log: Exposing token ${env.MY_TOKEN}`);
|
||||||
logger.error(`Error: Console token ${env.MY_TOKEN}`);
|
logger.error(`Error: Console token ${env.MY_TOKEN}`);
|
||||||
|
|||||||
Vendored
+1
-1
@@ -1 +1 @@
|
|||||||
export default () => {};
|
module.exports = () => {};
|
||||||
|
|||||||
+1
-1
@@ -1 +1 @@
|
|||||||
export default (pluginConfig, context) => ({pluginConfig, context});
|
module.exports = (pluginConfig, context) => ({pluginConfig, context});
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
import test from 'ava';
|
const test = require('ava');
|
||||||
import sinon from 'sinon';
|
const {stub} = require('sinon');
|
||||||
import getCommits from '../lib/get-commits.js';
|
const getCommits = require('../lib/get-commits');
|
||||||
import {gitRepo, gitCommits, gitDetachedHead} from './helpers/git-utils.js';
|
const {gitRepo, gitCommits, gitDetachedHead} = require('./helpers/git-utils');
|
||||||
|
|
||||||
test.beforeEach((t) => {
|
test.beforeEach((t) => {
|
||||||
// Stub the logger functions
|
// Stub the logger functions
|
||||||
t.context.log = sinon.stub();
|
t.context.log = stub();
|
||||||
t.context.error = sinon.stub();
|
t.context.error = stub();
|
||||||
t.context.logger = {log: t.context.log, error: t.context.error};
|
t.context.logger = {log: t.context.log, error: t.context.error};
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
+10
-11
@@ -1,13 +1,12 @@
|
|||||||
import path from 'path';
|
const path = require('path');
|
||||||
import {format} from 'util';
|
const {format} = require('util');
|
||||||
import test from 'ava';
|
const test = require('ava');
|
||||||
import {writeFile, outputJson} from 'fs-extra';
|
const {writeFile, outputJson} = require('fs-extra');
|
||||||
import lodash from 'lodash'
|
const {omit} = require('lodash');
|
||||||
const {omit} = lodash
|
const proxyquire = require('proxyquire');
|
||||||
import proxyquire from 'proxyquire';
|
const {stub} = require('sinon');
|
||||||
import sinon from 'sinon';
|
const yaml = require('js-yaml');
|
||||||
import yaml from 'js-yaml';
|
const {gitRepo, gitTagVersion, gitCommits, gitShallowClone, gitAddConfig} = require('./helpers/git-utils');
|
||||||
import {gitRepo, gitTagVersion, gitCommits, gitShallowClone, gitAddConfig} from './helpers/git-utils.js';
|
|
||||||
|
|
||||||
const DEFAULT_PLUGINS = [
|
const DEFAULT_PLUGINS = [
|
||||||
'@semantic-release/commit-analyzer',
|
'@semantic-release/commit-analyzer',
|
||||||
@@ -17,7 +16,7 @@ const DEFAULT_PLUGINS = [
|
|||||||
];
|
];
|
||||||
|
|
||||||
test.beforeEach((t) => {
|
test.beforeEach((t) => {
|
||||||
t.context.plugins = sinon.stub).returns({});
|
t.context.plugins = stub().returns({});
|
||||||
t.context.getConfig = proxyquire('../lib/get-config', {'./plugins': t.context.plugins});
|
t.context.getConfig = proxyquire('../lib/get-config', {'./plugins': t.context.plugins});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import test from 'ava';
|
const test = require('ava');
|
||||||
import getAuthUrl from '../lib/get-git-auth-url.js';
|
const getAuthUrl = require('../lib/get-git-auth-url');
|
||||||
import {gitRepo} from './helpers/git-utils.js';
|
const {gitRepo} = require('./helpers/git-utils');
|
||||||
|
|
||||||
const env = {GIT_ASKPASS: 'echo', GIT_TERMINAL_PROMPT: 0};
|
const env = {GIT_ASKPASS: 'echo', GIT_TERMINAL_PROMPT: 0};
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import test from 'ava';
|
const test = require('ava');
|
||||||
import getLastRelease from '../lib/get-last-release.js';
|
const getLastRelease = require('../lib/get-last-release');
|
||||||
|
|
||||||
test('Get the highest non-prerelease valid tag', (t) => {
|
test('Get the highest non-prerelease valid tag', (t) => {
|
||||||
const result = getLastRelease({
|
const result = getLastRelease({
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import test from 'ava';
|
const test = require('ava');
|
||||||
import {spy} from 'sinon';
|
const {spy} = require('sinon');
|
||||||
import getLogger from '../lib/get-logger.js';
|
const getLogger = require('../lib/get-logger');
|
||||||
|
|
||||||
test('Expose "error", "success" and "log" functions', (t) => {
|
test('Expose "error", "success" and "log" functions', (t) => {
|
||||||
const stdout = spy();
|
const stdout = spy();
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
import test from 'ava';
|
const test = require('ava');
|
||||||
import sinon from 'sinon';
|
const {stub} = require('sinon');
|
||||||
import getNextVersion from '../lib/get-next-version.js';
|
const getNextVersion = require('../lib/get-next-version');
|
||||||
|
|
||||||
test.beforeEach((t) => {
|
test.beforeEach((t) => {
|
||||||
// Stub the logger functions
|
// Stub the logger functions
|
||||||
t.context.log = sinon.stub);
|
t.context.log = stub();
|
||||||
t.context.logger = {log: t.context.log};
|
t.context.logger = {log: t.context.log};
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import test from 'ava';
|
const test = require('ava');
|
||||||
import getReleaseToAdd from '../lib/get-release-to-add.js';
|
const getReleaseToAdd = require('../lib/get-release-to-add');
|
||||||
|
|
||||||
test('Return versions merged from release to maintenance branch, excluding lower than branch start range', (t) => {
|
test('Return versions merged from release to maintenance branch, excluding lower than branch start range', (t) => {
|
||||||
const result = getReleaseToAdd({
|
const result = getReleaseToAdd({
|
||||||
|
|||||||
+6
-8
@@ -1,7 +1,6 @@
|
|||||||
import test from 'ava';
|
const test = require('ava');
|
||||||
import tempy from 'tempy';
|
const tempy = require('tempy');
|
||||||
|
const {
|
||||||
import {
|
|
||||||
getTagHead,
|
getTagHead,
|
||||||
isRefExists,
|
isRefExists,
|
||||||
fetch,
|
fetch,
|
||||||
@@ -17,9 +16,8 @@ import {
|
|||||||
getNote,
|
getNote,
|
||||||
addNote,
|
addNote,
|
||||||
fetchNotes,
|
fetchNotes,
|
||||||
} from '../lib/git.js';
|
} = require('../lib/git');
|
||||||
|
const {
|
||||||
import {
|
|
||||||
gitRepo,
|
gitRepo,
|
||||||
gitCommits,
|
gitCommits,
|
||||||
gitCheckout,
|
gitCheckout,
|
||||||
@@ -36,7 +34,7 @@ import {
|
|||||||
gitGetNote,
|
gitGetNote,
|
||||||
gitFetch,
|
gitFetch,
|
||||||
initGit,
|
initGit,
|
||||||
} from './helpers/git-utils.js';
|
} = require('./helpers/git-utils');
|
||||||
|
|
||||||
test('Get the last commit sha', async (t) => {
|
test('Get the last commit sha', async (t) => {
|
||||||
// Create a git repository, set the current working directory at the root of the repo
|
// Create a git repository, set the current working directory at the root of the repo
|
||||||
|
|||||||
@@ -0,0 +1,23 @@
|
|||||||
|
storage: /verdaccio/storage/data
|
||||||
|
plugins: /verdaccio/plugins
|
||||||
|
web:
|
||||||
|
title: Verdaccio
|
||||||
|
auth:
|
||||||
|
htpasswd:
|
||||||
|
file: /verdaccio/storage/htpasswd
|
||||||
|
packages:
|
||||||
|
'@*/*':
|
||||||
|
access: $all
|
||||||
|
publish: $authenticated
|
||||||
|
unpublish: $authenticated
|
||||||
|
'**':
|
||||||
|
access: $all
|
||||||
|
publish: $authenticated
|
||||||
|
unpublish: $authenticated
|
||||||
|
server:
|
||||||
|
keepAliveTimeout: 60
|
||||||
|
middlewares:
|
||||||
|
audit:
|
||||||
|
enabled: true
|
||||||
|
logs:
|
||||||
|
- { type: stdout, format: pretty, level: http }
|
||||||
@@ -1,10 +1,10 @@
|
|||||||
import tempy from 'tempy';
|
const tempy = require('tempy');
|
||||||
import execa from 'execa';
|
const execa = require('execa');
|
||||||
import fileUrl from 'file-url';
|
const fileUrl = require('file-url');
|
||||||
import pEachSeries from 'p-each-series';
|
const pEachSeries = require('p-each-series');
|
||||||
import gitLogParser from 'git-log-parser';
|
const gitLogParser = require('git-log-parser');
|
||||||
import getStream from 'get-stream';
|
const getStream = require('get-stream');
|
||||||
import {GIT_NOTE_REF} from '../../lib/definitions/constants.js';
|
const {GIT_NOTE_REF} = require('../../lib/definitions/constants');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Commit message information.
|
* Commit message information.
|
||||||
@@ -323,33 +323,7 @@ async function gitGetNote(ref, execaOptions) {
|
|||||||
return (await execa('git', ['notes', '--ref', GIT_NOTE_REF, 'show', ref], execaOptions)).stdout;
|
return (await execa('git', ['notes', '--ref', GIT_NOTE_REF, 'show', ref], execaOptions)).stdout;
|
||||||
}
|
}
|
||||||
|
|
||||||
const exported = {
|
module.exports = {
|
||||||
initGit,
|
|
||||||
gitRepo,
|
|
||||||
initBareRepo,
|
|
||||||
gitCommits,
|
|
||||||
gitGetCommits,
|
|
||||||
gitCheckout,
|
|
||||||
gitFetch,
|
|
||||||
gitHead,
|
|
||||||
gitTagVersion,
|
|
||||||
gitShallowClone,
|
|
||||||
gitDetachedHead,
|
|
||||||
gitDetachedHeadFromBranch,
|
|
||||||
gitAddConfig,
|
|
||||||
gitTagHead,
|
|
||||||
gitRemoteTagHead,
|
|
||||||
gitCommitTag,
|
|
||||||
gitPush,
|
|
||||||
merge,
|
|
||||||
mergeFf,
|
|
||||||
rebase,
|
|
||||||
gitAddNote,
|
|
||||||
gitGetNote,
|
|
||||||
};
|
|
||||||
|
|
||||||
export default exported;
|
|
||||||
export {
|
|
||||||
initGit,
|
initGit,
|
||||||
gitRepo,
|
gitRepo,
|
||||||
initBareRepo,
|
initBareRepo,
|
||||||
|
|||||||
+5
-13
@@ -1,7 +1,7 @@
|
|||||||
import Docker from 'dockerode';
|
const Docker = require('dockerode');
|
||||||
import getStream from 'get-stream';
|
const getStream = require('get-stream');
|
||||||
import pRetry from 'p-retry';
|
const pRetry = require('p-retry');
|
||||||
import {initBareRepo, gitShallowClone} from './git-utils.js';
|
const {initBareRepo, gitShallowClone} = require('./git-utils');
|
||||||
|
|
||||||
const IMAGE = 'pvdlg/docker-gitbox:latest';
|
const IMAGE = 'pvdlg/docker-gitbox:latest';
|
||||||
const SERVER_PORT = 80;
|
const SERVER_PORT = 80;
|
||||||
@@ -69,12 +69,4 @@ async function createRepo(name, branch = 'master', description = `Repository ${n
|
|||||||
return {cwd, repositoryUrl, authUrl};
|
return {cwd, repositoryUrl, authUrl};
|
||||||
}
|
}
|
||||||
|
|
||||||
const exported = {
|
module.exports = {start, stop, gitCredential, createRepo};
|
||||||
start,
|
|
||||||
stop,
|
|
||||||
gitCredential,
|
|
||||||
createRepo,
|
|
||||||
};
|
|
||||||
|
|
||||||
export default exported;
|
|
||||||
export {start, stop, gitCredential, createRepo};
|
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
import Docker from 'dockerode';
|
const Docker = require('dockerode');
|
||||||
import getStream from 'get-stream';
|
const getStream = require('get-stream');
|
||||||
import got from 'got';
|
const got = require('got');
|
||||||
import pRetry from 'p-retry';
|
const pRetry = require('p-retry');
|
||||||
import {mockServerClient} from 'mockserver-client';
|
const {mockServerClient} = require('mockserver-client');
|
||||||
|
|
||||||
const IMAGE = 'jamesdbloom/mockserver:latest';
|
const IMAGE = 'jamesdbloom/mockserver:latest';
|
||||||
const MOCK_SERVER_PORT = 1080;
|
const MOCK_SERVER_PORT = 1080;
|
||||||
@@ -100,13 +100,4 @@ function verify(expectation) {
|
|||||||
return client.verify(expectation);
|
return client.verify(expectation);
|
||||||
}
|
}
|
||||||
|
|
||||||
const exported = {
|
module.exports = {start, stop, mock, verify, url};
|
||||||
start,
|
|
||||||
stop,
|
|
||||||
mock,
|
|
||||||
verify,
|
|
||||||
url,
|
|
||||||
};
|
|
||||||
|
|
||||||
export default exported;
|
|
||||||
export {start, stop, mock, verify, url};
|
|
||||||
|
|||||||
@@ -1,15 +1,13 @@
|
|||||||
import Docker from 'dockerode';
|
const Docker = require('dockerode');
|
||||||
import getStream from 'get-stream';
|
const getStream = require('get-stream');
|
||||||
import got from 'got';
|
const got = require('got');
|
||||||
import delay from 'delay';
|
const path = require('path');
|
||||||
import pRetry from 'p-retry';
|
const delay = require('delay');
|
||||||
|
const pRetry = require('p-retry');
|
||||||
|
|
||||||
const IMAGE = 'semanticrelease/npm-registry-docker:latest';
|
const IMAGE = 'verdaccio/verdaccio:4';
|
||||||
const SERVER_PORT = 15986;
|
const REGISTRY_PORT = 4873;
|
||||||
const COUCHDB_PORT = 5984;
|
const REGISTRY_HOST = 'localhost';
|
||||||
const SERVER_HOST = 'localhost';
|
|
||||||
const COUCHDB_USER = 'admin';
|
|
||||||
const COUCHDB_PASSWORD = 'password';
|
|
||||||
const NPM_USERNAME = 'integration';
|
const NPM_USERNAME = 'integration';
|
||||||
const NPM_PASSWORD = 'suchsecure';
|
const NPM_PASSWORD = 'suchsecure';
|
||||||
const NPM_EMAIL = 'integration@test.com';
|
const NPM_EMAIL = 'integration@test.com';
|
||||||
@@ -25,8 +23,8 @@ async function start() {
|
|||||||
container = await docker.createContainer({
|
container = await docker.createContainer({
|
||||||
Tty: true,
|
Tty: true,
|
||||||
Image: IMAGE,
|
Image: IMAGE,
|
||||||
PortBindings: {[`${COUCHDB_PORT}/tcp`]: [{HostPort: `${SERVER_PORT}`}]},
|
PortBindings: {[`${REGISTRY_PORT}/tcp`]: [{HostPort: `${REGISTRY_PORT}`}]},
|
||||||
Env: [`COUCHDB_USER=${COUCHDB_USER}`, `COUCHDB_PASSWORD=${COUCHDB_PASSWORD}`],
|
Binds: [`${path.join(__dirname, 'config.yaml')}:/verdaccio/conf/config.yaml`],
|
||||||
});
|
});
|
||||||
|
|
||||||
await container.start();
|
await container.start();
|
||||||
@@ -34,7 +32,7 @@ async function start() {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
// Wait for the registry to be ready
|
// Wait for the registry to be ready
|
||||||
await pRetry(() => got(`http://${SERVER_HOST}:${SERVER_PORT}/registry/_design/app`, {cache: false}), {
|
await pRetry(() => got(`http://${REGISTRY_HOST}:${REGISTRY_PORT}/`, {cache: false}), {
|
||||||
retries: 7,
|
retries: 7,
|
||||||
minTimeout: 1000,
|
minTimeout: 1000,
|
||||||
factor: 2,
|
factor: 2,
|
||||||
@@ -44,9 +42,7 @@ async function start() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Create user
|
// Create user
|
||||||
await got(`http://${SERVER_HOST}:${SERVER_PORT}/_users/org.couchdb.user:${NPM_USERNAME}`, {
|
await got(`http://${REGISTRY_HOST}:${REGISTRY_PORT}/-/user/org.couchdb.user:${NPM_USERNAME}`, {
|
||||||
username: COUCHDB_USER,
|
|
||||||
password: COUCHDB_PASSWORD,
|
|
||||||
method: 'PUT',
|
method: 'PUT',
|
||||||
json: {
|
json: {
|
||||||
_id: `org.couchdb.user:${NPM_USERNAME}`,
|
_id: `org.couchdb.user:${NPM_USERNAME}`,
|
||||||
@@ -59,7 +55,7 @@ async function start() {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
const url = `http://${SERVER_HOST}:${SERVER_PORT}/registry/_design/app/_rewrite/`;
|
const url = `http://${REGISTRY_HOST}:${REGISTRY_PORT}/`;
|
||||||
|
|
||||||
const authEnv = {
|
const authEnv = {
|
||||||
npm_config_registry: url, // eslint-disable-line camelcase
|
npm_config_registry: url, // eslint-disable-line camelcase
|
||||||
@@ -76,12 +72,4 @@ async function stop() {
|
|||||||
await container.remove();
|
await container.remove();
|
||||||
}
|
}
|
||||||
|
|
||||||
const exported = {
|
module.exports = {start, stop, authEnv, url};
|
||||||
start,
|
|
||||||
stop,
|
|
||||||
authEnv,
|
|
||||||
url,
|
|
||||||
};
|
|
||||||
|
|
||||||
export default exported;
|
|
||||||
export {start, stop, authEnv, url};
|
|
||||||
|
|||||||
@@ -1,12 +1,7 @@
|
|||||||
import execa from 'execa';
|
const execa = require('execa');
|
||||||
|
|
||||||
async function npmView(packageName, env) {
|
async function npmView(packageName, env) {
|
||||||
return JSON.parse((await execa('npm', ['view', packageName, '--json'], {env})).stdout);
|
return JSON.parse((await execa('npm', ['view', packageName, '--json'], {env})).stdout);
|
||||||
}
|
}
|
||||||
|
|
||||||
const exported = {
|
module.exports = {npmView};
|
||||||
npmView,
|
|
||||||
};
|
|
||||||
|
|
||||||
export default exported;
|
|
||||||
export {npmView};
|
|
||||||
|
|||||||
@@ -1,8 +1,7 @@
|
|||||||
import test from 'ava';
|
const test = require('ava');
|
||||||
import lodash from 'lodash'
|
const {repeat} = require('lodash');
|
||||||
const {repeat} = lodash
|
const hideSensitive = require('../lib/hide-sensitive');
|
||||||
import hideSensitive from '../lib/hide-sensitive.js';
|
const {SECRET_REPLACEMENT, SECRET_MIN_SIZE} = require('../lib/definitions/constants');
|
||||||
import {SECRET_REPLACEMENT, SECRET_MIN_SIZE} from '../lib/definitions/constants.js';
|
|
||||||
|
|
||||||
test('Replace multiple sensitive environment variable values', (t) => {
|
test('Replace multiple sensitive environment variable values', (t) => {
|
||||||
const env = {SOME_PASSWORD: 'password', SOME_TOKEN: 'secret'};
|
const env = {SOME_PASSWORD: 'password', SOME_TOKEN: 'secret'};
|
||||||
|
|||||||
+214
-216
@@ -1,15 +1,13 @@
|
|||||||
import test from 'ava';
|
const test = require('ava');
|
||||||
import lodash from 'lodash'
|
const {escapeRegExp, isString, sortBy, omit} = require('lodash');
|
||||||
const {escapeRegExp, isString, sortBy, omit} = lodash
|
const proxyquire = require('proxyquire');
|
||||||
import proxyquire from 'proxyquire';
|
const {spy, stub} = require('sinon');
|
||||||
import sinon from 'sinon';
|
const {WritableStreamBuffer} = require('stream-buffers');
|
||||||
import {WritableStreamBuffer} from 'stream-buffers';
|
const AggregateError = require('aggregate-error');
|
||||||
import AggregateError from 'aggregate-error';
|
const SemanticReleaseError = require('@semantic-release/error');
|
||||||
import SemanticReleaseError from '@semantic-release/error';
|
const {COMMIT_NAME, COMMIT_EMAIL, SECRET_REPLACEMENT} = require('../lib/definitions/constants');
|
||||||
import {COMMIT_NAME, COMMIT_EMAIL, SECRET_REPLACEMENT} from '../lib/definitions/constants.js';
|
const {
|
||||||
|
gitHead: getGitHead,
|
||||||
import {
|
|
||||||
gitHead as getGitHead,
|
|
||||||
gitCheckout,
|
gitCheckout,
|
||||||
gitTagHead,
|
gitTagHead,
|
||||||
gitRepo,
|
gitRepo,
|
||||||
@@ -23,17 +21,17 @@ import {
|
|||||||
rebase,
|
rebase,
|
||||||
gitAddNote,
|
gitAddNote,
|
||||||
gitGetNote,
|
gitGetNote,
|
||||||
} from './helpers/git-utils.js';
|
} = require('./helpers/git-utils');
|
||||||
|
|
||||||
const requireNoCache = proxyquire.noPreserveCache();
|
const requireNoCache = proxyquire.noPreserveCache();
|
||||||
const pluginNoop = require.resolve('./fixtures/plugin-noop');
|
const pluginNoop = require.resolve('./fixtures/plugin-noop');
|
||||||
|
|
||||||
test.beforeEach((t) => {
|
test.beforeEach((t) => {
|
||||||
// Stub the logger functions
|
// Stub the logger functions
|
||||||
t.context.log = sinon.spy();
|
t.context.log = spy();
|
||||||
t.context.error = sinon.spy();
|
t.context.error = spy();
|
||||||
t.context.success = sinon.spy();
|
t.context.success = spy();
|
||||||
t.context.warn = sinon.spy();
|
t.context.warn = spy();
|
||||||
t.context.logger = {
|
t.context.logger = {
|
||||||
log: t.context.log,
|
log: t.context.log,
|
||||||
error: t.context.error,
|
error: t.context.error,
|
||||||
@@ -75,19 +73,19 @@ test('Plugins are called with expected values', async (t) => {
|
|||||||
const notes1 = 'Release notes 1';
|
const notes1 = 'Release notes 1';
|
||||||
const notes2 = 'Release notes 2';
|
const notes2 = 'Release notes 2';
|
||||||
const notes3 = 'Release notes 3';
|
const notes3 = 'Release notes 3';
|
||||||
const verifyConditions1 = sinon.stub().resolves();
|
const verifyConditions1 = stub().resolves();
|
||||||
const verifyConditions2 = sinon.stub().resolves();
|
const verifyConditions2 = stub().resolves();
|
||||||
const analyzeCommits = sinon.stub().resolves(nextRelease.type);
|
const analyzeCommits = stub().resolves(nextRelease.type);
|
||||||
const verifyRelease = sinon.stub().resolves();
|
const verifyRelease = stub().resolves();
|
||||||
const generateNotes1 = sinon.stub().resolves(notes1);
|
const generateNotes1 = stub().resolves(notes1);
|
||||||
const generateNotes2 = sinon.stub().resolves(notes2);
|
const generateNotes2 = stub().resolves(notes2);
|
||||||
const generateNotes3 = sinon.stub().resolves(notes3);
|
const generateNotes3 = stub().resolves(notes3);
|
||||||
const release1 = {name: 'Release 1', url: 'https://release1.com'};
|
const release1 = {name: 'Release 1', url: 'https://release1.com'};
|
||||||
const release2 = {name: 'Release 2', url: 'https://release2.com'};
|
const release2 = {name: 'Release 2', url: 'https://release2.com'};
|
||||||
const addChannel = sinon.stub().resolves(release1);
|
const addChannel = stub().resolves(release1);
|
||||||
const prepare = sinon.stub().resolves();
|
const prepare = stub().resolves();
|
||||||
const publish = sinon.stub().resolves(release2);
|
const publish = stub().resolves(release2);
|
||||||
const success = sinon.stub().resolves();
|
const success = stub().resolves();
|
||||||
const env = {};
|
const env = {};
|
||||||
const config = {
|
const config = {
|
||||||
branches: [{name: 'master'}, {name: 'next'}],
|
branches: [{name: 'master'}, {name: 'next'}],
|
||||||
@@ -410,15 +408,15 @@ test('Use custom tag format', async (t) => {
|
|||||||
const config = {branches: 'master', repositoryUrl, globalOpt: 'global', tagFormat: `test-\${version}`};
|
const config = {branches: 'master', repositoryUrl, globalOpt: 'global', tagFormat: `test-\${version}`};
|
||||||
const options = {
|
const options = {
|
||||||
...config,
|
...config,
|
||||||
verifyConditions: sinon.stub().resolves(),
|
verifyConditions: stub().resolves(),
|
||||||
analyzeCommits: sinon.stub().resolves(nextRelease.type),
|
analyzeCommits: stub().resolves(nextRelease.type),
|
||||||
verifyRelease: sinon.stub().resolves(),
|
verifyRelease: stub().resolves(),
|
||||||
generateNotes: sinon.stub().resolves(notes),
|
generateNotes: stub().resolves(notes),
|
||||||
addChannel: sinon.stub().resolves(),
|
addChannel: stub().resolves(),
|
||||||
prepare: sinon.stub().resolves(),
|
prepare: stub().resolves(),
|
||||||
publish: sinon.stub().resolves(),
|
publish: stub().resolves(),
|
||||||
success: sinon.stub().resolves(),
|
success: stub().resolves(),
|
||||||
fail: sinon.stub().resolves(),
|
fail: stub().resolves(),
|
||||||
};
|
};
|
||||||
|
|
||||||
const semanticRelease = requireNoCache('..', {
|
const semanticRelease = requireNoCache('..', {
|
||||||
@@ -460,24 +458,24 @@ test('Use new gitHead, and recreate release notes if a prepare plugin create a c
|
|||||||
};
|
};
|
||||||
const notes = 'Release notes';
|
const notes = 'Release notes';
|
||||||
|
|
||||||
const generateNotes = sinon.stub().resolves(notes);
|
const generateNotes = stub().resolves(notes);
|
||||||
const prepare1 = sinon.stub().callsFake(async () => {
|
const prepare1 = stub().callsFake(async () => {
|
||||||
commits = (await gitCommits(['Third'], {cwd})).concat(commits);
|
commits = (await gitCommits(['Third'], {cwd})).concat(commits);
|
||||||
});
|
});
|
||||||
const prepare2 = sinon.stub().resolves();
|
const prepare2 = stub().resolves();
|
||||||
const publish = sinon.stub().resolves();
|
const publish = stub().resolves();
|
||||||
const options = {
|
const options = {
|
||||||
branches: ['master'],
|
branches: ['master'],
|
||||||
repositoryUrl,
|
repositoryUrl,
|
||||||
verifyConditions: sinon.stub().resolves(),
|
verifyConditions: stub().resolves(),
|
||||||
analyzeCommits: sinon.stub().resolves(nextRelease.type),
|
analyzeCommits: stub().resolves(nextRelease.type),
|
||||||
verifyRelease: sinon.stub().resolves(),
|
verifyRelease: stub().resolves(),
|
||||||
generateNotes,
|
generateNotes,
|
||||||
addChannel: sinon.stub().resolves(),
|
addChannel: stub().resolves(),
|
||||||
prepare: [prepare1, prepare2],
|
prepare: [prepare1, prepare2],
|
||||||
publish,
|
publish,
|
||||||
success: sinon.stub().resolves(),
|
success: stub().resolves(),
|
||||||
fail: sinon.stub().resolves(),
|
fail: stub().resolves(),
|
||||||
};
|
};
|
||||||
|
|
||||||
const semanticRelease = requireNoCache('..', {
|
const semanticRelease = requireNoCache('..', {
|
||||||
@@ -529,12 +527,12 @@ test('Make a new release when a commit is forward-ported to an upper branch', as
|
|||||||
await merge('1.0.x', {cwd});
|
await merge('1.0.x', {cwd});
|
||||||
await gitPush('origin', 'master', {cwd});
|
await gitPush('origin', 'master', {cwd});
|
||||||
|
|
||||||
const verifyConditions = sinon.stub().resolves();
|
const verifyConditions = stub().resolves();
|
||||||
const verifyRelease = sinon.stub().resolves();
|
const verifyRelease = stub().resolves();
|
||||||
const addChannel = sinon.stub().resolves();
|
const addChannel = stub().resolves();
|
||||||
const prepare = sinon.stub().resolves();
|
const prepare = stub().resolves();
|
||||||
const publish = sinon.stub().resolves();
|
const publish = stub().resolves();
|
||||||
const success = sinon.stub().resolves();
|
const success = stub().resolves();
|
||||||
|
|
||||||
const config = {branches: [{name: '1.0.x'}, {name: 'master'}], repositoryUrl, tagFormat: `v\${version}`};
|
const config = {branches: [{name: '1.0.x'}, {name: 'master'}], repositoryUrl, tagFormat: `v\${version}`};
|
||||||
const options = {
|
const options = {
|
||||||
@@ -572,14 +570,14 @@ test('Publish a pre-release version', async (t) => {
|
|||||||
const config = {branches: ['master', {name: 'beta', prerelease: true}], repositoryUrl};
|
const config = {branches: ['master', {name: 'beta', prerelease: true}], repositoryUrl};
|
||||||
const options = {
|
const options = {
|
||||||
...config,
|
...config,
|
||||||
verifyConditions: sinon.stub().resolves(),
|
verifyConditions: stub().resolves(),
|
||||||
verifyRelease: sinon.stub().resolves(),
|
verifyRelease: stub().resolves(),
|
||||||
generateNotes: sinon.stub().resolves(''),
|
generateNotes: stub().resolves(''),
|
||||||
addChannel: false,
|
addChannel: false,
|
||||||
prepare: sinon.stub().resolves(),
|
prepare: stub().resolves(),
|
||||||
publish: sinon.stub().resolves(),
|
publish: stub().resolves(),
|
||||||
success: sinon.stub().resolves(),
|
success: stub().resolves(),
|
||||||
fail: sinon.stub().resolves(),
|
fail: stub().resolves(),
|
||||||
};
|
};
|
||||||
|
|
||||||
const semanticRelease = requireNoCache('..', {
|
const semanticRelease = requireNoCache('..', {
|
||||||
@@ -622,17 +620,17 @@ test('Publish releases from different branch on the same channel', async (t) =>
|
|||||||
branches: ['master', {name: 'next', channel: false}, {name: 'next-major', channel: false}],
|
branches: ['master', {name: 'next', channel: false}, {name: 'next-major', channel: false}],
|
||||||
repositoryUrl,
|
repositoryUrl,
|
||||||
};
|
};
|
||||||
const addChannel = sinon.stub().resolves({});
|
const addChannel = stub().resolves({});
|
||||||
const options = {
|
const options = {
|
||||||
...config,
|
...config,
|
||||||
verifyConditions: sinon.stub().resolves(),
|
verifyConditions: stub().resolves(),
|
||||||
verifyRelease: sinon.stub().resolves(),
|
verifyRelease: stub().resolves(),
|
||||||
generateNotes: sinon.stub().resolves(''),
|
generateNotes: stub().resolves(''),
|
||||||
addChannel,
|
addChannel,
|
||||||
prepare: sinon.stub().resolves(),
|
prepare: stub().resolves(),
|
||||||
publish: sinon.stub().resolves(),
|
publish: stub().resolves(),
|
||||||
success: sinon.stub().resolves(),
|
success: stub().resolves(),
|
||||||
fail: sinon.stub().resolves(),
|
fail: stub().resolves(),
|
||||||
};
|
};
|
||||||
|
|
||||||
let semanticRelease = requireNoCache('..', {
|
let semanticRelease = requireNoCache('..', {
|
||||||
@@ -685,14 +683,14 @@ test('Publish pre-releases the same channel as regular releases', async (t) => {
|
|||||||
};
|
};
|
||||||
const options = {
|
const options = {
|
||||||
...config,
|
...config,
|
||||||
verifyConditions: sinon.stub().resolves(),
|
verifyConditions: stub().resolves(),
|
||||||
verifyRelease: sinon.stub().resolves(),
|
verifyRelease: stub().resolves(),
|
||||||
generateNotes: sinon.stub().resolves(''),
|
generateNotes: stub().resolves(''),
|
||||||
addChannel: false,
|
addChannel: false,
|
||||||
prepare: sinon.stub().resolves(),
|
prepare: stub().resolves(),
|
||||||
publish: sinon.stub().resolves(),
|
publish: stub().resolves(),
|
||||||
success: sinon.stub().resolves(),
|
success: stub().resolves(),
|
||||||
fail: sinon.stub().resolves(),
|
fail: stub().resolves(),
|
||||||
};
|
};
|
||||||
|
|
||||||
const semanticRelease = requireNoCache('..', {
|
const semanticRelease = requireNoCache('..', {
|
||||||
@@ -735,14 +733,14 @@ test('Do not add pre-releases to a different channel', async (t) => {
|
|||||||
await merge('beta', {cwd});
|
await merge('beta', {cwd});
|
||||||
await gitPush('origin', 'master', {cwd});
|
await gitPush('origin', 'master', {cwd});
|
||||||
|
|
||||||
const verifyConditions = sinon.stub().resolves();
|
const verifyConditions = stub().resolves();
|
||||||
const verifyRelease = sinon.stub().resolves();
|
const verifyRelease = stub().resolves();
|
||||||
const generateNotes = sinon.stub().resolves('Release notes');
|
const generateNotes = stub().resolves('Release notes');
|
||||||
const release1 = {name: 'Release 1', url: 'https://release1.com'};
|
const release1 = {name: 'Release 1', url: 'https://release1.com'};
|
||||||
const addChannel = sinon.stub().resolves(release1);
|
const addChannel = stub().resolves(release1);
|
||||||
const prepare = sinon.stub().resolves();
|
const prepare = stub().resolves();
|
||||||
const publish = sinon.stub().resolves();
|
const publish = stub().resolves();
|
||||||
const success = sinon.stub().resolves();
|
const success = stub().resolves();
|
||||||
|
|
||||||
const config = {
|
const config = {
|
||||||
branches: [{name: 'master'}, {name: 'beta', prerelease: 'beta'}],
|
branches: [{name: 'master'}, {name: 'beta', prerelease: 'beta'}],
|
||||||
@@ -793,15 +791,15 @@ async function addChannelMacro(t, mergeFunction) {
|
|||||||
await gitPush('origin', 'master', {cwd});
|
await gitPush('origin', 'master', {cwd});
|
||||||
|
|
||||||
const notes = 'Release notes';
|
const notes = 'Release notes';
|
||||||
const verifyConditions = sinon.stub().resolves();
|
const verifyConditions = stub().resolves();
|
||||||
const verifyRelease = sinon.stub().resolves();
|
const verifyRelease = stub().resolves();
|
||||||
const generateNotes = sinon.stub().resolves(notes);
|
const generateNotes = stub().resolves(notes);
|
||||||
const release1 = {name: 'Release 1', url: 'https://release1.com'};
|
const release1 = {name: 'Release 1', url: 'https://release1.com'};
|
||||||
const addChannel1 = sinon.stub().resolves(release1);
|
const addChannel1 = stub().resolves(release1);
|
||||||
const addChannel2 = sinon.stub().resolves();
|
const addChannel2 = stub().resolves();
|
||||||
const prepare = sinon.stub().resolves();
|
const prepare = stub().resolves();
|
||||||
const publish = sinon.stub().resolves();
|
const publish = stub().resolves();
|
||||||
const success = sinon.stub().resolves();
|
const success = stub().resolves();
|
||||||
|
|
||||||
const config = {
|
const config = {
|
||||||
branches: [
|
branches: [
|
||||||
@@ -872,14 +870,14 @@ test('Call all "success" plugins even if one errors out', async (t) => {
|
|||||||
channel: null,
|
channel: null,
|
||||||
};
|
};
|
||||||
const notes = 'Release notes';
|
const notes = 'Release notes';
|
||||||
const verifyConditions1 = sinon.stub().resolves();
|
const verifyConditions1 = stub().resolves();
|
||||||
const verifyConditions2 = sinon.stub().resolves();
|
const verifyConditions2 = stub().resolves();
|
||||||
const analyzeCommits = sinon.stub().resolves(nextRelease.type);
|
const analyzeCommits = stub().resolves(nextRelease.type);
|
||||||
const generateNotes = sinon.stub().resolves(notes);
|
const generateNotes = stub().resolves(notes);
|
||||||
const release = {name: 'Release', url: 'https://release.com'};
|
const release = {name: 'Release', url: 'https://release.com'};
|
||||||
const publish = sinon.stub().resolves(release);
|
const publish = stub().resolves(release);
|
||||||
const success1 = sinon.stub().rejects();
|
const success1 = stub().rejects();
|
||||||
const success2 = sinon.stub().resolves();
|
const success2 = stub().resolves();
|
||||||
const config = {
|
const config = {
|
||||||
branches: [{name: 'master'}],
|
branches: [{name: 'master'}],
|
||||||
repositoryUrl,
|
repositoryUrl,
|
||||||
@@ -891,8 +889,8 @@ test('Call all "success" plugins even if one errors out', async (t) => {
|
|||||||
verifyConditions: [verifyConditions1, verifyConditions2],
|
verifyConditions: [verifyConditions1, verifyConditions2],
|
||||||
analyzeCommits,
|
analyzeCommits,
|
||||||
generateNotes,
|
generateNotes,
|
||||||
addChannel: sinon.stub().resolves(),
|
addChannel: stub().resolves(),
|
||||||
prepare: sinon.stub().resolves(),
|
prepare: stub().resolves(),
|
||||||
publish,
|
publish,
|
||||||
success: [success1, success2],
|
success: [success1, success2],
|
||||||
};
|
};
|
||||||
@@ -928,12 +926,12 @@ test('Log all "verifyConditions" errors', async (t) => {
|
|||||||
const error1 = new Error('error 1');
|
const error1 = new Error('error 1');
|
||||||
const error2 = new SemanticReleaseError('error 2', 'ERR2');
|
const error2 = new SemanticReleaseError('error 2', 'ERR2');
|
||||||
const error3 = new SemanticReleaseError('error 3', 'ERR3');
|
const error3 = new SemanticReleaseError('error 3', 'ERR3');
|
||||||
const fail = sinon.stub().resolves();
|
const fail = stub().resolves();
|
||||||
const config = {branches: [{name: 'master'}], repositoryUrl, tagFormat: `v\${version}`};
|
const config = {branches: [{name: 'master'}], repositoryUrl, tagFormat: `v\${version}`};
|
||||||
const options = {
|
const options = {
|
||||||
...config,
|
...config,
|
||||||
plugins: false,
|
plugins: false,
|
||||||
verifyConditions: [sinon.stub().rejects(new AggregateError([error1, error2])), sinon.stub().rejects(error3)],
|
verifyConditions: [stub().rejects(new AggregateError([error1, error2])), stub().rejects(error3)],
|
||||||
fail,
|
fail,
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -972,13 +970,13 @@ test('Log all "verifyRelease" errors', async (t) => {
|
|||||||
|
|
||||||
const error1 = new SemanticReleaseError('error 1', 'ERR1');
|
const error1 = new SemanticReleaseError('error 1', 'ERR1');
|
||||||
const error2 = new SemanticReleaseError('error 2', 'ERR2');
|
const error2 = new SemanticReleaseError('error 2', 'ERR2');
|
||||||
const fail = sinon.stub().resolves();
|
const fail = stub().resolves();
|
||||||
const config = {branches: [{name: 'master'}], repositoryUrl, tagFormat: `v\${version}`};
|
const config = {branches: [{name: 'master'}], repositoryUrl, tagFormat: `v\${version}`};
|
||||||
const options = {
|
const options = {
|
||||||
...config,
|
...config,
|
||||||
verifyConditions: sinon.stub().resolves(),
|
verifyConditions: stub().resolves(),
|
||||||
analyzeCommits: sinon.stub().resolves('major'),
|
analyzeCommits: stub().resolves('major'),
|
||||||
verifyRelease: [sinon.stub().rejects(error1), sinon.stub().rejects(error2)],
|
verifyRelease: [stub().rejects(error1), stub().rejects(error2)],
|
||||||
fail,
|
fail,
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -1013,14 +1011,14 @@ test('Dry-run skips addChannel, prepare, publish and success', async (t) => {
|
|||||||
await gitCheckout('next', true, {cwd});
|
await gitCheckout('next', true, {cwd});
|
||||||
await gitPush('origin', 'next', {cwd});
|
await gitPush('origin', 'next', {cwd});
|
||||||
|
|
||||||
const verifyConditions = sinon.stub().resolves();
|
const verifyConditions = stub().resolves();
|
||||||
const analyzeCommits = sinon.stub().resolves('minor');
|
const analyzeCommits = stub().resolves('minor');
|
||||||
const verifyRelease = sinon.stub().resolves();
|
const verifyRelease = stub().resolves();
|
||||||
const generateNotes = sinon.stub().resolves();
|
const generateNotes = stub().resolves();
|
||||||
const addChannel = sinon.stub().resolves();
|
const addChannel = stub().resolves();
|
||||||
const prepare = sinon.stub().resolves();
|
const prepare = stub().resolves();
|
||||||
const publish = sinon.stub().resolves();
|
const publish = stub().resolves();
|
||||||
const success = sinon.stub().resolves();
|
const success = stub().resolves();
|
||||||
|
|
||||||
const options = {
|
const options = {
|
||||||
dryRun: true,
|
dryRun: true,
|
||||||
@@ -1079,13 +1077,13 @@ test('Dry-run skips fail', async (t) => {
|
|||||||
|
|
||||||
const error1 = new SemanticReleaseError('error 1', 'ERR1');
|
const error1 = new SemanticReleaseError('error 1', 'ERR1');
|
||||||
const error2 = new SemanticReleaseError('error 2', 'ERR2');
|
const error2 = new SemanticReleaseError('error 2', 'ERR2');
|
||||||
const fail = sinon.stub().resolves();
|
const fail = stub().resolves();
|
||||||
|
|
||||||
const options = {
|
const options = {
|
||||||
dryRun: true,
|
dryRun: true,
|
||||||
branches: ['master'],
|
branches: ['master'],
|
||||||
repositoryUrl,
|
repositoryUrl,
|
||||||
verifyConditions: [sinon.stub().rejects(error1), sinon.stub().rejects(error2)],
|
verifyConditions: [stub().rejects(error1), stub().rejects(error2)],
|
||||||
fail,
|
fail,
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -1127,12 +1125,12 @@ test('Force a dry-run if not on a CI and "noCi" is not explicitly set', async (t
|
|||||||
};
|
};
|
||||||
const notes = 'Release notes';
|
const notes = 'Release notes';
|
||||||
|
|
||||||
const verifyConditions = sinon.stub().resolves();
|
const verifyConditions = stub().resolves();
|
||||||
const analyzeCommits = sinon.stub().resolves(nextRelease.type);
|
const analyzeCommits = stub().resolves(nextRelease.type);
|
||||||
const verifyRelease = sinon.stub().resolves();
|
const verifyRelease = stub().resolves();
|
||||||
const generateNotes = sinon.stub().resolves(notes);
|
const generateNotes = stub().resolves(notes);
|
||||||
const publish = sinon.stub().resolves();
|
const publish = stub().resolves();
|
||||||
const success = sinon.stub().resolves();
|
const success = stub().resolves();
|
||||||
|
|
||||||
const options = {
|
const options = {
|
||||||
dryRun: false,
|
dryRun: false,
|
||||||
@@ -1142,11 +1140,11 @@ test('Force a dry-run if not on a CI and "noCi" is not explicitly set', async (t
|
|||||||
analyzeCommits,
|
analyzeCommits,
|
||||||
verifyRelease,
|
verifyRelease,
|
||||||
generateNotes,
|
generateNotes,
|
||||||
addChannel: sinon.stub().resolves(),
|
addChannel: stub().resolves(),
|
||||||
prepare: sinon.stub().resolves(),
|
prepare: stub().resolves(),
|
||||||
publish,
|
publish,
|
||||||
success,
|
success,
|
||||||
fail: sinon.stub().resolves(),
|
fail: stub().resolves(),
|
||||||
};
|
};
|
||||||
|
|
||||||
const semanticRelease = requireNoCache('..', {
|
const semanticRelease = requireNoCache('..', {
|
||||||
@@ -1183,8 +1181,8 @@ test('Dry-run does not print changelog if "generateNotes" return "undefined"', a
|
|||||||
await gitPush(repositoryUrl, 'master', {cwd});
|
await gitPush(repositoryUrl, 'master', {cwd});
|
||||||
|
|
||||||
const nextRelease = {type: 'major', version: '2.0.0', gitHead: await getGitHead({cwd}), gitTag: 'v2.0.0'};
|
const nextRelease = {type: 'major', version: '2.0.0', gitHead: await getGitHead({cwd}), gitTag: 'v2.0.0'};
|
||||||
const analyzeCommits = sinon.stub().resolves(nextRelease.type);
|
const analyzeCommits = stub().resolves(nextRelease.type);
|
||||||
const generateNotes = sinon.stub().resolves();
|
const generateNotes = stub().resolves();
|
||||||
|
|
||||||
const options = {
|
const options = {
|
||||||
dryRun: true,
|
dryRun: true,
|
||||||
@@ -1236,12 +1234,12 @@ test('Allow local releases with "noCi" option', async (t) => {
|
|||||||
};
|
};
|
||||||
const notes = 'Release notes';
|
const notes = 'Release notes';
|
||||||
|
|
||||||
const verifyConditions = sinon.stub().resolves();
|
const verifyConditions = stub().resolves();
|
||||||
const analyzeCommits = sinon.stub().resolves(nextRelease.type);
|
const analyzeCommits = stub().resolves(nextRelease.type);
|
||||||
const verifyRelease = sinon.stub().resolves();
|
const verifyRelease = stub().resolves();
|
||||||
const generateNotes = sinon.stub().resolves(notes);
|
const generateNotes = stub().resolves(notes);
|
||||||
const publish = sinon.stub().resolves();
|
const publish = stub().resolves();
|
||||||
const success = sinon.stub().resolves();
|
const success = stub().resolves();
|
||||||
|
|
||||||
const options = {
|
const options = {
|
||||||
noCi: true,
|
noCi: true,
|
||||||
@@ -1251,11 +1249,11 @@ test('Allow local releases with "noCi" option', async (t) => {
|
|||||||
analyzeCommits,
|
analyzeCommits,
|
||||||
verifyRelease,
|
verifyRelease,
|
||||||
generateNotes,
|
generateNotes,
|
||||||
addChannel: sinon.stub().resolves(),
|
addChannel: stub().resolves(),
|
||||||
prepare: sinon.stub().resolves(),
|
prepare: stub().resolves(),
|
||||||
publish,
|
publish,
|
||||||
success,
|
success,
|
||||||
fail: sinon.stub().resolves(),
|
fail: stub().resolves(),
|
||||||
};
|
};
|
||||||
|
|
||||||
const semanticRelease = requireNoCache('..', {
|
const semanticRelease = requireNoCache('..', {
|
||||||
@@ -1305,27 +1303,27 @@ test('Accept "undefined" value returned by "generateNotes" and "false" by "publi
|
|||||||
gitTag: 'v1.2.0',
|
gitTag: 'v1.2.0',
|
||||||
channel: null,
|
channel: null,
|
||||||
};
|
};
|
||||||
const analyzeCommits = sinon.stub().resolves(nextRelease.type);
|
const analyzeCommits = stub().resolves(nextRelease.type);
|
||||||
const verifyRelease = sinon.stub().resolves();
|
const verifyRelease = stub().resolves();
|
||||||
const generateNotes1 = sinon.stub().resolves();
|
const generateNotes1 = stub().resolves();
|
||||||
const notes2 = 'Release notes 2';
|
const notes2 = 'Release notes 2';
|
||||||
const generateNotes2 = sinon.stub().resolves(notes2);
|
const generateNotes2 = stub().resolves(notes2);
|
||||||
const publish = sinon.stub().resolves(false);
|
const publish = stub().resolves(false);
|
||||||
const addChannel = sinon.stub().resolves(false);
|
const addChannel = stub().resolves(false);
|
||||||
const success = sinon.stub().resolves();
|
const success = stub().resolves();
|
||||||
|
|
||||||
const options = {
|
const options = {
|
||||||
branches: ['master', 'next'],
|
branches: ['master', 'next'],
|
||||||
repositoryUrl,
|
repositoryUrl,
|
||||||
verifyConditions: sinon.stub().resolves(),
|
verifyConditions: stub().resolves(),
|
||||||
analyzeCommits,
|
analyzeCommits,
|
||||||
verifyRelease,
|
verifyRelease,
|
||||||
generateNotes: [generateNotes1, generateNotes2],
|
generateNotes: [generateNotes1, generateNotes2],
|
||||||
addChannel,
|
addChannel,
|
||||||
prepare: sinon.stub().resolves(),
|
prepare: stub().resolves(),
|
||||||
publish,
|
publish,
|
||||||
success,
|
success,
|
||||||
fail: sinon.stub().resolves(),
|
fail: stub().resolves(),
|
||||||
};
|
};
|
||||||
|
|
||||||
const semanticRelease = requireNoCache('..', {
|
const semanticRelease = requireNoCache('..', {
|
||||||
@@ -1388,12 +1386,12 @@ test('Throws "EINVALIDNEXTVERSION" if next release is out of range of the curren
|
|||||||
await gitCommits(['feat: feature on maintenance version 1.x'], {cwd});
|
await gitCommits(['feat: feature on maintenance version 1.x'], {cwd});
|
||||||
await gitPush('origin', 'master', {cwd});
|
await gitPush('origin', 'master', {cwd});
|
||||||
|
|
||||||
const verifyConditions = sinon.stub().resolves();
|
const verifyConditions = stub().resolves();
|
||||||
const verifyRelease = sinon.stub().resolves();
|
const verifyRelease = stub().resolves();
|
||||||
const addChannel = sinon.stub().resolves();
|
const addChannel = stub().resolves();
|
||||||
const prepare = sinon.stub().resolves();
|
const prepare = stub().resolves();
|
||||||
const publish = sinon.stub().resolves();
|
const publish = stub().resolves();
|
||||||
const success = sinon.stub().resolves();
|
const success = stub().resolves();
|
||||||
|
|
||||||
const config = {
|
const config = {
|
||||||
branches: [{name: '1.x'}, {name: 'master'}],
|
branches: [{name: '1.x'}, {name: 'master'}],
|
||||||
@@ -1440,12 +1438,12 @@ test('Throws "EINVALIDNEXTVERSION" if next release is out of range of the curren
|
|||||||
await gitCommits(['feat: new feature on master', 'fix: new fix on master'], {cwd});
|
await gitCommits(['feat: new feature on master', 'fix: new fix on master'], {cwd});
|
||||||
await gitPush('origin', 'master', {cwd});
|
await gitPush('origin', 'master', {cwd});
|
||||||
|
|
||||||
const verifyConditions = sinon.stub().resolves();
|
const verifyConditions = stub().resolves();
|
||||||
const verifyRelease = sinon.stub().resolves();
|
const verifyRelease = stub().resolves();
|
||||||
const addChannel = sinon.stub().resolves();
|
const addChannel = stub().resolves();
|
||||||
const prepare = sinon.stub().resolves();
|
const prepare = stub().resolves();
|
||||||
const publish = sinon.stub().resolves();
|
const publish = stub().resolves();
|
||||||
const success = sinon.stub().resolves();
|
const success = stub().resolves();
|
||||||
|
|
||||||
const config = {
|
const config = {
|
||||||
branches: [{name: 'master'}, {name: 'next'}, {name: 'next-major'}],
|
branches: [{name: 'master'}, {name: 'next'}, {name: 'next-major'}],
|
||||||
@@ -1498,15 +1496,15 @@ test('Throws "EINVALIDMAINTENANCEMERGE" if merge an out of range release in a ma
|
|||||||
await gitPush('origin', '1.1.x', {cwd});
|
await gitPush('origin', '1.1.x', {cwd});
|
||||||
|
|
||||||
const notes = 'Release notes';
|
const notes = 'Release notes';
|
||||||
const verifyConditions = sinon.stub().resolves();
|
const verifyConditions = stub().resolves();
|
||||||
const analyzeCommits = sinon.stub().resolves();
|
const analyzeCommits = stub().resolves();
|
||||||
const verifyRelease = sinon.stub().resolves();
|
const verifyRelease = stub().resolves();
|
||||||
const generateNotes = sinon.stub().resolves(notes);
|
const generateNotes = stub().resolves(notes);
|
||||||
const addChannel = sinon.stub().resolves();
|
const addChannel = stub().resolves();
|
||||||
const prepare = sinon.stub().resolves();
|
const prepare = stub().resolves();
|
||||||
const publish = sinon.stub().resolves();
|
const publish = stub().resolves();
|
||||||
const success = sinon.stub().resolves();
|
const success = stub().resolves();
|
||||||
const fail = sinon.stub().resolves();
|
const fail = stub().resolves();
|
||||||
|
|
||||||
const config = {branches: [{name: 'master'}, {name: '1.1.x'}], repositoryUrl, tagFormat: `v\${version}`};
|
const config = {branches: [{name: 'master'}, {name: '1.1.x'}], repositoryUrl, tagFormat: `v\${version}`};
|
||||||
const options = {
|
const options = {
|
||||||
@@ -1581,15 +1579,15 @@ test('Returns false if not running from the configured branch', async (t) => {
|
|||||||
const options = {
|
const options = {
|
||||||
branches: ['master'],
|
branches: ['master'],
|
||||||
repositoryUrl,
|
repositoryUrl,
|
||||||
verifyConditions: sinon.stub().resolves(),
|
verifyConditions: stub().resolves(),
|
||||||
analyzeCommits: sinon.stub().resolves(),
|
analyzeCommits: stub().resolves(),
|
||||||
verifyRelease: sinon.stub().resolves(),
|
verifyRelease: stub().resolves(),
|
||||||
generateNotes: sinon.stub().resolves(),
|
generateNotes: stub().resolves(),
|
||||||
addChannel: sinon.stub().resolves(),
|
addChannel: stub().resolves(),
|
||||||
prepare: sinon.stub().resolves(),
|
prepare: stub().resolves(),
|
||||||
publish: sinon.stub().resolves(),
|
publish: stub().resolves(),
|
||||||
success: sinon.stub().resolves(),
|
success: stub().resolves(),
|
||||||
fail: sinon.stub().resolves(),
|
fail: stub().resolves(),
|
||||||
};
|
};
|
||||||
|
|
||||||
const semanticRelease = requireNoCache('..', {
|
const semanticRelease = requireNoCache('..', {
|
||||||
@@ -1618,23 +1616,23 @@ test('Returns false if there is no relevant changes', async (t) => {
|
|||||||
await gitCommits(['First'], {cwd});
|
await gitCommits(['First'], {cwd});
|
||||||
await gitPush(repositoryUrl, 'master', {cwd});
|
await gitPush(repositoryUrl, 'master', {cwd});
|
||||||
|
|
||||||
const analyzeCommits = sinon.stub().resolves();
|
const analyzeCommits = stub().resolves();
|
||||||
const verifyRelease = sinon.stub().resolves();
|
const verifyRelease = stub().resolves();
|
||||||
const generateNotes = sinon.stub().resolves();
|
const generateNotes = stub().resolves();
|
||||||
const publish = sinon.stub().resolves();
|
const publish = stub().resolves();
|
||||||
|
|
||||||
const options = {
|
const options = {
|
||||||
branches: ['master'],
|
branches: ['master'],
|
||||||
repositoryUrl,
|
repositoryUrl,
|
||||||
verifyConditions: [sinon.stub().resolves()],
|
verifyConditions: [stub().resolves()],
|
||||||
analyzeCommits,
|
analyzeCommits,
|
||||||
verifyRelease,
|
verifyRelease,
|
||||||
generateNotes,
|
generateNotes,
|
||||||
addChannel: sinon.stub().resolves(),
|
addChannel: stub().resolves(),
|
||||||
prepare: sinon.stub().resolves(),
|
prepare: stub().resolves(),
|
||||||
publish,
|
publish,
|
||||||
success: sinon.stub().resolves(),
|
success: stub().resolves(),
|
||||||
fail: sinon.stub().resolves(),
|
fail: stub().resolves(),
|
||||||
};
|
};
|
||||||
|
|
||||||
const semanticRelease = requireNoCache('..', {
|
const semanticRelease = requireNoCache('..', {
|
||||||
@@ -1678,19 +1676,19 @@ test('Exclude commits with [skip release] or [release skip] from analysis', asyn
|
|||||||
{cwd}
|
{cwd}
|
||||||
);
|
);
|
||||||
await gitPush(repositoryUrl, 'master', {cwd});
|
await gitPush(repositoryUrl, 'master', {cwd});
|
||||||
const analyzeCommits = sinon.stub().resolves();
|
const analyzeCommits = stub().resolves();
|
||||||
const config = {branches: ['master'], repositoryUrl, globalOpt: 'global'};
|
const config = {branches: ['master'], repositoryUrl, globalOpt: 'global'};
|
||||||
const options = {
|
const options = {
|
||||||
...config,
|
...config,
|
||||||
verifyConditions: [sinon.stub().resolves(), sinon.stub().resolves()],
|
verifyConditions: [stub().resolves(), stub().resolves()],
|
||||||
analyzeCommits,
|
analyzeCommits,
|
||||||
verifyRelease: sinon.stub().resolves(),
|
verifyRelease: stub().resolves(),
|
||||||
generateNotes: sinon.stub().resolves(),
|
generateNotes: stub().resolves(),
|
||||||
addChannel: sinon.stub().resolves(),
|
addChannel: stub().resolves(),
|
||||||
prepare: sinon.stub().resolves(),
|
prepare: stub().resolves(),
|
||||||
publish: sinon.stub().resolves(),
|
publish: stub().resolves(),
|
||||||
success: sinon.stub().resolves(),
|
success: stub().resolves(),
|
||||||
fail: sinon.stub().resolves(),
|
fail: stub().resolves(),
|
||||||
};
|
};
|
||||||
|
|
||||||
const semanticRelease = requireNoCache('..', {
|
const semanticRelease = requireNoCache('..', {
|
||||||
@@ -1718,8 +1716,8 @@ test('Log both plugins errors and errors thrown by "fail" plugin', async (t) =>
|
|||||||
const options = {
|
const options = {
|
||||||
branches: ['master'],
|
branches: ['master'],
|
||||||
repositoryUrl,
|
repositoryUrl,
|
||||||
verifyConditions: sinon.stub().rejects(pluginError),
|
verifyConditions: stub().rejects(pluginError),
|
||||||
fail: [sinon.stub().rejects(failError1), sinon.stub().rejects(failError2)],
|
fail: [stub().rejects(failError1), stub().rejects(failError2)],
|
||||||
};
|
};
|
||||||
const semanticRelease = requireNoCache('..', {
|
const semanticRelease = requireNoCache('..', {
|
||||||
'./lib/get-logger': () => t.context.logger,
|
'./lib/get-logger': () => t.context.logger,
|
||||||
@@ -1738,12 +1736,12 @@ test('Log both plugins errors and errors thrown by "fail" plugin', async (t) =>
|
|||||||
test('Call "fail" only if a plugin returns a SemanticReleaseError', async (t) => {
|
test('Call "fail" only if a plugin returns a SemanticReleaseError', async (t) => {
|
||||||
const {cwd, repositoryUrl} = await gitRepo(true);
|
const {cwd, repositoryUrl} = await gitRepo(true);
|
||||||
const pluginError = new Error('Plugin error');
|
const pluginError = new Error('Plugin error');
|
||||||
const fail = sinon.stub().resolves();
|
const fail = stub().resolves();
|
||||||
|
|
||||||
const options = {
|
const options = {
|
||||||
branches: ['master'],
|
branches: ['master'],
|
||||||
repositoryUrl,
|
repositoryUrl,
|
||||||
verifyConditions: sinon.stub().rejects(pluginError),
|
verifyConditions: stub().rejects(pluginError),
|
||||||
fail,
|
fail,
|
||||||
};
|
};
|
||||||
const semanticRelease = requireNoCache('..', {
|
const semanticRelease = requireNoCache('..', {
|
||||||
@@ -1791,16 +1789,16 @@ test('Throw an Error if plugin returns an unexpected value', async (t) => {
|
|||||||
await gitCommits(['Second'], {cwd});
|
await gitCommits(['Second'], {cwd});
|
||||||
await gitPush(repositoryUrl, 'master', {cwd});
|
await gitPush(repositoryUrl, 'master', {cwd});
|
||||||
|
|
||||||
const verifyConditions = sinon.stub().resolves();
|
const verifyConditions = stub().resolves();
|
||||||
const analyzeCommits = sinon.stub().resolves('string');
|
const analyzeCommits = stub().resolves('string');
|
||||||
|
|
||||||
const options = {
|
const options = {
|
||||||
branches: ['master'],
|
branches: ['master'],
|
||||||
repositoryUrl,
|
repositoryUrl,
|
||||||
verifyConditions: [verifyConditions],
|
verifyConditions: [verifyConditions],
|
||||||
analyzeCommits,
|
analyzeCommits,
|
||||||
success: sinon.stub().resolves(),
|
success: stub().resolves(),
|
||||||
fail: sinon.stub().resolves(),
|
fail: stub().resolves(),
|
||||||
};
|
};
|
||||||
|
|
||||||
const semanticRelease = requireNoCache('..', {
|
const semanticRelease = requireNoCache('..', {
|
||||||
@@ -1817,19 +1815,19 @@ test('Throw an Error if plugin returns an unexpected value', async (t) => {
|
|||||||
test('Hide sensitive information passed to "fail" plugin', async (t) => {
|
test('Hide sensitive information passed to "fail" plugin', async (t) => {
|
||||||
const {cwd, repositoryUrl} = await gitRepo(true);
|
const {cwd, repositoryUrl} = await gitRepo(true);
|
||||||
|
|
||||||
const fail = sinon.stub().resolves();
|
const fail = stub().resolves();
|
||||||
const env = {MY_TOKEN: 'secret token'};
|
const env = {MY_TOKEN: 'secret token'};
|
||||||
const options = {
|
const options = {
|
||||||
branch: 'master',
|
branch: 'master',
|
||||||
repositoryUrl,
|
repositoryUrl,
|
||||||
verifyConditions: sinon.stub().throws(
|
verifyConditions: stub().throws(
|
||||||
new SemanticReleaseError(
|
new SemanticReleaseError(
|
||||||
`Message: Exposing token ${env.MY_TOKEN}`,
|
`Message: Exposing token ${env.MY_TOKEN}`,
|
||||||
'ERR',
|
'ERR',
|
||||||
`Details: Exposing token ${env.MY_TOKEN}`
|
`Details: Exposing token ${env.MY_TOKEN}`
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
success: sinon.stub().resolves(),
|
success: stub().resolves(),
|
||||||
fail,
|
fail,
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -1860,7 +1858,7 @@ test('Hide sensitive information passed to "success" plugin', async (t) => {
|
|||||||
await gitCommits(['feat: new feature'], {cwd});
|
await gitCommits(['feat: new feature'], {cwd});
|
||||||
await gitPush(repositoryUrl, 'master', {cwd});
|
await gitPush(repositoryUrl, 'master', {cwd});
|
||||||
|
|
||||||
const success = sinon.stub().resolves();
|
const success = stub().resolves();
|
||||||
const env = {MY_TOKEN: 'secret token'};
|
const env = {MY_TOKEN: 'secret token'};
|
||||||
const options = {
|
const options = {
|
||||||
branch: 'master',
|
branch: 'master',
|
||||||
@@ -1868,14 +1866,14 @@ test('Hide sensitive information passed to "success" plugin', async (t) => {
|
|||||||
verifyConditions: false,
|
verifyConditions: false,
|
||||||
verifyRelease: false,
|
verifyRelease: false,
|
||||||
prepare: false,
|
prepare: false,
|
||||||
generateNotes: sinon.stub().resolves(`Exposing token ${env.MY_TOKEN}`),
|
generateNotes: stub().resolves(`Exposing token ${env.MY_TOKEN}`),
|
||||||
publish: sinon.stub().resolves({
|
publish: stub().resolves({
|
||||||
name: `Name: Exposing token ${env.MY_TOKEN}`,
|
name: `Name: Exposing token ${env.MY_TOKEN}`,
|
||||||
url: `URL: Exposing token ${env.MY_TOKEN}`,
|
url: `URL: Exposing token ${env.MY_TOKEN}`,
|
||||||
}),
|
}),
|
||||||
addChannel: false,
|
addChannel: false,
|
||||||
success,
|
success,
|
||||||
fail: sinon.stub().resolves(),
|
fail: stub().resolves(),
|
||||||
};
|
};
|
||||||
|
|
||||||
const semanticRelease = requireNoCache('..', {
|
const semanticRelease = requireNoCache('..', {
|
||||||
@@ -1913,19 +1911,19 @@ test('Get all commits including the ones not in the shallow clone', async (t) =>
|
|||||||
channel: undefined,
|
channel: undefined,
|
||||||
};
|
};
|
||||||
const notes = 'Release notes';
|
const notes = 'Release notes';
|
||||||
const analyzeCommits = sinon.stub().resolves(nextRelease.type);
|
const analyzeCommits = stub().resolves(nextRelease.type);
|
||||||
|
|
||||||
const config = {branches: ['master'], repositoryUrl, globalOpt: 'global'};
|
const config = {branches: ['master'], repositoryUrl, globalOpt: 'global'};
|
||||||
const options = {
|
const options = {
|
||||||
...config,
|
...config,
|
||||||
verifyConditions: sinon.stub().resolves(),
|
verifyConditions: stub().resolves(),
|
||||||
analyzeCommits,
|
analyzeCommits,
|
||||||
verifyRelease: sinon.stub().resolves(),
|
verifyRelease: stub().resolves(),
|
||||||
generateNotes: sinon.stub().resolves(notes),
|
generateNotes: stub().resolves(notes),
|
||||||
prepare: sinon.stub().resolves(),
|
prepare: stub().resolves(),
|
||||||
publish: sinon.stub().resolves(),
|
publish: stub().resolves(),
|
||||||
success: sinon.stub().resolves(),
|
success: stub().resolves(),
|
||||||
fail: sinon.stub().resolves(),
|
fail: stub().resolves(),
|
||||||
};
|
};
|
||||||
|
|
||||||
const semanticRelease = requireNoCache('..', {
|
const semanticRelease = requireNoCache('..', {
|
||||||
|
|||||||
+16
-19
@@ -1,16 +1,14 @@
|
|||||||
import path from 'path';
|
const path = require('path');
|
||||||
import test from 'ava';
|
const test = require('ava');
|
||||||
import proxyquire from 'proxyquire';
|
const proxyquire = require('proxyquire');
|
||||||
import lodash from 'lodash'
|
const {escapeRegExp} = require('lodash');
|
||||||
const {escapeRegExp} = lodash
|
const {writeJson, readJson} = require('fs-extra');
|
||||||
import {writeJson, readJson} from 'fs-extra';
|
const execa = require('execa');
|
||||||
import execa from 'execa';
|
const {WritableStreamBuffer} = require('stream-buffers');
|
||||||
import {WritableStreamBuffer} from 'stream-buffers';
|
const delay = require('delay');
|
||||||
import delay from 'delay';
|
const getAuthUrl = require('../lib/get-git-auth-url');
|
||||||
import getAuthUrl from '../lib/get-git-auth-url.js';
|
const {SECRET_REPLACEMENT} = require('../lib/definitions/constants');
|
||||||
import {SECRET_REPLACEMENT} from '../lib/definitions/constants.js';
|
const {
|
||||||
|
|
||||||
import {
|
|
||||||
gitHead,
|
gitHead,
|
||||||
gitTagHead,
|
gitTagHead,
|
||||||
gitRepo,
|
gitRepo,
|
||||||
@@ -20,12 +18,11 @@ import {
|
|||||||
gitCheckout,
|
gitCheckout,
|
||||||
merge,
|
merge,
|
||||||
gitGetNote,
|
gitGetNote,
|
||||||
} from './helpers/git-utils.js';
|
} = require('./helpers/git-utils');
|
||||||
|
const {npmView} = require('./helpers/npm-utils');
|
||||||
import {npmView} from './helpers/npm-utils.js';
|
const gitbox = require('./helpers/gitbox');
|
||||||
import gitbox from './helpers/gitbox.js';
|
const mockServer = require('./helpers/mockserver');
|
||||||
import mockServer from './helpers/mockserver.js';
|
const npmRegistry = require('./helpers/npm-registry');
|
||||||
import npmRegistry from './helpers/npm-registry.js';
|
|
||||||
|
|
||||||
/* eslint camelcase: ["error", {properties: "never"}] */
|
/* eslint camelcase: ["error", {properties: "never"}] */
|
||||||
|
|
||||||
|
|||||||
@@ -1,17 +1,16 @@
|
|||||||
import test from 'ava';
|
const test = require('ava');
|
||||||
import lodash from 'lodash'
|
const {noop} = require('lodash');
|
||||||
const {noop} = lodash
|
const {stub} = require('sinon');
|
||||||
import sinon from 'sinon';
|
const normalize = require('../../lib/plugins/normalize');
|
||||||
import normalize from '../../lib/plugins/normalize.js';
|
|
||||||
|
|
||||||
const cwd = process.cwd();
|
const cwd = process.cwd();
|
||||||
|
|
||||||
test.beforeEach((t) => {
|
test.beforeEach((t) => {
|
||||||
// Stub the logger functions
|
// Stub the logger functions
|
||||||
t.context.log = sinon.stub);
|
t.context.log = stub();
|
||||||
t.context.error = sinon.stub);
|
t.context.error = stub();
|
||||||
t.context.success = sinon.stub);
|
t.context.success = stub();
|
||||||
t.context.stderr = {write: sinon.stub)};
|
t.context.stderr = {write: stub()};
|
||||||
t.context.logger = {
|
t.context.logger = {
|
||||||
log: t.context.log,
|
log: t.context.log,
|
||||||
error: t.context.error,
|
error: t.context.error,
|
||||||
@@ -100,7 +99,7 @@ test('Normalize and load plugin that retuns multiple functions', (t) => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
test('Wrap "analyzeCommits" plugin in a function that validate the output of the plugin', async (t) => {
|
test('Wrap "analyzeCommits" plugin in a function that validate the output of the plugin', async (t) => {
|
||||||
const analyzeCommits = sinon.stub).resolves(2);
|
const analyzeCommits = stub().resolves(2);
|
||||||
const plugin = normalize(
|
const plugin = normalize(
|
||||||
{cwd, options: {}, stderr: t.context.stderr, logger: t.context.logger},
|
{cwd, options: {}, stderr: t.context.stderr, logger: t.context.logger},
|
||||||
'analyzeCommits',
|
'analyzeCommits',
|
||||||
@@ -118,7 +117,7 @@ test('Wrap "analyzeCommits" plugin in a function that validate the output of the
|
|||||||
});
|
});
|
||||||
|
|
||||||
test('Wrap "generateNotes" plugin in a function that validate the output of the plugin', async (t) => {
|
test('Wrap "generateNotes" plugin in a function that validate the output of the plugin', async (t) => {
|
||||||
const generateNotes = sinon.stub).resolves(2);
|
const generateNotes = stub().resolves(2);
|
||||||
const plugin = normalize(
|
const plugin = normalize(
|
||||||
{cwd, options: {}, stderr: t.context.stderr, logger: t.context.logger},
|
{cwd, options: {}, stderr: t.context.stderr, logger: t.context.logger},
|
||||||
'generateNotes',
|
'generateNotes',
|
||||||
@@ -136,7 +135,7 @@ test('Wrap "generateNotes" plugin in a function that validate the output of the
|
|||||||
});
|
});
|
||||||
|
|
||||||
test('Wrap "publish" plugin in a function that validate the output of the plugin', async (t) => {
|
test('Wrap "publish" plugin in a function that validate the output of the plugin', async (t) => {
|
||||||
const publish = sinon.stub).resolves(2);
|
const publish = stub().resolves(2);
|
||||||
const plugin = normalize(
|
const plugin = normalize(
|
||||||
{cwd, options: {}, stderr: t.context.stderr, logger: t.context.logger},
|
{cwd, options: {}, stderr: t.context.stderr, logger: t.context.logger},
|
||||||
'publish',
|
'publish',
|
||||||
@@ -154,7 +153,7 @@ test('Wrap "publish" plugin in a function that validate the output of the plugin
|
|||||||
});
|
});
|
||||||
|
|
||||||
test('Wrap "addChannel" plugin in a function that validate the output of the plugin', async (t) => {
|
test('Wrap "addChannel" plugin in a function that validate the output of the plugin', async (t) => {
|
||||||
const addChannel = sinon.stub).resolves(2);
|
const addChannel = stub().resolves(2);
|
||||||
const plugin = normalize(
|
const plugin = normalize(
|
||||||
{cwd, options: {}, stderr: t.context.stderr, logger: t.context.logger},
|
{cwd, options: {}, stderr: t.context.stderr, logger: t.context.logger},
|
||||||
'addChannel',
|
'addChannel',
|
||||||
@@ -172,7 +171,7 @@ test('Wrap "addChannel" plugin in a function that validate the output of the plu
|
|||||||
});
|
});
|
||||||
|
|
||||||
test('Plugin is called with "pluginConfig" (with object definition) and input', async (t) => {
|
test('Plugin is called with "pluginConfig" (with object definition) and input', async (t) => {
|
||||||
const pluginFunction = sinon.stub).resolves();
|
const pluginFunction = stub().resolves();
|
||||||
const pluginConf = {path: pluginFunction, conf: 'confValue'};
|
const pluginConf = {path: pluginFunction, conf: 'confValue'};
|
||||||
const options = {global: 'globalValue'};
|
const options = {global: 'globalValue'};
|
||||||
const plugin = normalize({cwd, options, logger: t.context.logger}, '', pluginConf, {});
|
const plugin = normalize({cwd, options, logger: t.context.logger}, '', pluginConf, {});
|
||||||
@@ -187,7 +186,7 @@ test('Plugin is called with "pluginConfig" (with object definition) and input',
|
|||||||
});
|
});
|
||||||
|
|
||||||
test('Plugin is called with "pluginConfig" (with array definition) and input', async (t) => {
|
test('Plugin is called with "pluginConfig" (with array definition) and input', async (t) => {
|
||||||
const pluginFunction = sinon.stub).resolves();
|
const pluginFunction = stub().resolves();
|
||||||
const pluginConf = [pluginFunction, {conf: 'confValue'}];
|
const pluginConf = [pluginFunction, {conf: 'confValue'}];
|
||||||
const options = {global: 'globalValue'};
|
const options = {global: 'globalValue'};
|
||||||
const plugin = normalize({cwd, options, logger: t.context.logger}, '', pluginConf, {});
|
const plugin = normalize({cwd, options, logger: t.context.logger}, '', pluginConf, {});
|
||||||
@@ -202,7 +201,7 @@ test('Plugin is called with "pluginConfig" (with array definition) and input', a
|
|||||||
});
|
});
|
||||||
|
|
||||||
test('Prevent plugins to modify "pluginConfig"', async (t) => {
|
test('Prevent plugins to modify "pluginConfig"', async (t) => {
|
||||||
const pluginFunction = sinon.stub).callsFake((pluginConfig) => {
|
const pluginFunction = stub().callsFake((pluginConfig) => {
|
||||||
pluginConfig.conf.subConf = 'otherConf';
|
pluginConfig.conf.subConf = 'otherConf';
|
||||||
});
|
});
|
||||||
const pluginConf = {path: pluginFunction, conf: {subConf: 'originalConf'}};
|
const pluginConf = {path: pluginFunction, conf: {subConf: 'originalConf'}};
|
||||||
@@ -215,7 +214,7 @@ test('Prevent plugins to modify "pluginConfig"', async (t) => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
test('Prevent plugins to modify its input', async (t) => {
|
test('Prevent plugins to modify its input', async (t) => {
|
||||||
const pluginFunction = sinon.stub).callsFake((pluginConfig, options) => {
|
const pluginFunction = stub().callsFake((pluginConfig, options) => {
|
||||||
options.param.subParam = 'otherParam';
|
options.param.subParam = 'otherParam';
|
||||||
});
|
});
|
||||||
const input = {param: {subParam: 'originalSubParam'}, options: {}};
|
const input = {param: {subParam: 'originalSubParam'}, options: {}};
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
import test from 'ava';
|
const test = require('ava');
|
||||||
import sinon from 'sinon';
|
const {stub} = require('sinon');
|
||||||
import AggregateError from 'aggregate-error';
|
const AggregateError = require('aggregate-error');
|
||||||
import pipeline from '../../lib/plugins/pipeline.js';
|
const pipeline = require('../../lib/plugins/pipeline');
|
||||||
|
|
||||||
test('Execute each function in series passing the same input', async (t) => {
|
test('Execute each function in series passing the same input', async (t) => {
|
||||||
const step1 = sinon.stub).resolves(1);
|
const step1 = stub().resolves(1);
|
||||||
const step2 = sinon.stub).resolves(2);
|
const step2 = stub().resolves(2);
|
||||||
const step3 = sinon.stub).resolves(3);
|
const step3 = stub().resolves(3);
|
||||||
|
|
||||||
const result = await pipeline([step1, step2, step3])(0);
|
const result = await pipeline([step1, step2, step3])(0);
|
||||||
t.deepEqual(result, [1, 2, 3]);
|
t.deepEqual(result, [1, 2, 3]);
|
||||||
@@ -19,10 +19,10 @@ test('Execute each function in series passing the same input', async (t) => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
test('Execute each function in series passing a transformed input from "getNextInput"', async (t) => {
|
test('Execute each function in series passing a transformed input from "getNextInput"', async (t) => {
|
||||||
const step1 = sinon.stub).resolves(1);
|
const step1 = stub().resolves(1);
|
||||||
const step2 = sinon.stub).resolves(2);
|
const step2 = stub().resolves(2);
|
||||||
const step3 = sinon.stub).resolves(3);
|
const step3 = stub().resolves(3);
|
||||||
const step4 = sinon.stub).resolves(4);
|
const step4 = stub().resolves(4);
|
||||||
const getNextInput = (lastResult, result) => lastResult + result;
|
const getNextInput = (lastResult, result) => lastResult + result;
|
||||||
|
|
||||||
const result = await pipeline([step1, step2, step3, step4], {settleAll: false, getNextInput})(0);
|
const result = await pipeline([step1, step2, step3, step4], {settleAll: false, getNextInput})(0);
|
||||||
@@ -38,11 +38,11 @@ test('Execute each function in series passing a transformed input from "getNextI
|
|||||||
});
|
});
|
||||||
|
|
||||||
test('Execute each function in series passing the "lastResult" and "result" to "getNextInput"', async (t) => {
|
test('Execute each function in series passing the "lastResult" and "result" to "getNextInput"', async (t) => {
|
||||||
const step1 = sinon.stub).resolves(1);
|
const step1 = stub().resolves(1);
|
||||||
const step2 = sinon.stub).resolves(2);
|
const step2 = stub().resolves(2);
|
||||||
const step3 = sinon.stub).resolves(3);
|
const step3 = stub().resolves(3);
|
||||||
const step4 = sinon.stub).resolves(4);
|
const step4 = stub().resolves(4);
|
||||||
const getNextInput = sinon.stub).returnsArg(0);
|
const getNextInput = stub().returnsArg(0);
|
||||||
|
|
||||||
const result = await pipeline([step1, step2, step3, step4], {settleAll: false, getNextInput})(5);
|
const result = await pipeline([step1, step2, step3, step4], {settleAll: false, getNextInput})(5);
|
||||||
|
|
||||||
@@ -56,12 +56,12 @@ test('Execute each function in series passing the "lastResult" and "result" to "
|
|||||||
});
|
});
|
||||||
|
|
||||||
test('Execute each function in series calling "transform" to modify the results', async (t) => {
|
test('Execute each function in series calling "transform" to modify the results', async (t) => {
|
||||||
const step1 = sinon.stub).resolves(1);
|
const step1 = stub().resolves(1);
|
||||||
const step2 = sinon.stub).resolves(2);
|
const step2 = stub().resolves(2);
|
||||||
const step3 = sinon.stub).resolves(3);
|
const step3 = stub().resolves(3);
|
||||||
const step4 = sinon.stub).resolves(4);
|
const step4 = stub().resolves(4);
|
||||||
const getNextInput = sinon.stub).returnsArg(0);
|
const getNextInput = stub().returnsArg(0);
|
||||||
const transform = sinon.stub).callsFake((result) => result + 1);
|
const transform = stub().callsFake((result) => result + 1);
|
||||||
|
|
||||||
const result = await pipeline([step1, step2, step3, step4], {getNextInput, transform})(5);
|
const result = await pipeline([step1, step2, step3, step4], {getNextInput, transform})(5);
|
||||||
|
|
||||||
@@ -75,12 +75,12 @@ test('Execute each function in series calling "transform" to modify the results'
|
|||||||
});
|
});
|
||||||
|
|
||||||
test('Execute each function in series calling "transform" to modify the results with "settleAll"', async (t) => {
|
test('Execute each function in series calling "transform" to modify the results with "settleAll"', async (t) => {
|
||||||
const step1 = sinon.stub).resolves(1);
|
const step1 = stub().resolves(1);
|
||||||
const step2 = sinon.stub).resolves(2);
|
const step2 = stub().resolves(2);
|
||||||
const step3 = sinon.stub).resolves(3);
|
const step3 = stub().resolves(3);
|
||||||
const step4 = sinon.stub).resolves(4);
|
const step4 = stub().resolves(4);
|
||||||
const getNextInput = sinon.stub).returnsArg(0);
|
const getNextInput = stub().returnsArg(0);
|
||||||
const transform = sinon.stub).callsFake((result) => result + 1);
|
const transform = stub().callsFake((result) => result + 1);
|
||||||
|
|
||||||
const result = await pipeline([step1, step2, step3, step4], {settleAll: true, getNextInput, transform})(5);
|
const result = await pipeline([step1, step2, step3, step4], {settleAll: true, getNextInput, transform})(5);
|
||||||
|
|
||||||
@@ -94,9 +94,9 @@ test('Execute each function in series calling "transform" to modify the results
|
|||||||
});
|
});
|
||||||
|
|
||||||
test('Stop execution and throw error if a step rejects', async (t) => {
|
test('Stop execution and throw error if a step rejects', async (t) => {
|
||||||
const step1 = sinon.stub).resolves(1);
|
const step1 = stub().resolves(1);
|
||||||
const step2 = sinon.stub).rejects(new Error('test error'));
|
const step2 = stub().rejects(new Error('test error'));
|
||||||
const step3 = sinon.stub).resolves(3);
|
const step3 = stub().resolves(3);
|
||||||
|
|
||||||
const error = await t.throwsAsync(pipeline([step1, step2, step3])(0), {
|
const error = await t.throwsAsync(pipeline([step1, step2, step3])(0), {
|
||||||
instanceOf: Error,
|
instanceOf: Error,
|
||||||
@@ -112,9 +112,9 @@ test('Throw all errors from the first step throwing an AggregateError', async (t
|
|||||||
const error1 = new Error('test error 1');
|
const error1 = new Error('test error 1');
|
||||||
const error2 = new Error('test error 2');
|
const error2 = new Error('test error 2');
|
||||||
|
|
||||||
const step1 = sinon.stub).resolves(1);
|
const step1 = stub().resolves(1);
|
||||||
const step2 = sinon.stub).rejects(new AggregateError([error1, error2]));
|
const step2 = stub().rejects(new AggregateError([error1, error2]));
|
||||||
const step3 = sinon.stub).resolves(3);
|
const step3 = stub().resolves(3);
|
||||||
|
|
||||||
const errors = await t.throwsAsync(pipeline([step1, step2, step3])(0));
|
const errors = await t.throwsAsync(pipeline([step1, step2, step3])(0));
|
||||||
|
|
||||||
@@ -127,9 +127,9 @@ test('Throw all errors from the first step throwing an AggregateError', async (t
|
|||||||
test('Execute all even if a Promise rejects', async (t) => {
|
test('Execute all even if a Promise rejects', async (t) => {
|
||||||
const error1 = new Error('test error 1');
|
const error1 = new Error('test error 1');
|
||||||
const error2 = new Error('test error 2');
|
const error2 = new Error('test error 2');
|
||||||
const step1 = sinon.stub).resolves(1);
|
const step1 = stub().resolves(1);
|
||||||
const step2 = sinon.stub).rejects(error1);
|
const step2 = stub().rejects(error1);
|
||||||
const step3 = sinon.stub).rejects(error2);
|
const step3 = stub().rejects(error2);
|
||||||
|
|
||||||
const errors = await t.throwsAsync(pipeline([step1, step2, step3], {settleAll: true})(0));
|
const errors = await t.throwsAsync(pipeline([step1, step2, step3], {settleAll: true})(0));
|
||||||
|
|
||||||
@@ -144,8 +144,8 @@ test('Throw all errors from all steps throwing an AggregateError', async (t) =>
|
|||||||
const error2 = new Error('test error 2');
|
const error2 = new Error('test error 2');
|
||||||
const error3 = new Error('test error 3');
|
const error3 = new Error('test error 3');
|
||||||
const error4 = new Error('test error 4');
|
const error4 = new Error('test error 4');
|
||||||
const step1 = sinon.stub).rejects(new AggregateError([error1, error2]));
|
const step1 = stub().rejects(new AggregateError([error1, error2]));
|
||||||
const step2 = sinon.stub).rejects(new AggregateError([error3, error4]));
|
const step2 = stub().rejects(new AggregateError([error3, error4]));
|
||||||
|
|
||||||
const errors = await t.throwsAsync(pipeline([step1, step2], {settleAll: true})(0));
|
const errors = await t.throwsAsync(pipeline([step1, step2], {settleAll: true})(0));
|
||||||
|
|
||||||
@@ -157,10 +157,10 @@ test('Throw all errors from all steps throwing an AggregateError', async (t) =>
|
|||||||
test('Execute each function in series passing a transformed input even if a step rejects', async (t) => {
|
test('Execute each function in series passing a transformed input even if a step rejects', async (t) => {
|
||||||
const error2 = new Error('test error 2');
|
const error2 = new Error('test error 2');
|
||||||
const error3 = new Error('test error 3');
|
const error3 = new Error('test error 3');
|
||||||
const step1 = sinon.stub).resolves(1);
|
const step1 = stub().resolves(1);
|
||||||
const step2 = sinon.stub).rejects(error2);
|
const step2 = stub().rejects(error2);
|
||||||
const step3 = sinon.stub).rejects(error3);
|
const step3 = stub().rejects(error3);
|
||||||
const step4 = sinon.stub).resolves(4);
|
const step4 = stub().resolves(4);
|
||||||
const getNextInput = (previousResult, result) => previousResult + result;
|
const getNextInput = (previousResult, result) => previousResult + result;
|
||||||
|
|
||||||
const errors = await t.throwsAsync(pipeline([step1, step2, step3, step4], {settleAll: true, getNextInput})(0));
|
const errors = await t.throwsAsync(pipeline([step1, step2, step3, step4], {settleAll: true, getNextInput})(0));
|
||||||
|
|||||||
@@ -1,17 +1,17 @@
|
|||||||
import path from 'path';
|
const path = require('path');
|
||||||
import test from 'ava';
|
const test = require('ava');
|
||||||
import {copy, outputFile} from 'fs-extra';
|
const {copy, outputFile} = require('fs-extra');
|
||||||
import sinon from 'sinon';
|
const {stub} = require('sinon');
|
||||||
import tempy from 'tempy';
|
const tempy = require('tempy');
|
||||||
import getPlugins from '../../lib/plugins';
|
const getPlugins = require('../../lib/plugins');
|
||||||
|
|
||||||
// Save the current working diretory
|
// Save the current working diretory
|
||||||
const cwd = process.cwd();
|
const cwd = process.cwd();
|
||||||
|
|
||||||
test.beforeEach((t) => {
|
test.beforeEach((t) => {
|
||||||
// Stub the logger functions
|
// Stub the logger functions
|
||||||
t.context.log = sinon.stub);
|
t.context.log = stub();
|
||||||
t.context.success = sinon.stub);
|
t.context.success = stub();
|
||||||
t.context.logger = {log: t.context.log, success: t.context.success, scope: () => t.context.logger};
|
t.context.logger = {log: t.context.log, success: t.context.success, scope: () => t.context.logger};
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -56,8 +56,8 @@ test('Export plugins based on steps config', (t) => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
test('Export plugins based on "plugins" config (array)', async (t) => {
|
test('Export plugins based on "plugins" config (array)', async (t) => {
|
||||||
const plugin1 = {verifyConditions: sinon.stub), publish: sinon.stub)};
|
const plugin1 = {verifyConditions: stub(), publish: stub()};
|
||||||
const plugin2 = {verifyConditions: sinon.stub), verifyRelease: sinon.stub)};
|
const plugin2 = {verifyConditions: stub(), verifyRelease: stub()};
|
||||||
const plugins = getPlugins(
|
const plugins = getPlugins(
|
||||||
{cwd, logger: t.context.logger, options: {plugins: [plugin1, [plugin2, {}]], verifyRelease: () => {}}},
|
{cwd, logger: t.context.logger, options: {plugins: [plugin1, [plugin2, {}]], verifyRelease: () => {}}},
|
||||||
{}
|
{}
|
||||||
@@ -85,7 +85,7 @@ test('Export plugins based on "plugins" config (array)', async (t) => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
test('Export plugins based on "plugins" config (single definition)', async (t) => {
|
test('Export plugins based on "plugins" config (single definition)', async (t) => {
|
||||||
const plugin1 = {verifyConditions: sinon.stub), publish: sinon.stub)};
|
const plugin1 = {verifyConditions: stub(), publish: stub()};
|
||||||
const plugins = getPlugins({cwd, logger: t.context.logger, options: {plugins: plugin1}}, {});
|
const plugins = getPlugins({cwd, logger: t.context.logger, options: {plugins: plugin1}}, {});
|
||||||
|
|
||||||
await plugins.verifyConditions({options: {}});
|
await plugins.verifyConditions({options: {}});
|
||||||
@@ -106,8 +106,8 @@ test('Export plugins based on "plugins" config (single definition)', async (t) =
|
|||||||
});
|
});
|
||||||
|
|
||||||
test('Merge global options, "plugins" options and step options', async (t) => {
|
test('Merge global options, "plugins" options and step options', async (t) => {
|
||||||
const plugin1 = [{verifyConditions: sinon.stub), publish: sinon.stub)}, {pluginOpt1: 'plugin1'}];
|
const plugin1 = [{verifyConditions: stub(), publish: stub()}, {pluginOpt1: 'plugin1'}];
|
||||||
const plugin2 = [{verifyConditions: sinon.stub)}, {pluginOpt2: 'plugin2'}];
|
const plugin2 = [{verifyConditions: stub()}, {pluginOpt2: 'plugin2'}];
|
||||||
const plugin3 = [stub(), {pluginOpt3: 'plugin3'}];
|
const plugin3 = [stub(), {pluginOpt3: 'plugin3'}];
|
||||||
const plugins = getPlugins(
|
const plugins = getPlugins(
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import test from 'ava';
|
const test = require('ava');
|
||||||
import {validatePlugin, validateStep, loadPlugin, parseConfig} from '../../lib/plugins/utils.js';
|
const {validatePlugin, validateStep, loadPlugin, parseConfig} = require('../../lib/plugins/utils');
|
||||||
|
|
||||||
test('validatePlugin', (t) => {
|
test('validatePlugin', (t) => {
|
||||||
const path = 'plugin-module';
|
const path = 'plugin-module';
|
||||||
|
|||||||
+4
-5
@@ -1,7 +1,6 @@
|
|||||||
import test from 'ava';
|
const test = require('ava');
|
||||||
import AggregateError from 'aggregate-error';
|
const AggregateError = require('aggregate-error');
|
||||||
|
const {
|
||||||
import {
|
|
||||||
extractErrors,
|
extractErrors,
|
||||||
tagsToVersions,
|
tagsToVersions,
|
||||||
isMajorRange,
|
isMajorRange,
|
||||||
@@ -16,7 +15,7 @@ import {
|
|||||||
getRange,
|
getRange,
|
||||||
makeTag,
|
makeTag,
|
||||||
isSameChannel,
|
isSameChannel,
|
||||||
} from '../lib/utils.js';
|
} = require('../lib/utils');
|
||||||
|
|
||||||
test('extractErrors', (t) => {
|
test('extractErrors', (t) => {
|
||||||
const errors = [new Error('Error 1'), new Error('Error 2')];
|
const errors = [new Error('Error 1'), new Error('Error 2')];
|
||||||
|
|||||||
+4
-4
@@ -1,7 +1,7 @@
|
|||||||
import test from 'ava';
|
const test = require('ava');
|
||||||
import tempy from 'tempy';
|
const tempy = require('tempy');
|
||||||
import verify from '../lib/verify.js';
|
const verify = require('../lib/verify');
|
||||||
import {gitRepo} from './helpers/git-utils.js';
|
const {gitRepo} = require('./helpers/git-utils');
|
||||||
|
|
||||||
test('Throw a AggregateError', async (t) => {
|
test('Throw a AggregateError', async (t) => {
|
||||||
const {cwd} = await gitRepo();
|
const {cwd} = await gitRepo();
|
||||||
|
|||||||
Reference in New Issue
Block a user