2023-07-16 09:06:32 +08:00
|
|
|
import { readFile, writeFile } from "fs/promises"
|
|
|
|
|
|
|
|
async function main() {
|
2024-03-24 15:20:20 +08:00
|
|
|
const names = ["ubuntu-llvm", "arch-llvm", "fedora-llvm", "ubuntu-mingw", "arch-mingw", "fedora-mingw"]
|
2023-07-16 09:06:32 +08:00
|
|
|
await Promise.all(
|
2024-03-24 15:20:20 +08:00
|
|
|
names.map(async (name) => {
|
|
|
|
const dockerFileContent = await readFile(`./dev/docker/setup-cpp/setup-cpp-${name}.dockerfile`, "utf-8")
|
2023-07-16 09:06:32 +08:00
|
|
|
const modifiedDockerFile = dockerFileContent
|
2023-07-18 01:27:35 +08:00
|
|
|
// load the externally built setup-cpp
|
2023-07-16 09:06:32 +08:00
|
|
|
.replace(/FROM (.*)/g, `FROM $1\n\nCOPY "./dist/legacy" "/usr/lib/setup-cpp/"`)
|
|
|
|
.replace("setup-cpp ", "node /usr/lib/setup-cpp/setup-cpp.js ")
|
2023-07-18 01:27:35 +08:00
|
|
|
// remove the npm install line
|
2024-04-03 15:15:43 +08:00
|
|
|
.replace(/# install setup-cpp\n\s*npm install -g setup-cpp.*\n/, "")
|
2023-07-16 09:06:32 +08:00
|
|
|
|
2024-03-24 15:20:20 +08:00
|
|
|
// write the new file in dev/docker/ci
|
|
|
|
await writeFile(`./dev/docker/ci/${name}.dockerfile`, modifiedDockerFile)
|
2023-07-25 04:20:04 +08:00
|
|
|
}),
|
2023-07-16 09:06:32 +08:00
|
|
|
)
|
|
|
|
}
|
|
|
|
|
|
|
|
await main()
|