2024-01-25 00:37:57 +01:00

27 lines
767 B
JavaScript

import path from "node:path"
import fs from "node:fs"
import ChildProcess from "node:child_process"
import sendToRender from "../../utils/sendToRender"
export default async (manifest, step) => {
const _path = path.resolve(manifest.packPath, step.path)
console.log(`Cloning ${step.url}...`)
sendToRender(`installation:status`, {
...manifest,
statusText: `Cloning ${step.url}`,
})
fs.mkdirSync(_path, { recursive: true })
await new Promise((resolve, reject) => {
const process = ChildProcess.exec(`${global.GIT_PATH ?? "git"} clone --recurse-submodules --remote-submodules ${step.url} ${_path}`, {
shell: true,
})
process.on("exit", resolve)
process.on("error", reject)
})
}