Skip to content

Commit

Permalink
fix(MainSource): Fix invalid tag parsing (#150)
Browse files Browse the repository at this point in the history
  • Loading branch information
Jiralite committed May 8, 2023
1 parent a20e892 commit 27171a1
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion src/data/MainSource.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,17 @@ export default new DocsSource({
docsRepo: 'discordjs/docs',
repo: 'discordjs/discord.js',
branchFilter: (branch) => branch === 'main' || /^v1[3-9]$/.test(branch),
tagFilter: (tag: string) => semver.gte(tag.replace(/(^@.*\/.*@v?)?(?<semver>\d+.\d+.\d+)-?.*/, '$<semver>'), '9.0.0'),
tagFilter: (tag: string) => {
const parsed = /(?:^@.*\/(?<package>.*)@v?)?(?<version>\d+.\d+.\d+)-?.*/.exec(tag);
const parsedPackage = /(?<package>.*)@v?-?.*/.exec(tag);

if (parsed?.groups) {
const isSubpackage = typeof parsed.groups.package === 'string';
const pkg = isSubpackage ? parsed.groups.package : parsedPackage?.groups?.package ?? 'discord.js';
const { version } = parsed.groups;
if (pkg === 'discord.js') return semver.gte(version, '12.0.0');
}

return false;
},
});

0 comments on commit 27171a1

Please sign in to comment.