2022-11-09 08:08:38 +08:00
|
|
|
/* eslint-disable import/no-extraneous-dependencies */
|
2023-04-22 17:19:33 +08:00
|
|
|
import { execaNode } from "execa"
|
2021-09-15 14:29:57 +08:00
|
|
|
|
|
|
|
|
function getPlatformName() {
|
|
|
|
|
switch (process.platform) {
|
|
|
|
|
case "win32": {
|
|
|
|
|
return "windows"
|
|
|
|
|
}
|
|
|
|
|
case "darwin": {
|
2023-01-18 13:50:44 +08:00
|
|
|
return "macos"
|
2021-09-15 14:29:57 +08:00
|
|
|
}
|
|
|
|
|
default: {
|
|
|
|
|
return process.platform
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2025-01-12 16:06:10 +08:00
|
|
|
async function main() {
|
|
|
|
|
const exe = process.platform === "win32" ? ".exe" : ""
|
2021-09-15 14:29:57 +08:00
|
|
|
|
2025-01-12 16:06:10 +08:00
|
|
|
await execaNode("./node_modules/caxa/build/index.mjs", [
|
|
|
|
|
"--input",
|
|
|
|
|
"./dist/modern",
|
|
|
|
|
"--output",
|
|
|
|
|
`./exe/setup-cpp-${process.arch}-${getPlatformName()}${exe}`,
|
|
|
|
|
"--",
|
|
|
|
|
`{{caxa}}/node_modules/.bin/node${exe}`,
|
|
|
|
|
"{{caxa}}/setup-cpp.mjs",
|
|
|
|
|
])
|
2021-09-15 14:29:57 +08:00
|
|
|
}
|
|
|
|
|
|
2022-10-20 11:12:32 +08:00
|
|
|
main().catch((err) => {
|
|
|
|
|
throw err
|
2021-09-15 14:29:57 +08:00
|
|
|
})
|