altv-pkg
Advanced tools
Comparing version 2.0.1 to 2.0.2
@@ -43,15 +43,23 @@ #!/usr/bin/env node | ||
const binaryDownload = platform === 'x64_linux' ? `https://cdn.altv.mp/server/${branch}/x64_linux/altv-server` : `https://cdn.altv.mp/server/${branch}/x64_win32/altv-server.exe`; | ||
const linuxFiles = { | ||
'data/vehmodels.bin': `https://cdn.altv.mp/data/${branch}/data/vehmodels.bin`, | ||
'data/vehmods.bin': `https://cdn.altv.mp/data/${branch}/data/vehmods.bin`, | ||
'data/clothes.bin': `https://cdn.altv.mp/data/${branch}/data/clothes.bin`, | ||
'modules/libjs-module.so': `https://cdn.altv.mp/js-module/${branch}/${platform}/modules/js-module/libjs-module.so`, | ||
'libnode.so.83': `https://cdn.altv.mp/js-module/${branch}/${platform}/modules/js-module/libnode.so.83`, | ||
'start.sh': `https://cdn.altv.mp/others/start.sh`, | ||
'altv-server': `https://cdn.altv.mp/server/${branch}/x64_linux/altv-server`, | ||
} | ||
const altvFiles = { | ||
// alt:V data files | ||
const windowsFiles = { | ||
'data/vehmodels.bin': `https://cdn.altv.mp/data/${branch}/data/vehmodels.bin`, | ||
'data/vehmods.bin': `https://cdn.altv.mp/data/${branch}/data/vehmods.bin`, | ||
'data/clothes.bin': `https://cdn.altv.mp/data/${branch}/data/clothes.bin`, | ||
// alt:V modules | ||
'modules/js-module.dll': `https://cdn.altv.mp/js-module/${branch}/${platform}/modules/js-module/js-module.dll`, | ||
'libnode.dll': `https://cdn.altv.mp/js-module/${branch}/${platform}/modules/js-module/libnode.dll`, | ||
'altv-server.exe': `https://cdn.altv.mp/server/${branch}/${platform}/altv-server.exe`, | ||
}; | ||
const filesToUse = platform == 'x64_win32' ? windowsFiles : linuxFiles; | ||
if (!fs.existsSync(path.join(rootPath, 'data'))) { | ||
@@ -67,3 +75,3 @@ fs.mkdirSync(path.join(rootPath, 'data')); | ||
console.log(chalk.greenBright('===== Download =====')); | ||
for (const [file, url] of Object.entries(altvFiles)) { | ||
for (const [file, url] of Object.entries(filesToUse)) { | ||
console.log(chalk.whiteBright(`${file}`)) | ||
@@ -83,17 +91,2 @@ const promise = new Promise((resolve) => { | ||
const binaryPathing = binaryDownload.split('/'); | ||
const binaryFileName = binaryPathing[binaryPathing.length - 1]; | ||
const promise = new Promise((resolve) => { | ||
axios.get(binaryDownload, { responseType: 'arraybuffer' }).then(response => { | ||
console.log(chalk.whiteBright(`${binaryFileName}`)) | ||
fs.writeFileSync(path.join(rootPath, binaryFileName), response.data); | ||
resolve(); | ||
}).catch(error => { | ||
console.error(`Failed to download ${binaryFileName}: ${error}`); | ||
resolve(); | ||
}) | ||
}); | ||
promises.push(promise); | ||
await Promise.all(promises); | ||
@@ -100,0 +93,0 @@ console.log(chalk.greenBright('===== Complete =====')); |
{ | ||
"name": "altv-pkg", | ||
"version": "2.0.1", | ||
"version": "2.0.2", | ||
"description": "Install alt:V Binaries Quickly", | ||
@@ -5,0 +5,0 @@ "main": "bin/index.js", |
40415
74