mirror of
https://github.com/aminya/setup-cpp
synced 2024-11-30 21:22:30 +08:00
c41d430d6b
BREAKING CHANGE the built executables are now renamed to include the architecture. See the readme for more information
46 lines
867 B
TypeScript
46 lines
867 B
TypeScript
/* eslint-disable import/no-extraneous-dependencies */
|
|
import { node } from "execa"
|
|
|
|
function getPlatformName() {
|
|
switch (process.platform) {
|
|
case "win32": {
|
|
return "windows"
|
|
}
|
|
case "darwin": {
|
|
return "macos"
|
|
}
|
|
default: {
|
|
return process.platform
|
|
}
|
|
}
|
|
}
|
|
|
|
function main() {
|
|
let exes
|
|
if (process.platform === "win32") {
|
|
exes = [".exe"]
|
|
} else if (process.platform === "darwin") {
|
|
exes = [""]
|
|
} else {
|
|
exes = [""]
|
|
}
|
|
|
|
return Promise.all(
|
|
exes.map((exe) =>
|
|
node("./node_modules/caxa/build/index.mjs", [
|
|
"--input",
|
|
"./dist/node16",
|
|
"--output",
|
|
`./exe/setup-cpp-${process.arch}-${getPlatformName()}${exe}`,
|
|
"--",
|
|
`{{caxa}}/node_modules/.bin/node${exe}`,
|
|
`{{caxa}}/setup-cpp.js`,
|
|
])
|
|
)
|
|
)
|
|
}
|
|
|
|
main().catch((err) => {
|
|
throw err
|
|
})
|