semantic-release 10.0.0 → 11.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +17 -4
- package/bin/semantic-release.js +2 -1
- package/cli.js +2 -1
- package/index.js +18 -10
- package/lib/get-commits.js +5 -10
- package/lib/get-config.js +14 -6
- package/lib/get-next-version.js +4 -8
- package/lib/git.js +17 -1
- package/lib/plugins/definitions.js +9 -15
- package/lib/plugins/index.js +5 -1
- package/lib/plugins/normalize.js +5 -5
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -167,6 +167,7 @@ semantic-release
|
|
|
167
167
|
|
|
168
168
|
These options are currently available:
|
|
169
169
|
- `branch`: The branch on which releases should happen. Default: `'master'`
|
|
170
|
+
- `repositoryUrl`: The git repository URL. Default: `repository` property in `package.json` or git origin url. Any valid git url format is supported (See [Git protocols](https://git-scm.com/book/en/v2/Git-on-the-Server-The-Protocols)). If the [Github plugin](https://github.com/semantic-release/github) is used the URL must be a valid Github URL that include the `owner`, the `repository` name and the `host`. The Github shorthand URL is not supported.
|
|
170
171
|
- `dry-run`: Dry-run mode, skipping verifyConditions, publishing and release, printing next version and release notes
|
|
171
172
|
- `debug`: Output debugging information
|
|
172
173
|
|
|
@@ -206,12 +207,8 @@ module.exports = function (pluginConfig, config, callback) {}
|
|
|
206
207
|
|
|
207
208
|
- `pluginConfig`: If the user of your plugin specifies additional plugin config in the `package.json` (see the `verifyConditions` example above) then it’s this object.
|
|
208
209
|
- `config`: A config object containing a lot of information to act upon.
|
|
209
|
-
- `env`: All environment variables
|
|
210
210
|
- `options`: `semantic-release` options like `debug`, or `branch`
|
|
211
|
-
- `pkg`: Parsed `package.json`
|
|
212
211
|
- For certain plugins the `config` object contains even more information. See below.
|
|
213
|
-
- `callback`: If an error occurs pass it as first argument. Otherwise pass your result as second argument.
|
|
214
|
-
|
|
215
212
|
|
|
216
213
|
### `analyzeCommits`
|
|
217
214
|
|
|
@@ -290,6 +287,8 @@ Being able to write code for just the most recent node versions greatly simplifi
|
|
|
290
287
|
|
|
291
288
|
For a special purpose tool like `semantic-release`, that's only meant to be used in controlled CI environments, we think it's okay to have such a high version requirement. As `semantic-release` handles package publishing we expect almost every project to have at least one build job running node 8 already – and that's all it takes. Even if that's not that case `semantic-release` can still be executed with the help of [npx](https://www.npmjs.com/package/npx) (`npx -p node@8 npm run semantic-release`).
|
|
292
289
|
|
|
290
|
+
Please see our [Node Support Policy](#node-support-policy) for our long-term promise for supporting Node.
|
|
291
|
+
|
|
293
292
|
## Badge
|
|
294
293
|
|
|
295
294
|
Use this in one of your projects? Include one of these badges in your README.md to let people know that your package is published using `semantic-release`.
|
|
@@ -312,6 +311,20 @@ Use this in one of your projects? Include one of these badges in your README.md
|
|
|
312
311
|
[](https://github.com/semantic-release/semantic-release)
|
|
313
312
|
```
|
|
314
313
|
|
|
314
|
+
## Node Support Policy
|
|
315
|
+
|
|
316
|
+
We only support [Long-Term Support](https://github.com/nodejs/Release) versions of Node starting with [Node 8.9.0 (LTS)](https://nodejs.org/en/blog/release/v8.9.0/).
|
|
317
|
+
|
|
318
|
+
We specifically limit our support to LTS versions of Node, not because this package won't work on other versions, but because we have a limited amount of time, and supporting LTS offers the greatest return on that investment.
|
|
319
|
+
|
|
320
|
+
It's possible this package will work correctly on newer versions of Node. It may even be possible to use this package on older versions of Node, though that's more unlikely as we'll make every effort to take advantage of features available in the oldest LTS version we support.
|
|
321
|
+
|
|
322
|
+
As each Node LTS version reaches its end-of-life we will remove that version from the node engines property of our package's package.json file. Removing a Node version is considered a breaking change and will entail the publishing of a new major version of this package. We will not accept any requests to support an end-of-life version of Node. Any merge requests or issues supporting an end-of-life version of Node will be closed.
|
|
323
|
+
|
|
324
|
+
We will accept code that allows this package to run on newer, non-LTS, versions of Node. Furthermore, we will attempt to ensure our own changes work on the latest version of Node. To help in that commitment, our continuous integration setup runs against all LTS versions of Node in addition the most recent Node release; called current.
|
|
325
|
+
|
|
326
|
+
JavaScript package managers should allow you to install this package with any version of Node, with, at most, a warning if your version of Node does not fall within the range specified by our node engines property. If you encounter issues installing this package, please report the issue to your package manager.
|
|
327
|
+
|
|
315
328
|
## License
|
|
316
329
|
|
|
317
330
|
MIT License
|
package/bin/semantic-release.js
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
// Bad news: We have to write plain ES5 in this file
|
|
4
4
|
// Good news: It's the only file of the entire project
|
|
5
5
|
|
|
6
|
+
// eslint-disable-next-line no-var
|
|
6
7
|
var semver = require('semver');
|
|
7
8
|
|
|
8
9
|
if (semver.lt(process.version, '8.0.0')) {
|
|
@@ -22,7 +23,7 @@ npx is bundled with npm >= 5.4, or available via npm. More info: npm.im/npx`
|
|
|
22
23
|
process.exit(1);
|
|
23
24
|
}
|
|
24
25
|
|
|
25
|
-
//
|
|
26
|
+
// Node 8+ from this point on
|
|
26
27
|
require('../cli')().catch(() => {
|
|
27
28
|
process.exitCode = 1;
|
|
28
29
|
});
|
package/cli.js
CHANGED
|
@@ -10,6 +10,7 @@ module.exports = async () => {
|
|
|
10
10
|
.name('semantic-release')
|
|
11
11
|
.description('Run automated package publishing')
|
|
12
12
|
.option('-b, --branch <branch>', 'Branch to release from')
|
|
13
|
+
.option('-r, --repositoryUrl <repositoryUrl>', 'Git repository URL')
|
|
13
14
|
.option(
|
|
14
15
|
'--verify-conditions <paths>',
|
|
15
16
|
'Comma separated list of paths or packages name for the verifyConditions plugin(s)',
|
|
@@ -41,7 +42,7 @@ module.exports = async () => {
|
|
|
41
42
|
program.outputHelp();
|
|
42
43
|
process.exitCode = 1;
|
|
43
44
|
} else {
|
|
44
|
-
await require('
|
|
45
|
+
await require('.')(program.opts());
|
|
45
46
|
}
|
|
46
47
|
} catch (err) {
|
|
47
48
|
// If error is a SemanticReleaseError then it's an expected exception case (no release to be done, running on a PR etc..) and the cli will return with 0
|
package/index.js
CHANGED
|
@@ -1,32 +1,40 @@
|
|
|
1
1
|
const marked = require('marked');
|
|
2
2
|
const TerminalRenderer = require('marked-terminal');
|
|
3
3
|
const SemanticReleaseError = require('@semantic-release/error');
|
|
4
|
-
const {gitHead: getGitHead} = require('./lib/git');
|
|
5
4
|
const getConfig = require('./lib/get-config');
|
|
6
5
|
const getNextVersion = require('./lib/get-next-version');
|
|
7
6
|
const getCommits = require('./lib/get-commits');
|
|
8
7
|
const logger = require('./lib/logger');
|
|
8
|
+
const {gitHead: getGitHead, isGitRepo} = require('./lib/git');
|
|
9
9
|
|
|
10
10
|
module.exports = async opts => {
|
|
11
|
+
if (!await isGitRepo()) {
|
|
12
|
+
throw new SemanticReleaseError('Semantic-release must run from a git repository', 'ENOGITREPO');
|
|
13
|
+
}
|
|
14
|
+
|
|
11
15
|
const config = await getConfig(opts, logger);
|
|
12
|
-
const {plugins,
|
|
16
|
+
const {plugins, options} = config;
|
|
17
|
+
|
|
18
|
+
if (!options.repositoryUrl) {
|
|
19
|
+
throw new SemanticReleaseError('The repositoryUrl option is required', 'ENOREPOURL');
|
|
20
|
+
}
|
|
13
21
|
|
|
14
|
-
logger.log('Run automated release
|
|
22
|
+
logger.log('Run automated release from branch %s', options.branch);
|
|
15
23
|
|
|
16
24
|
if (!options.dryRun) {
|
|
17
25
|
logger.log('Call plugin %s', 'verify-conditions');
|
|
18
|
-
await plugins.verifyConditions({
|
|
26
|
+
await plugins.verifyConditions({options, logger});
|
|
19
27
|
}
|
|
20
28
|
|
|
21
29
|
logger.log('Call plugin %s', 'get-last-release');
|
|
22
30
|
const {commits, lastRelease} = await getCommits(
|
|
23
|
-
await plugins.getLastRelease({
|
|
31
|
+
await plugins.getLastRelease({options, logger}),
|
|
24
32
|
options.branch,
|
|
25
33
|
logger
|
|
26
34
|
);
|
|
27
35
|
|
|
28
36
|
logger.log('Call plugin %s', 'analyze-commits');
|
|
29
|
-
const type = await plugins.analyzeCommits({
|
|
37
|
+
const type = await plugins.analyzeCommits({options, logger, lastRelease, commits});
|
|
30
38
|
if (!type) {
|
|
31
39
|
throw new SemanticReleaseError('There are no relevant changes, so no new version is released.', 'ENOCHANGE');
|
|
32
40
|
}
|
|
@@ -34,9 +42,9 @@ module.exports = async opts => {
|
|
|
34
42
|
const nextRelease = {type, version, gitHead: await getGitHead(), gitTag: `v${version}`};
|
|
35
43
|
|
|
36
44
|
logger.log('Call plugin %s', 'verify-release');
|
|
37
|
-
await plugins.verifyRelease({
|
|
45
|
+
await plugins.verifyRelease({options, logger, lastRelease, commits, nextRelease});
|
|
38
46
|
|
|
39
|
-
const generateNotesParam = {
|
|
47
|
+
const generateNotesParam = {options, logger, lastRelease, commits, nextRelease};
|
|
40
48
|
|
|
41
49
|
if (options.dryRun) {
|
|
42
50
|
logger.log('Call plugin %s', 'generate-notes');
|
|
@@ -49,7 +57,7 @@ module.exports = async opts => {
|
|
|
49
57
|
nextRelease.notes = await plugins.generateNotes(generateNotesParam);
|
|
50
58
|
|
|
51
59
|
logger.log('Call plugin %s', 'publish');
|
|
52
|
-
await plugins.publish({options,
|
|
60
|
+
await plugins.publish({options, logger, lastRelease, commits, nextRelease}, async prevInput => {
|
|
53
61
|
const newGitHead = await getGitHead();
|
|
54
62
|
// If previous publish plugin has created a commit (gitHead changed)
|
|
55
63
|
if (prevInput.nextRelease.gitHead !== newGitHead) {
|
|
@@ -59,7 +67,7 @@ module.exports = async opts => {
|
|
|
59
67
|
nextRelease.notes = await plugins.generateNotes(generateNotesParam);
|
|
60
68
|
}
|
|
61
69
|
// Call the next publish plugin with the updated `nextRelease`
|
|
62
|
-
return {options,
|
|
70
|
+
return {options, logger, lastRelease, commits, nextRelease};
|
|
63
71
|
});
|
|
64
72
|
logger.log('Published release: %s', nextRelease.version);
|
|
65
73
|
}
|
package/lib/get-commits.js
CHANGED
|
@@ -18,6 +18,7 @@ const getVersionHead = require('./get-version-head');
|
|
|
18
18
|
* @typedef {Object} LastRelease
|
|
19
19
|
* @property {string} version The version number of the last release.
|
|
20
20
|
* @property {string} [gitHead] The commit sha used to make the last release.
|
|
21
|
+
* @property {string} [gitTag] The tag used to make the last release.
|
|
21
22
|
*/
|
|
22
23
|
|
|
23
24
|
/**
|
|
@@ -45,7 +46,7 @@ const getVersionHead = require('./get-version-head');
|
|
|
45
46
|
* @throws {SemanticReleaseError} with code `ENOTINHISTORY` if `lastRelease.gitHead` or the commit sha derived from `config.lastRelease.version` is not in the direct history of `branch`.
|
|
46
47
|
* @throws {SemanticReleaseError} with code `ENOGITHEAD` if `lastRelease.gitHead` is undefined and no commit sha can be found for the `config.lastRelease.version`.
|
|
47
48
|
*/
|
|
48
|
-
module.exports = async ({version, gitHead}, branch, logger) => {
|
|
49
|
+
module.exports = async ({version, gitHead} = {}, branch, logger) => {
|
|
49
50
|
let gitTag;
|
|
50
51
|
if (gitHead || version) {
|
|
51
52
|
try {
|
|
@@ -83,24 +84,18 @@ function noGitHeadMessage(branch, version) {
|
|
|
83
84
|
This means semantic-release can not extract the commits between now and then.
|
|
84
85
|
This is usually caused by releasing from outside the repository directory or with innaccessible git metadata.
|
|
85
86
|
|
|
86
|
-
You can recover from this error by creating a tag for the version "${
|
|
87
|
-
version
|
|
88
|
-
}" on the commit corresponding to this release:
|
|
87
|
+
You can recover from this error by creating a tag for the version "${version}" on the commit corresponding to this release:
|
|
89
88
|
$ git tag -f v${version} <commit sha1 corresponding to last release>
|
|
90
89
|
$ git push -f --tags origin ${branch}
|
|
91
90
|
`;
|
|
92
91
|
}
|
|
93
92
|
|
|
94
93
|
function notInHistoryMessage(gitHead, branch, version) {
|
|
95
|
-
return `The commit the last release of this package was derived from is not in the direct history of the "${
|
|
96
|
-
branch
|
|
97
|
-
}" branch.
|
|
94
|
+
return `The commit the last release of this package was derived from is not in the direct history of the "${branch}" branch.
|
|
98
95
|
This means semantic-release can not extract the commits between now and then.
|
|
99
96
|
This is usually caused by force pushing, releasing from an unrelated branch, or using an already existing package name.
|
|
100
97
|
|
|
101
|
-
You can recover from this error by restoring the commit "${gitHead}" or by creating a tag for the version "${
|
|
102
|
-
version
|
|
103
|
-
}" on the commit corresponding to this release:
|
|
98
|
+
You can recover from this error by restoring the commit "${gitHead}" or by creating a tag for the version "${version}" on the commit corresponding to this release:
|
|
104
99
|
$ git tag -f v${version || '<version>'} <commit sha1 corresponding to last release>
|
|
105
100
|
$ git push -f --tags origin ${branch}
|
|
106
101
|
`;
|
package/lib/get-config.js
CHANGED
|
@@ -1,19 +1,27 @@
|
|
|
1
|
-
const
|
|
1
|
+
const readPkgUp = require('read-pkg-up');
|
|
2
2
|
const {defaults} = require('lodash');
|
|
3
|
-
const
|
|
3
|
+
const cosmiconfig = require('cosmiconfig');
|
|
4
4
|
const debug = require('debug')('semantic-release:config');
|
|
5
|
+
const {repoUrl} = require('./git');
|
|
5
6
|
const plugins = require('./plugins');
|
|
6
7
|
|
|
7
8
|
module.exports = async (opts, logger) => {
|
|
8
|
-
const
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
const {config} = (await cosmiconfig('release', {rcExtensions: true}).load(process.cwd())) || {};
|
|
10
|
+
const options = defaults(opts, config, {branch: 'master', repositoryUrl: (await pkgRepoUrl()) || (await repoUrl())});
|
|
11
|
+
|
|
12
|
+
debug('name: %O', options.name);
|
|
11
13
|
debug('branch: %O', options.branch);
|
|
14
|
+
debug('repositoryUrl: %O', options.repositoryUrl);
|
|
12
15
|
debug('analyzeCommits: %O', options.analyzeCommits);
|
|
13
16
|
debug('generateNotes: %O', options.generateNotes);
|
|
14
17
|
debug('verifyConditions: %O', options.verifyConditions);
|
|
15
18
|
debug('verifyRelease: %O', options.verifyRelease);
|
|
16
19
|
debug('publish: %O', options.publish);
|
|
17
20
|
|
|
18
|
-
return {
|
|
21
|
+
return {options, plugins: await plugins(options, logger)};
|
|
19
22
|
};
|
|
23
|
+
|
|
24
|
+
async function pkgRepoUrl() {
|
|
25
|
+
const {pkg} = await readPkgUp();
|
|
26
|
+
return pkg && pkg.repository ? pkg.repository.url : null;
|
|
27
|
+
}
|
package/lib/get-next-version.js
CHANGED
|
@@ -1,17 +1,13 @@
|
|
|
1
1
|
const semver = require('semver');
|
|
2
|
-
const SemanticReleaseError = require('@semantic-release/error');
|
|
3
2
|
|
|
4
3
|
module.exports = (type, lastRelease, logger) => {
|
|
5
4
|
let version;
|
|
6
|
-
if (
|
|
7
|
-
version = '1.0.0';
|
|
8
|
-
logger.log('There is no previous release, the next release version is %s', version);
|
|
9
|
-
} else {
|
|
5
|
+
if (lastRelease.version) {
|
|
10
6
|
version = semver.inc(lastRelease.version, type);
|
|
11
|
-
if (!version) {
|
|
12
|
-
throw new SemanticReleaseError(`Invalid release type ${type}`, 'EINVALIDTYPE');
|
|
13
|
-
}
|
|
14
7
|
logger.log('The next release version is %s', version);
|
|
8
|
+
} else {
|
|
9
|
+
version = '1.0.0';
|
|
10
|
+
logger.log('There is no previous release, the next release version is %s', version);
|
|
15
11
|
}
|
|
16
12
|
|
|
17
13
|
return version;
|
package/lib/git.js
CHANGED
|
@@ -72,4 +72,20 @@ async function gitHead() {
|
|
|
72
72
|
}
|
|
73
73
|
}
|
|
74
74
|
|
|
75
|
-
|
|
75
|
+
/**
|
|
76
|
+
* @return {string|null} The value of the remote git URL.
|
|
77
|
+
*/
|
|
78
|
+
async function repoUrl() {
|
|
79
|
+
return (await execa.stdout('git', ['remote', 'get-url', 'origin'], {reject: false})) || null;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* @return {Boolean} `true` if the current working directory is in a git repository, `false` otherwise.
|
|
84
|
+
*/
|
|
85
|
+
async function isGitRepo() {
|
|
86
|
+
const shell = await execa('git', ['rev-parse', '--git-dir'], {reject: false});
|
|
87
|
+
debugShell('Check if the current working directory is a git repository', shell, debug);
|
|
88
|
+
return shell.code === 0;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
module.exports = {gitTagHead, gitCommitTag, isCommitInHistory, unshallow, gitHead, repoUrl, isGitRepo};
|
|
@@ -1,16 +1,12 @@
|
|
|
1
1
|
const {isString, isObject, isFunction, isArray} = require('lodash');
|
|
2
2
|
const semver = require('semver');
|
|
3
|
-
const conditionTravis = require('@semantic-release/condition-travis');
|
|
4
|
-
const commitAnalyzer = require('@semantic-release/commit-analyzer');
|
|
5
|
-
const releaseNotesGenerator = require('@semantic-release/release-notes-generator');
|
|
6
|
-
const npm = require('@semantic-release/npm');
|
|
7
|
-
const github = require('@semantic-release/github');
|
|
8
3
|
|
|
9
4
|
const RELEASE_TYPE = ['major', 'premajor', 'minor', 'preminor', 'patch', 'prepatch', 'prerelease'];
|
|
5
|
+
const validatePluginConfig = conf => isString(conf) || isString(conf.path) || isFunction(conf);
|
|
10
6
|
|
|
11
7
|
module.exports = {
|
|
12
8
|
verifyConditions: {
|
|
13
|
-
default: [npm
|
|
9
|
+
default: ['@semantic-release/npm', '@semantic-release/github', '@semantic-release/condition-travis'],
|
|
14
10
|
config: {
|
|
15
11
|
validator: conf => !conf || (isArray(conf) ? conf : [conf]).every(conf => validatePluginConfig(conf)),
|
|
16
12
|
message:
|
|
@@ -18,7 +14,7 @@ module.exports = {
|
|
|
18
14
|
},
|
|
19
15
|
},
|
|
20
16
|
getLastRelease: {
|
|
21
|
-
default: npm
|
|
17
|
+
default: '@semantic-release/npm',
|
|
22
18
|
config: {
|
|
23
19
|
validator: conf => Boolean(conf) && validatePluginConfig(conf),
|
|
24
20
|
message:
|
|
@@ -34,7 +30,7 @@ module.exports = {
|
|
|
34
30
|
},
|
|
35
31
|
},
|
|
36
32
|
analyzeCommits: {
|
|
37
|
-
default:
|
|
33
|
+
default: '@semantic-release/commit-analyzer',
|
|
38
34
|
config: {
|
|
39
35
|
validator: conf => Boolean(conf) && validatePluginConfig(conf),
|
|
40
36
|
message:
|
|
@@ -42,7 +38,7 @@ module.exports = {
|
|
|
42
38
|
},
|
|
43
39
|
output: {
|
|
44
40
|
validator: output => !output || RELEASE_TYPE.includes(output),
|
|
45
|
-
message: 'The "analyzeCommits" plugin output must be
|
|
41
|
+
message: 'The "analyzeCommits" plugin output, if defined, must be a valid semver release type.',
|
|
46
42
|
},
|
|
47
43
|
},
|
|
48
44
|
verifyRelease: {
|
|
@@ -54,19 +50,19 @@ module.exports = {
|
|
|
54
50
|
},
|
|
55
51
|
},
|
|
56
52
|
generateNotes: {
|
|
57
|
-
default:
|
|
53
|
+
default: '@semantic-release/release-notes-generator',
|
|
58
54
|
config: {
|
|
59
55
|
validator: conf => !conf || validatePluginConfig(conf),
|
|
60
56
|
message:
|
|
61
57
|
'The "generateNotes" plugin, if defined, must be a single plugin definition. A plugin definition is either a string or an object with a path property.',
|
|
62
58
|
},
|
|
63
59
|
output: {
|
|
64
|
-
validator: output => isString(output),
|
|
65
|
-
message: 'The "generateNotes" plugin output must be a string.',
|
|
60
|
+
validator: output => !output || isString(output),
|
|
61
|
+
message: 'The "generateNotes" plugin output, if defined, must be a string.',
|
|
66
62
|
},
|
|
67
63
|
},
|
|
68
64
|
publish: {
|
|
69
|
-
default: [npm
|
|
65
|
+
default: ['@semantic-release/npm', '@semantic-release/github'],
|
|
70
66
|
config: {
|
|
71
67
|
validator: conf => Boolean(conf) && (isArray(conf) ? conf : [conf]).every(conf => validatePluginConfig(conf)),
|
|
72
68
|
message:
|
|
@@ -74,5 +70,3 @@ module.exports = {
|
|
|
74
70
|
},
|
|
75
71
|
},
|
|
76
72
|
};
|
|
77
|
-
|
|
78
|
-
const validatePluginConfig = conf => isString(conf) || isString(conf.path) || isFunction(conf);
|
package/lib/plugins/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const {isArray} = require('lodash');
|
|
1
|
+
const {isArray, isObject} = require('lodash');
|
|
2
2
|
const DEFINITIONS = require('./definitions');
|
|
3
3
|
const pipeline = require('./pipeline');
|
|
4
4
|
const normalize = require('./normalize');
|
|
@@ -8,6 +8,10 @@ module.exports = (options, logger) =>
|
|
|
8
8
|
const {config, output, default: def} = DEFINITIONS[pluginType];
|
|
9
9
|
let pluginConfs;
|
|
10
10
|
if (options[pluginType]) {
|
|
11
|
+
// If an object is passed and the path is missing, set the default one for single plugins
|
|
12
|
+
if (isObject(options[pluginType]) && !options[pluginType].path && !isArray(def)) {
|
|
13
|
+
options[pluginType].path = def;
|
|
14
|
+
}
|
|
11
15
|
if (config && !config.validator(options[pluginType])) {
|
|
12
16
|
throw new Error(config.message);
|
|
13
17
|
}
|
package/lib/plugins/normalize.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const {
|
|
1
|
+
const {inspect} = require('util');
|
|
2
2
|
const {isString, isObject, isFunction, noop, cloneDeep} = require('lodash');
|
|
3
3
|
const importFrom = require('import-from');
|
|
4
4
|
|
|
@@ -8,15 +8,15 @@ module.exports = (pluginType, pluginConfig, logger, validator) => {
|
|
|
8
8
|
}
|
|
9
9
|
const {path, ...config} = isString(pluginConfig) || isFunction(pluginConfig) ? {path: pluginConfig} : pluginConfig;
|
|
10
10
|
if (!isFunction(pluginConfig)) {
|
|
11
|
-
logger.log('Load plugin %s', path);
|
|
11
|
+
logger.log('Load plugin %s from %s', pluginType, path);
|
|
12
12
|
}
|
|
13
13
|
const plugin = isFunction(path) ? path : importFrom.silent(__dirname, path) || importFrom(process.cwd(), path);
|
|
14
14
|
|
|
15
15
|
let func;
|
|
16
16
|
if (isFunction(plugin)) {
|
|
17
|
-
func =
|
|
17
|
+
func = plugin.bind(null, cloneDeep(config));
|
|
18
18
|
} else if (isObject(plugin) && plugin[pluginType] && isFunction(plugin[pluginType])) {
|
|
19
|
-
func =
|
|
19
|
+
func = plugin[pluginType].bind(null, cloneDeep(config));
|
|
20
20
|
} else {
|
|
21
21
|
throw new Error(
|
|
22
22
|
`The ${pluginType} plugin must be a function, or an object with a function in the property ${pluginType}.`
|
|
@@ -27,7 +27,7 @@ module.exports = (pluginType, pluginConfig, logger, validator) => {
|
|
|
27
27
|
const result = await func(cloneDeep(input));
|
|
28
28
|
|
|
29
29
|
if (validator && !validator.validator(result)) {
|
|
30
|
-
throw new Error(`${validator.message}
|
|
30
|
+
throw new Error(`${validator.message} Received: ${inspect(result)}`);
|
|
31
31
|
}
|
|
32
32
|
return result;
|
|
33
33
|
};
|
package/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"semantic-release","description":"Automated semver compliant package publishing","version":"
|
|
1
|
+
{"name":"semantic-release","description":"Automated semver compliant package publishing","version":"11.0.2","author":"Stephan Bönnemann <stephan@boennemann.me> (http://boennemann.me)","bin":{"semantic-release":"bin/semantic-release.js"},"bugs":{"url":"https://github.com/semantic-release/semantic-release/issues"},"config":{"commitizen":{"path":"cz-conventional-changelog"}},"dependencies":{"@semantic-release/commit-analyzer":"^5.0.0","@semantic-release/condition-travis":"^7.0.0","@semantic-release/error":"^2.1.0","@semantic-release/github":"^2.0.0","@semantic-release/npm":"^2.0.0","@semantic-release/release-notes-generator":"^6.0.0","chalk":"^2.3.0","commander":"^2.11.0","cosmiconfig":"^3.1.0","debug":"^3.1.0","execa":"^0.8.0","get-stream":"^3.0.0","git-log-parser":"^1.2.0","import-from":"^2.1.0","lodash":"^4.0.0","marked":"^0.3.6","marked-terminal":"^2.0.0","p-reduce":"^1.0.0","read-pkg-up":"^3.0.0","semver":"^5.4.1"},"devDependencies":{"ava":"^0.24.0","codecov":"^3.0.0","commitizen":"^2.9.6","cz-conventional-changelog":"^2.0.0","dockerode":"^2.5.2","eslint-config-prettier":"^2.5.0","eslint-plugin-prettier":"^2.3.0","file-url":"^2.0.2","fs-extra":"^4.0.2","got":"^8.0.0","js-yaml":"^3.10.0","mockserver-client":"^5.1.1","nock":"^9.0.2","nyc":"^11.2.1","p-retry":"^1.0.0","prettier":"~1.9.0","proxyquire":"^1.8.0","sinon":"^4.0.0","tempy":"^0.2.1","xo":"^0.18.2"},"engines":{"node":">=4","npm":">=2"},"files":["bin","lib","index.js","cli.js"],"homepage":"https://github.com/semantic-release/semantic-release#readme","keywords":["author","automation","changelog","module","package","publish","release","semver","version"],"license":"MIT","main":"index.js","nyc":{"include":["lib/**/*.js","index.js","cli.js"],"reporter":["json","text","html"],"all":true},"prettier":{"printWidth":120,"singleQuote":true,"bracketSpacing":false,"trailingComma":"es5"},"publishConfig":{"tag":"next"},"release":{"branch":"caribou"},"repository":{"type":"git","url":"git+https://github.com/semantic-release/semantic-release.git"},"scripts":{"cm":"git-cz","codecov":"codecov -f coverage/coverage-final.json","lint":"xo","pretest":"npm run lint","semantic-release":"./bin/semantic-release.js","test":"nyc ava -v"},"xo":{"extends":["prettier"],"plugins":["prettier"],"rules":{"prettier/prettier":2}}}
|