Template
1
0
mirror of https://github.com/aminya/setup-cpp synced 2024-11-30 21:22:30 +08:00
setup-cpp/dev/scripts/pack-exe.mjs

46 lines
878 B
JavaScript
Raw Normal View History

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": {
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") {
exes = [""]
2021-09-15 14:29:57 +08:00
} else {
exes = [""]
2021-09-15 14:29:57 +08:00
}
return Promise.all(
exes.map((exe) =>
2023-04-22 17:19:33 +08:00
execaNode("./node_modules/caxa/build/index.mjs", [
"--input",
2023-07-16 08:15:31 +08:00
"./dist/modern",
"--output",
`./exe/setup-cpp-${process.arch}-${getPlatformName()}${exe}`,
"--",
`{{caxa}}/node_modules/.bin/node${exe}`,
`{{caxa}}/setup-cpp.js`,
2024-04-03 15:15:43 +08:00
])
2023-07-25 04:20:04 +08:00
),
2021-09-15 14:29:57 +08:00
)
}
main().catch((err) => {
throw err
2021-09-15 14:29:57 +08:00
})