Skip to content

Commit c34dbc2

Browse files
committed
feat: require Node.js >=10.13
BREAKING CHANGE: Require Node.js >= 10.13
1 parent c463436 commit c34dbc2

File tree

4 files changed

+18
-9
lines changed

4 files changed

+18
-9
lines changed

index.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
const {URL, format} = require('url');
1+
const {format} = require('url');
22
const {find, merge} = require('lodash');
33
const getStream = require('get-stream');
44
const intoStream = require('into-stream');
@@ -31,13 +31,13 @@ async function generateNotes(pluginConfig, context) {
3131
const repositoryUrl = options.repositoryUrl.replace(/\.git$/i, '');
3232
const {parserOpts, writerOpts} = await loadChangelogConfig(pluginConfig, context);
3333

34-
const [match, auth, host, path] = /^(?!.+:\/\/)(?:(.*)@)?(.*?):(.*)$/.exec(repositoryUrl) || [];
34+
const [match, auth, host, path] = /^(?!.+:\/\/)(?:(?<auth>.*)@)?(?<host>.*?):(?<path>.*)$/.exec(repositoryUrl) || [];
3535
let {hostname, port, pathname, protocol} = new URL(
3636
match ? `ssh://${auth ? `${auth}@` : ''}${host}/${path}` : repositoryUrl
3737
);
3838
port = protocol.includes('ssh') ? '' : port;
3939
protocol = protocol && /http[^s]/.test(protocol) ? 'http' : 'https';
40-
const [, owner, repository] = /^\/([^/]+)?\/?(.+)?$/.exec(pathname);
40+
const [, owner, repository] = /^\/(?<owner>[^/]+)?\/?(?<repository>.+)?$/.exec(pathname);
4141

4242
const {issue, commit, referenceActions, issuePrefixes} =
4343
find(HOSTS_CONFIG, conf => conf.hostname === hostname) || HOSTS_CONFIG.default;

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
"xo": "^0.25.0"
4242
},
4343
"engines": {
44-
"node": ">=8.16"
44+
"node": ">=10.13"
4545
},
4646
"files": [
4747
"lib",

test/integration.test.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ test('Accept a "parseOpts" and "writerOpts" objects as option', async t => {
158158
const changelog = await generateNotes(
159159
{
160160
parserOpts: {
161-
headerPattern: /^%%(.*?)%% (.*)$/,
161+
headerPattern: /^%%(?<tag>.*?)%% (?<message>.*)$/,
162162
headerCorrespondence: ['tag', 'message'],
163163
referenceActions: ['keyword'],
164164
issuePrefixes: ['#', 'JIRA-'],
@@ -197,7 +197,7 @@ test('Accept a partial "parseOpts" and "writerOpts" objects as option', async t
197197
const changelog = await generateNotes(
198198
{
199199
preset: 'angular',
200-
parserOpts: {headerPattern: /^(\w*)(?:\((.*)\)): (.*)$/},
200+
parserOpts: {headerPattern: /^(?<type>\w*)(?:\((?<scope>.*)\)): (?<subject>.*)$/},
201201
writerOpts: {commitsSort: ['subject', 'scope']},
202202
},
203203
{cwd, options: {repositoryUrl}, lastRelease, nextRelease, commits}

test/load-changelog-config.test.js

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,10 @@ test('Load "conventional-changelog-angular" by default', async t => {
4949
});
5050

5151
test('Accept a "parserOpts" object as option', async t => {
52-
const customParserOpts = {headerPattern: /^##(.*?)## (.*)$/, headerCorrespondence: ['tag', 'shortDesc']};
52+
const customParserOpts = {
53+
headerPattern: /^##(?<tag>.*?)## (?<shortDesc>.*)$/,
54+
headerCorrespondence: ['tag', 'shortDesc'],
55+
};
5356
const changelogConfig = await loadChangelogConfig({parserOpts: customParserOpts}, {cwd});
5457
const angularChangelogConfig = await require('conventional-changelog-angular');
5558

@@ -71,7 +74,10 @@ test('Accept a "writerOpts" object as option', async t => {
7174
});
7275

7376
test('Accept a partial "parserOpts" object as option that overwrite a preset', async t => {
74-
const customParserOpts = {headerPattern: /^##(.*?)## (.*)$/, headerCorrespondence: ['tag', 'shortDesc']};
77+
const customParserOpts = {
78+
headerPattern: /^##(?<tag>.*?)## (?<shortDesc>.*)$/,
79+
headerCorrespondence: ['tag', 'shortDesc'],
80+
};
7581
const changelogConfig = await loadChangelogConfig({parserOpts: customParserOpts, preset: 'angular'}, {cwd});
7682
const angularChangelogConfig = await require('conventional-changelog-angular');
7783

@@ -93,7 +99,10 @@ test('Accept a "writerOpts" object as option that overwrite a preset', async t =
9399
});
94100

95101
test('Accept a partial "parserOpts" object as option that overwrite a config', async t => {
96-
const customParserOpts = {headerPattern: /^##(.*?)## (.*)$/, headerCorrespondence: ['tag', 'shortDesc']};
102+
const customParserOpts = {
103+
headerPattern: /^##(?<tag>.*?)## (?<shortDesc>.*)$/,
104+
headerCorrespondence: ['tag', 'shortDesc'],
105+
};
97106
const changelogConfig = await loadChangelogConfig(
98107
{
99108
parserOpts: customParserOpts,

0 commit comments

Comments
 (0)