aboutsummaryrefslogtreecommitdiff
path: root/scripts/generatePluginList.ts
diff options
context:
space:
mode:
authorJustice Almanzar <superdash993@gmail.com>2023-08-15 23:32:11 +0000
committerGitHub <noreply@github.com>2023-08-16 01:32:11 +0200
commitffdf63563bab53a65b2a1a318f0f05e7917de002 (patch)
tree4b48475a76471434f5dad7fcd987aae8373b39b8 /scripts/generatePluginList.ts
parent55b755b2df7e186df8fb253742478bca146fbf46 (diff)
downloadVencord-ffdf63563bab53a65b2a1a318f0f05e7917de002.tar.gz
Vencord-ffdf63563bab53a65b2a1a318f0f05e7917de002.tar.bz2
Vencord-ffdf63563bab53a65b2a1a318f0f05e7917de002.zip
feat(plugins): Web/Vesktop AI Noise Suppression powered by RNNoise (#1477)
Co-authored-by: V <vendicated@riseup.net>
Diffstat (limited to 'scripts/generatePluginList.ts')
-rw-r--r--scripts/generatePluginList.ts11
1 files changed, 6 insertions, 5 deletions
diff --git a/scripts/generatePluginList.ts b/scripts/generatePluginList.ts
index c78c340..ea08d30 100644
--- a/scripts/generatePluginList.ts
+++ b/scripts/generatePluginList.ts
@@ -21,6 +21,8 @@ import { access, readFile } from "fs/promises";
import { join } from "path";
import { BigIntLiteral, createSourceFile, Identifier, isArrayLiteralExpression, isCallExpression, isExportAssignment, isIdentifier, isObjectLiteralExpression, isPropertyAccessExpression, isPropertyAssignment, isSatisfiesExpression, isStringLiteral, isVariableStatement, NamedDeclaration, NodeArray, ObjectLiteralExpression, ScriptTarget, StringLiteral, SyntaxKind } from "typescript";
+import { getPluginTarget } from "./utils.mjs";
+
interface Dev {
name: string;
id: string;
@@ -157,11 +159,10 @@ async function parseFile(fileName: string) {
if (!data.name || !data.description || !data.authors) throw fail("name, description or authors are missing");
- const fileBits = fileName.split(".");
- if (fileBits.length > 2 && ["ts", "tsx"].includes(fileBits.at(-1)!)) {
- const mod = fileBits.at(-2)!;
- if (!["web", "discordDesktop", "vencordDesktop", "dev"].includes(mod)) throw fail(`invalid target ${fileBits.at(-2)}`);
- data.target = mod as any;
+ const target = getPluginTarget(fileName);
+ if (target) {
+ if (!["web", "discordDesktop", "vencordDesktop", "dev"].includes(target)) throw fail(`invalid target ${target}`);
+ data.target = target as any;
}
return data;