mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-14 10:33:30 +01:00
fix: default package to discord.js
This commit is contained in:
@@ -11,8 +11,8 @@ describe('Format Tag', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
test('GIVEN tag with no prefix THEN return tag', () => {
|
test('GIVEN tag with no prefix THEN return tag', () => {
|
||||||
expect(formatTag('13.5.1')).toEqual({ semver: '13.5.1' });
|
expect(formatTag('13.5.1')).toEqual({ package: 'discord.js', semver: '13.5.1' });
|
||||||
expect(formatTag('13.7.0')).toEqual({ package: undefined, semver: '13.7.0' });
|
expect(formatTag('13.7.0')).toEqual({ package: 'discord.js', semver: '13.7.0' });
|
||||||
});
|
});
|
||||||
|
|
||||||
test('GIVEN no or invalid tag THEN return null', () => {
|
test('GIVEN no or invalid tag THEN return null', () => {
|
||||||
|
|||||||
@@ -2,7 +2,10 @@ export function formatTag(tag: string) {
|
|||||||
const parsed = /(^@.*\/(?<package>.*)@v?)?(?<semver>\d+.\d+.\d+)-?.*/.exec(tag);
|
const parsed = /(^@.*\/(?<package>.*)@v?)?(?<semver>\d+.\d+.\d+)-?.*/.exec(tag);
|
||||||
|
|
||||||
if (parsed?.groups) {
|
if (parsed?.groups) {
|
||||||
return parsed.groups;
|
return {
|
||||||
|
package: parsed.groups.package ?? 'discord.js',
|
||||||
|
semver: parsed.groups.semver,
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
|
|||||||
Reference in New Issue
Block a user