Skip to content
This repository was archived by the owner on May 5, 2024. It is now read-only.

Commit e8914d0

Browse files
committed
fix: import the semver functions directly
This was likely the cause of the bundling issue in #13. Ref: npm/node-semver#299
1 parent c029baf commit e8914d0

File tree

1 file changed

+7
-5
lines changed
  • packages/automatic-releases/src

1 file changed

+7
-5
lines changed

packages/automatic-releases/src/main.ts

+7-5
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,9 @@ import md5File from 'md5-file/promise';
99
import {sync as commitParser} from 'conventional-commits-parser';
1010
import {getChangelogOptions} from './utils';
1111
import {isBreakingChange, generateChangelogFromParsedCommits, parseGitTag, ParsedCommits, octokitLogger} from './utils';
12-
import semver from 'semver';
12+
import semverValid from 'semver/functions/valid';
13+
import semverRcompare from 'semver/functions/rcompare';
14+
import semverLt from 'semver/functions/lt';
1315

1416
type Args = {
1517
repoToken: string;
@@ -133,7 +135,7 @@ const searchForPreviousReleaseTag = async (
133135
currentReleaseTag: string,
134136
tagInfo: Octokit.ReposListTagsParams,
135137
): Promise<string> => {
136-
const validSemver = semver.valid(currentReleaseTag);
138+
const validSemver = semverValid(currentReleaseTag);
137139
if (!validSemver) {
138140
throw new Error(
139141
`The parameter "automatic_release_tag" was not set and the current tag "${currentReleaseTag}" does not appear to conform to semantic versioning.`,
@@ -146,18 +148,18 @@ const searchForPreviousReleaseTag = async (
146148
const tagList = tl
147149
.map(tag => {
148150
core.debug(`Currently processing tag ${tag.name}`);
149-
const t = semver.valid(tag.name);
151+
const t = semverValid(tag.name);
150152
return {
151153
...tag,
152154
semverTag: t,
153155
};
154156
})
155157
.filter(tag => tag.semverTag !== null)
156-
.sort((a, b) => semver.rcompare(a.semverTag, b.semverTag));
158+
.sort((a, b) => semverRcompare(a.semverTag, b.semverTag));
157159

158160
let previousReleaseTag = '';
159161
for (const tag of tagList) {
160-
if (semver.lt(tag.semverTag, currentReleaseTag)) {
162+
if (semverLt(tag.semverTag, currentReleaseTag)) {
161163
previousReleaseTag = tag.name;
162164
break;
163165
}

0 commit comments

Comments
 (0)