36 lines
1.0 KiB
TypeScript
36 lines
1.0 KiB
TypeScript
|
|
const targets = [
|
||
|
|
{ target: 'x86_64-unknown-linux-gnu', name: 'uptimerunner-linux-x64' },
|
||
|
|
{ target: 'aarch64-unknown-linux-gnu', name: 'uptimerunner-linux-arm64' },
|
||
|
|
{ target: 'x86_64-apple-darwin', name: 'uptimerunner-macos-x64' },
|
||
|
|
{ target: 'aarch64-apple-darwin', name: 'uptimerunner-macos-arm64' },
|
||
|
|
{ target: 'x86_64-pc-windows-msvc', name: 'uptimerunner-windows-x64.exe' },
|
||
|
|
];
|
||
|
|
|
||
|
|
await Deno.mkdir('dist/binaries', { recursive: true });
|
||
|
|
|
||
|
|
for (const target of targets) {
|
||
|
|
console.log(`Compiling ${target.name}...`);
|
||
|
|
const command = new Deno.Command('deno', {
|
||
|
|
args: [
|
||
|
|
'compile',
|
||
|
|
'--allow-net',
|
||
|
|
'--allow-read',
|
||
|
|
'--allow-write',
|
||
|
|
'--allow-run',
|
||
|
|
'--allow-env',
|
||
|
|
'--allow-sys',
|
||
|
|
'--target',
|
||
|
|
target.target,
|
||
|
|
'--output',
|
||
|
|
`dist/binaries/${target.name}`,
|
||
|
|
'mod.ts',
|
||
|
|
],
|
||
|
|
stdout: 'inherit',
|
||
|
|
stderr: 'inherit',
|
||
|
|
});
|
||
|
|
const output = await command.output();
|
||
|
|
if (!output.success) {
|
||
|
|
throw new Error(`Failed to compile ${target.name}`);
|
||
|
|
}
|
||
|
|
}
|