aboutsummaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorVendicated <vendicated@riseup.net>2023-03-11 14:18:32 +0100
committerVendicated <vendicated@riseup.net>2023-03-11 14:18:32 +0100
commit5d1283bd85471f160d5220c67ad521379804f9d1 (patch)
tree6cf277cb33813587b04f9dfeca3d04e615b5977a /scripts
parent3b945b87b8dc0901dd3f93230afdbb70b5ccd8c8 (diff)
downloadVencord-5d1283bd85471f160d5220c67ad521379804f9d1.tar.gz
Vencord-5d1283bd85471f160d5220c67ad521379804f9d1.tar.bz2
Vencord-5d1283bd85471f160d5220c67ad521379804f9d1.zip
Add Web/Desktop specific plugin capabilities; misc fixes
Diffstat (limited to 'scripts')
-rw-r--r--scripts/build/common.mjs10
1 files changed, 9 insertions, 1 deletions
diff --git a/scripts/build/common.mjs b/scripts/build/common.mjs
index 1689470..80c9ae1 100644
--- a/scripts/build/common.mjs
+++ b/scripts/build/common.mjs
@@ -33,6 +33,8 @@ export const banner = {
`.trim()
};
+const isWeb = process.argv.slice(0, 2).some(f => f.endsWith("buildWeb.mjs"));
+
// https://github.com/evanw/esbuild/issues/619#issuecomment-751995294
/**
* @type {import("esbuild").Plugin}
@@ -70,7 +72,13 @@ export const globPlugins = {
for (const file of files) {
if (file.startsWith(".")) continue;
if (file === "index.ts") continue;
- if (!watch && (file.endsWith(".dev.ts") || file.endsWith(".dev.tsx"))) continue;
+ const fileBits = file.split(".");
+ if (fileBits.length > 2 && ["ts", "tsx"].includes(fileBits.at(-1))) {
+ const mod = fileBits.at(-2);
+ if (mod === "dev" && !watch) continue;
+ if (mod === "web" && !isWeb) continue;
+ if (mod === "desktop" && isWeb) continue;
+ }
const mod = `p${i}`;
code += `import ${mod} from "./${dir}/${file.replace(/\.tsx?$/, "")}";\n`;