deployment-talks/chat-app/build.ts

42 lines
680 B
TypeScript
Raw Normal View History

import { unlink } from 'node:fs/promises';
const config = {
entrypoints: [ "./frontend/index.js" ],
outdir: "./static/js/",
};
async function fileExists(path: string): Promise<bool> {
const file = Bun.file(path);
return file.exists();
}
async function main() {
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}"`,
}
});
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);
});