Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions resources/build-npm.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,12 @@ function buildPackageJSON() {
delete packageJSON.engines_on_npm;

const { version } = packageJSON;
const versionMatch = /^\d+\.\d+\.\d+-?(.*)?$/.exec(version);
const versionMatch = /^\d+\.\d+\.\d+-?(?<preReleaseTag>.*)?$/.exec(version);
if (!versionMatch) {
throw new Error('Version does not match semver spec: ' + version);
}

const [, preReleaseTag] = versionMatch;
const { preReleaseTag } = versionMatch.groups;

if (preReleaseTag != null) {
const [tag] = preReleaseTag.split('.');
Expand Down
8 changes: 4 additions & 4 deletions resources/gen-changelog.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,14 +47,14 @@ if (!packageJSON.repository || typeof packageJSON.repository.url !== 'string') {
process.exit(1);
}

const repoURLMatch = /https:\/\/github.com\/([^/]+)\/([^/]+).git/.exec(
const repoURLMatch = /https:\/\/github.com\/(?<githubOrg>[^/]+)\/(?<githubRepo>[^/]+).git/.exec(
packageJSON.repository.url,
);
if (repoURLMatch == null) {
console.error('Cannot extract organization and repo name from repo URL!');
process.exit(1);
}
const [, githubOrg, githubRepo] = repoURLMatch;
const { githubOrg, githubRepo } = repoURLMatch.groups;

getChangeLog()
.then((changelog) => process.stdout.write(changelog))
Expand Down Expand Up @@ -275,9 +275,9 @@ function commitsInfoToPRs(commits) {
(pr) => pr.repository.nameWithOwner === `${githubOrg}/${githubRepo}`,
);
if (associatedPRs.length === 0) {
const match = / \(#([0-9]+)\)$/m.exec(commit.message);
const match = / \(#(?<prNumber>[0-9]+)\)$/m.exec(commit.message);
if (match) {
prs[parseInt(match[1], 10)] = true;
prs[parseInt(match.groups.prNumber, 10)] = true;
continue;
}
throw new Error(
Expand Down