Skip to content

Commit 656e955

Browse files
committed
fix: default package to discord.js
1 parent 3a7e93d commit 656e955

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

packages/actions/__tests__/formatTag.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ describe('Format Tag', () => {
1111
});
1212

1313
test('GIVEN tag with no prefix THEN return tag', () => {
14-
expect(formatTag('13.5.1')).toEqual({ semver: '13.5.1' });
15-
expect(formatTag('13.7.0')).toEqual({ package: undefined, semver: '13.7.0' });
14+
expect(formatTag('13.5.1')).toEqual({ package: 'discord.js', semver: '13.5.1' });
15+
expect(formatTag('13.7.0')).toEqual({ package: 'discord.js', semver: '13.7.0' });
1616
});
1717

1818
test('GIVEN no or invalid tag THEN return null', () => {

packages/actions/src/formatTag/formatTag.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,10 @@ export function formatTag(tag: string) {
22
const parsed = /(^@.*\/(?<package>.*)@v?)?(?<semver>\d+.\d+.\d+)-?.*/.exec(tag);
33

44
if (parsed?.groups) {
5-
return parsed.groups;
5+
return {
6+
package: parsed.groups.package ?? 'discord.js',
7+
semver: parsed.groups.semver,
8+
};
69
}
710

811
return null;

0 commit comments

Comments
 (0)