forked from audioling/audioling
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdeploy.ts
More file actions
42 lines (31 loc) · 1.12 KB
/
deploy.ts
File metadata and controls
42 lines (31 loc) · 1.12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
import { $ } from 'bun';
import { execSync } from 'child_process';
import console from 'console';
import fs from 'fs';
async function main() {
await Promise.all([$`bun run build:packages`]);
await Promise.all([$`bun run build:server:desktop`]);
await renameSidecar();
await Promise.all([$`bun run build:web:desktop`]);
}
async function renameSidecar() {
return new Promise((resolve, reject) => {
try {
const extension = process.platform === 'win32' ? '.exe' : '';
const rustInfo = execSync('rustc -vV');
const targetTriple = /host: (\S+)/g.exec(rustInfo as any)?.[1];
console.log('targetTriple', targetTriple, extension);
if (!targetTriple) {
console.error('Failed to determine platform target triple');
}
fs.renameSync(
`./apps/server/dist/audioling-server${extension}`,
`./apps/web/src-tauri/target/external/audioling-server-${targetTriple}${extension}`,
);
} catch (error) {
reject(error);
}
resolve(null);
});
}
main();