2022-11-09 08:08:38 +08:00
|
|
|
/* eslint-disable import/no-extraneous-dependencies */
|
2022-10-20 11:12:32 +08:00
|
|
|
import { node } from "execa"
|
2021-09-15 14:29:57 +08:00
|
|
|
|
|
|
|
function getPlatformName() {
|
|
|
|
switch (process.platform) {
|
|
|
|
case "win32": {
|
|
|
|
return "windows"
|
|
|
|
}
|
|
|
|
case "darwin": {
|
2023-04-02 07:32:43 +08:00
|
|
|
return "macos"
|
2021-09-15 14:29:57 +08:00
|
|
|
}
|
|
|
|
default: {
|
|
|
|
return process.platform
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function main() {
|
|
|
|
let exes
|
|
|
|
if (process.platform === "win32") {
|
|
|
|
exes = [".exe"]
|
|
|
|
} else if (process.platform === "darwin") {
|
2021-09-15 14:42:02 +08:00
|
|
|
exes = [""]
|
2021-09-15 14:29:57 +08:00
|
|
|
} else {
|
2021-09-15 14:42:02 +08:00
|
|
|
exes = [""]
|
2021-09-15 14:29:57 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
return Promise.all(
|
|
|
|
exes.map((exe) =>
|
2022-10-20 11:12:32 +08:00
|
|
|
node("./node_modules/caxa/build/index.mjs", [
|
|
|
|
"--input",
|
|
|
|
"./dist/node16",
|
|
|
|
"--output",
|
2023-04-02 07:32:43 +08:00
|
|
|
`./exe/setup-cpp-${process.arch}-${getPlatformName()}${exe}`,
|
2022-10-20 11:12:32 +08:00
|
|
|
"--",
|
|
|
|
`{{caxa}}/node_modules/.bin/node${exe}`,
|
2023-04-02 07:32:43 +08:00
|
|
|
`{{caxa}}/setup-cpp.js`,
|
2022-10-20 11:12:32 +08:00
|
|
|
])
|
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
|
|
|
})
|