mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-21 18:57:03 +02:00
fix: bot imports
This commit is contained in:
1 parent
03a51c47bb
commit
ab430dc0ca
4 files changed
+44
-28
No files matched your search
@@ -1,13 +1,13 @@
|
||||
import { build } from 'esbuild';
|
||||
import { cp, readdir, rm } from 'fs/promises';
|
||||
import { argv } from 'process';
|
||||
import { build } from "esbuild";
|
||||
import { cp, readdir, rm } from "fs/promises";
|
||||
import { argv } from "process";
|
||||
|
||||
const projectDir = '../..';
|
||||
const projectDir = "../..";
|
||||
const srcRoot = `${projectDir}/packages/bot`;
|
||||
const distRoot = `${projectDir}/dist/bot`;
|
||||
const modulesRoot = `${projectDir}/node_modules`;
|
||||
const modulesRoot = `${projectDir}/packages/bot/node_modules`;
|
||||
const workers = await readdir(`${srcRoot}/src/workers`);
|
||||
const dev = argv.includes('--dev');
|
||||
const dev = argv.includes("--dev");
|
||||
|
||||
await rm(distRoot, { recursive: true, force: true });
|
||||
|
||||
@@ -17,33 +17,33 @@ build({
|
||||
...workers.map((worker) => `${srcRoot}/src/workers/${worker}`),
|
||||
],
|
||||
bundle: true,
|
||||
outdir: '../../dist/bot',
|
||||
platform: 'node',
|
||||
format: 'esm',
|
||||
outdir: "../../dist/bot",
|
||||
platform: "node",
|
||||
format: "esm",
|
||||
loader: {
|
||||
'.ttf': 'file',
|
||||
'.node': 'empty',
|
||||
'.json': 'json',
|
||||
".ttf": "file",
|
||||
".node": "empty",
|
||||
".json": "json",
|
||||
},
|
||||
external: ['sharp'],
|
||||
external: ["sharp"],
|
||||
minifyIdentifiers: false, // causes goofy ahh issues
|
||||
minifySyntax: !dev,
|
||||
minifyWhitespace: !dev,
|
||||
sourcemap: !dev,
|
||||
jsxImportSource: 'react',
|
||||
jsx: 'automatic',
|
||||
jsxImportSource: "react",
|
||||
jsx: "automatic",
|
||||
});
|
||||
|
||||
for (const module of await readdir(`${modulesRoot}/@resvg`)) {
|
||||
readdir(`${modulesRoot}/@resvg/${module}`).then((files) =>
|
||||
files
|
||||
.filter((file) => file.endsWith('.node'))
|
||||
.filter((file) => file.endsWith(".node"))
|
||||
.map((file) =>
|
||||
cp(
|
||||
`${modulesRoot}/@resvg/${module}/${file}`,
|
||||
`${distRoot}/workers/${file}`,
|
||||
),
|
||||
),
|
||||
`${distRoot}/workers/${file}`
|
||||
)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
@@ -51,7 +51,7 @@ if (!dev) {
|
||||
await cp(`${projectDir}/prisma`, `${distRoot}/prisma`, { recursive: true });
|
||||
|
||||
for (const file of await readdir(`${modulesRoot}/prisma`).then((files) =>
|
||||
files.filter((file) => file.endsWith('.node')),
|
||||
files.filter((file) => file.endsWith(".node"))
|
||||
)) {
|
||||
cp(`${modulesRoot}/prisma/${file}`, `${distRoot}/prisma/${file}`);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user