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.js

39 lines
730 B
JavaScript
Raw Normal View History

2021-09-15 14:29:57 +08:00
const { exec } = require("@actions/exec")
function getPlatformName() {
switch (process.platform) {
case "win32": {
return "windows"
}
case "darwin": {
return "mac"
}
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) =>
exec(
2021-09-18 02:19:10 +08:00
`./node_modules/.bin/caxa --input ./dist --output ./exe/setup_cpp_${getPlatformName()}${exe} -- "{{caxa}}/node_modules/.bin/node${exe}" "{{caxa}}/setup_cpp.js"`
2021-09-15 14:29:57 +08:00
)
)
)
}
main().then((exit) => {
process.exit(exit)
})