mirror of
https://github.com/ragestudio/relic.git
synced 2025-06-09 10:34:18 +00:00
fix git clone for windows
This commit is contained in:
parent
63d3889bee
commit
a0ed97d999
@ -10,13 +10,8 @@ import Vars from "../../vars"
|
|||||||
const gitCMD = fs.existsSync(Vars.git_path) ? `${Vars.git_path}` : "git"
|
const gitCMD = fs.existsSync(Vars.git_path) ? `${Vars.git_path}` : "git"
|
||||||
|
|
||||||
export default async (manifest, step) => {
|
export default async (manifest, step) => {
|
||||||
const tmp_path = path.resolve(os.tmpdir(), `rsb_${manifest.id}_clone_${new Date().getTime()}`)
|
|
||||||
const final_path = path.resolve(manifest.install_path, step.path)
|
const final_path = path.resolve(manifest.install_path, step.path)
|
||||||
|
|
||||||
if (fs.existsSync(tmp_path)) {
|
|
||||||
fs.rmdirSync(tmp_path, { recursive: true })
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!fs.existsSync(final_path)) {
|
if (!fs.existsSync(final_path)) {
|
||||||
fs.mkdirSync(final_path, { recursive: true })
|
fs.mkdirSync(final_path, { recursive: true })
|
||||||
}
|
}
|
||||||
@ -28,9 +23,9 @@ export default async (manifest, step) => {
|
|||||||
|
|
||||||
console.log(`[${manifest.id}] steps.git_clone() | Cloning ${step.url}...`)
|
console.log(`[${manifest.id}] steps.git_clone() | Cloning ${step.url}...`)
|
||||||
|
|
||||||
const command = `${gitCMD} clone --recurse-submodules --remote-submodules ${step.url} ${tmp_path}`
|
const command = `${gitCMD} clone --recurse-submodules --remote-submodules ${step.url} ${final_path}`
|
||||||
|
|
||||||
fs.mkdirSync(final_path, { recursive: true })
|
//fs.mkdirSync(final_path, { recursive: true })
|
||||||
|
|
||||||
await new Promise((resolve, reject) => {
|
await new Promise((resolve, reject) => {
|
||||||
ChildProcess.exec(
|
ChildProcess.exec(
|
||||||
@ -50,12 +45,5 @@ export default async (manifest, step) => {
|
|||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
||||||
// move tmp_path to final_path
|
|
||||||
await fs.promises.rename(tmp_path, final_path)
|
|
||||||
|
|
||||||
if (fs.existsSync(tmp_path)) {
|
|
||||||
fs.rmdirSync(tmp_path, { recursive: true })
|
|
||||||
}
|
|
||||||
|
|
||||||
return manifest
|
return manifest
|
||||||
}
|
}
|
@ -28,6 +28,12 @@ export default async function processGenericSteps(pkg, steps) {
|
|||||||
|
|
||||||
const stepsEntries = Object.entries(steps)
|
const stepsEntries = Object.entries(steps)
|
||||||
|
|
||||||
|
stepsEntries = stepsEntries.sort((a, b) => StepsOrders.indexOf(a[0]) - StepsOrders.indexOf(b[0]))
|
||||||
|
|
||||||
|
if (stepsEntries.length === 0) {
|
||||||
|
return pkg
|
||||||
|
}
|
||||||
|
|
||||||
for await (const [stepKey, stepValue] of stepsEntries) {
|
for await (const [stepKey, stepValue] of stepsEntries) {
|
||||||
switch (stepKey) {
|
switch (stepKey) {
|
||||||
case "drive_downloads": {
|
case "drive_downloads": {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user