2024-10-24 01:57:58 +00:00
|
|
|
import { unlink } from 'node:fs/promises';
|
|
|
|
|
|
|
|
const config = {
|
|
|
|
entrypoints: [ "./frontend/index.js" ],
|
|
|
|
outdir: "./static/js/",
|
|
|
|
};
|
2024-10-05 02:57:21 +00:00
|
|
|
|
2024-10-24 01:57:58 +00:00
|
|
|
async function fileExists(path: string): Promise<bool> {
|
|
|
|
const file = Bun.file(path);
|
|
|
|
return file.exists();
|
|
|
|
}
|
|
|
|
|
|
|
|
async function main() {
|
2024-10-24 02:18:29 +00:00
|
|
|
const results = await Bun.build({
|
|
|
|
...config,
|
|
|
|
verbose: true,
|
|
|
|
define: {
|
2024-10-27 02:36:15 +00:00
|
|
|
'Bun.env.APP_URL': `"${Bun.env.APP_URL}"`,
|
2024-10-24 02:18:29 +00:00
|
|
|
}
|
|
|
|
});
|
2024-10-05 02:57:21 +00:00
|
|
|
|
|
|
|
if (!results.success) {
|
|
|
|
for (const message of results.logs) {
|
|
|
|
console.error(message);
|
|
|
|
}
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
main()
|
|
|
|
.then(() => {
|
|
|
|
process.exit(0)
|
|
|
|
})
|
|
|
|
.catch((e) => {
|
|
|
|
console.error(e);
|
|
|
|
process.exit(1);
|
|
|
|
});
|