Socket
Socket
Sign inDemoInstall

@semantic-release/changelog

Package Overview
Dependencies
Maintainers
4
Versions
25
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@semantic-release/changelog - npm Package Compare versions

Comparing version 2.0.3 to 2.1.0

8

lib/definitions/errors.js

@@ -16,2 +16,10 @@ const url = require('url');

}),
EINVALIDCHANGELOGTITLE: ({changelogTitle}) => ({
message: 'Invalid `changelogTitle` option.',
details: `The [changelogTitle option](${linkify(
'README.md#options'
)}) option, if defined, must be a non empty \`String\`.
Your configuration for the \`changelogTitle\` option is \`${changelogTitle}\`.`,
}),
};

11

lib/prepare.js

@@ -5,3 +5,3 @@ const {readFile, writeFile, ensureFile} = require('fs-extra');

module.exports = async (pluginConfig, notes, logger) => {
const {changelogFile} = resolveConfig(pluginConfig);
const {changelogFile, changelogTitle} = resolveConfig(pluginConfig);

@@ -17,4 +17,11 @@ if (notes) {

}
await writeFile(changelogFile, `${notes.trim()}\n${currentFile ? `\n${currentFile}\n` : ''}`);
const currentContent =
changelogTitle && currentFile.startsWith(changelogTitle)
? currentFile.slice(changelogTitle.length).trim()
: currentFile;
const content = `${notes.trim()}\n${currentContent ? `\n${currentContent}\n` : ''}`;
await writeFile(changelogFile, changelogTitle ? `${changelogTitle}\n\n${content}` : content);
}
};

3

lib/resolve-config.js
const {isUndefined} = require('lodash');
module.exports = ({changelogFile}) => ({
module.exports = ({changelogFile, changelogTitle}) => ({
changelogFile: isUndefined(changelogFile) ? 'CHANGELOG.md' : changelogFile,
changelogTitle,
});

@@ -7,3 +7,3 @@ const {isString, isUndefined} = require('lodash');

module.exports = pluginConfig => {
const {changelogFile} = resolveConfig(pluginConfig);
const {changelogFile, changelogTitle} = resolveConfig(pluginConfig);
const errors = [];

@@ -15,2 +15,6 @@

if (!isUndefined(changelogTitle) && !(isString(changelogTitle) && changelogTitle.trim())) {
errors.push(getError('EINVALIDCHANGELOGTITLE', {changelogTitle}));
}
if (errors.length > 0) {

@@ -17,0 +21,0 @@ throw new AggregateError(errors);

{
"name": "@semantic-release/changelog",
"description": "Set of semantic-release plugins for creating or updating a changelog file",
"version": "2.0.3",
"version": "2.1.0",
"author": "Pierre Vanduynslager (https://github.com/pvdlg)",

@@ -6,0 +6,0 @@ "bugs": {

@@ -24,6 +24,8 @@ # @semantic-release/changelog

| Options | Description | Default |
|-----------------|-----------------------------|----------------|
| `changelogFile` | File path of the changelog. | `CHANGELOG.md` |
| Options | Description | Default |
|------------------|-----------------------------|----------------|
| `changelogFile` | File path of the changelog. | `CHANGELOG.md` |
| `changelogTitle` | Title in the changelog. | None |
### Usage

@@ -30,0 +32,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc