deployment-talks/chat-app/build.ts

36 lines
600 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 });
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);
});