@semantic-release/changelog
Advanced tools
Comparing version 2.1.0 to 2.1.1
@@ -6,14 +6,20 @@ const {isString, isUndefined} = require('lodash'); | ||
const isNonEmptyString = value => isString(value) && value.trim(); | ||
const VALIDATORS = { | ||
changelogFile: isNonEmptyString, | ||
changelogTitle: isNonEmptyString, | ||
}; | ||
module.exports = pluginConfig => { | ||
const {changelogFile, changelogTitle} = resolveConfig(pluginConfig); | ||
const errors = []; | ||
const options = resolveConfig(pluginConfig); | ||
if (!isUndefined(changelogFile) && !(isString(changelogFile) && changelogFile.trim())) { | ||
errors.push(getError('EINVALIDCHANGELOGFILE', {changelogFile})); | ||
} | ||
const errors = Object.entries(options).reduce( | ||
(errors, [option, value]) => | ||
!isUndefined(value) && value !== false && !VALIDATORS[option](value) | ||
? [...errors, getError(`EINVALID${option.toUpperCase()}`, {[option]: value})] | ||
: errors, | ||
[] | ||
); | ||
if (!isUndefined(changelogTitle) && !(isString(changelogTitle) && changelogTitle.trim())) { | ||
errors.push(getError('EINVALIDCHANGELOGTITLE', {changelogTitle})); | ||
} | ||
if (errors.length > 0) { | ||
@@ -20,0 +26,0 @@ throw new AggregateError(errors); |
{ | ||
"name": "@semantic-release/changelog", | ||
"description": "Set of semantic-release plugins for creating or updating a changelog file", | ||
"version": "2.1.0", | ||
"version": "2.1.1", | ||
"author": "Pierre Vanduynslager (https://github.com/pvdlg)", | ||
@@ -6,0 +6,0 @@ "bugs": { |
@@ -29,2 +29,3 @@ # @semantic-release/changelog | ||
**Note**: If you use a [shareable configuration](https://github.com/semantic-release/semantic-release/blob/caribou/docs/usage/shareable-configurations.md#shareable-configurations) that defines one of these options you can set it to `false` in your [**semantic-release** configuration](https://github.com/semantic-release/semantic-release/blob/caribou/docs/usage/configuration.md#configuration) in order to use the default value. | ||
@@ -31,0 +32,0 @@ ### Usage |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
10051
95
63