fix:unzip error
This commit is contained in:
50
package-lock.json
generated
50
package-lock.json
generated
@@ -25,9 +25,11 @@
|
||||
"@rollup/plugin-commonjs": "^28.0.6",
|
||||
"@rollup/plugin-json": "^6.1.0",
|
||||
"@rollup/plugin-node-resolve": "^16.0.1",
|
||||
"@rollup/plugin-typescript": "^12.1.4",
|
||||
"@types/adm-zip": "^0.5.7",
|
||||
"@types/cli-progress": "^3.11.6",
|
||||
"@types/fs-extra": "^11.0.4",
|
||||
"@types/inquirer": "^9.0.8",
|
||||
"@types/yauzl": "^2.10.3",
|
||||
"nexe": "^5.0.0-beta.4",
|
||||
"rollup": "^4.44.1",
|
||||
@@ -556,6 +558,33 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"node_modules/@rollup/plugin-typescript": {
|
||||
"version": "12.1.4",
|
||||
"resolved": "https://registry.npmmirror.com/@rollup/plugin-typescript/-/plugin-typescript-12.1.4.tgz",
|
||||
"integrity": "sha512-s5Hx+EtN60LMlDBvl5f04bEiFZmAepk27Q+mr85L/00zPDn1jtzlTV6FWn81MaIwqfWzKxmOJrBWHU6vtQyedQ==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@rollup/pluginutils": "^5.1.0",
|
||||
"resolve": "^1.22.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=14.0.0"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"rollup": "^2.14.0||^3.0.0||^4.0.0",
|
||||
"tslib": "*",
|
||||
"typescript": ">=3.7.0"
|
||||
},
|
||||
"peerDependenciesMeta": {
|
||||
"rollup": {
|
||||
"optional": true
|
||||
},
|
||||
"tslib": {
|
||||
"optional": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"node_modules/@rollup/pluginutils": {
|
||||
"version": "5.2.0",
|
||||
"resolved": "https://registry.npmmirror.com/@rollup/pluginutils/-/pluginutils-5.2.0.tgz",
|
||||
@@ -975,6 +1004,17 @@
|
||||
"integrity": "sha512-1m0bIFVc7eJWyve9S0RnuRgcQqF/Xd5QsUZAZeQFr1Q3/p9JWoQQEqmVy+DPTNpGXwhgIetAoYF8JSc33q29QA==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/@types/inquirer": {
|
||||
"version": "9.0.8",
|
||||
"resolved": "https://registry.npmmirror.com/@types/inquirer/-/inquirer-9.0.8.tgz",
|
||||
"integrity": "sha512-CgPD5kFGWsb8HJ5K7rfWlifao87m4ph8uioU7OTncJevmE/VLIqAAjfQtko578JZg7/f69K4FgqYym3gNr7DeA==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@types/through": "*",
|
||||
"rxjs": "^7.2.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@types/json-schema": {
|
||||
"version": "7.0.15",
|
||||
"resolved": "https://registry.npmmirror.com/@types/json-schema/-/json-schema-7.0.15.tgz",
|
||||
@@ -1029,6 +1069,16 @@
|
||||
"dev": true,
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/@types/through": {
|
||||
"version": "0.0.33",
|
||||
"resolved": "https://registry.npmmirror.com/@types/through/-/through-0.0.33.tgz",
|
||||
"integrity": "sha512-HsJ+z3QuETzP3cswwtzt2vEIiHBk/dCcHGhbmG5X3ecnwFD/lPrMpliGXxSCg03L9AhrdwA4Oz/qfspkDW+xGQ==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@types/node": "*"
|
||||
}
|
||||
},
|
||||
"node_modules/@types/uglify-js": {
|
||||
"version": "3.17.5",
|
||||
"resolved": "https://registry.npmmirror.com/@types/uglify-js/-/uglify-js-3.17.5.tgz",
|
||||
|
||||
@@ -31,9 +31,11 @@
|
||||
"@rollup/plugin-commonjs": "^28.0.6",
|
||||
"@rollup/plugin-json": "^6.1.0",
|
||||
"@rollup/plugin-node-resolve": "^16.0.1",
|
||||
"@rollup/plugin-typescript": "^12.1.4",
|
||||
"@types/adm-zip": "^0.5.7",
|
||||
"@types/cli-progress": "^3.11.6",
|
||||
"@types/fs-extra": "^11.0.4",
|
||||
"@types/inquirer": "^9.0.8",
|
||||
"@types/yauzl": "^2.10.3",
|
||||
"nexe": "^5.0.0-beta.4",
|
||||
"rollup": "^4.44.1",
|
||||
|
||||
@@ -1,16 +1,18 @@
|
||||
import typescript from '@rollup/plugin-typescript'
|
||||
import resolve from '@rollup/plugin-node-resolve';
|
||||
import commonjs from '@rollup/plugin-commonjs'
|
||||
import json from '@rollup/plugin-json';
|
||||
/** @type {import('rollup').RollupOptions} */
|
||||
// ---cut---
|
||||
export default {
|
||||
input: 'dist/main.js',
|
||||
input: 'src/main.ts',
|
||||
output: {
|
||||
file: 'ndist/bundle.js',
|
||||
format: 'es'
|
||||
file: 'dist/bundle.js',
|
||||
format: 'esm'
|
||||
},
|
||||
plugins:[
|
||||
resolve({preferBuiltins: false}),
|
||||
typescript(),
|
||||
resolve({preferBuiltins: true}),
|
||||
commonjs(),
|
||||
json()
|
||||
]
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import inquirer from "inquirer";
|
||||
import yauzl from "yauzl";
|
||||
import process from "node:process";
|
||||
import fs from "node:fs"
|
||||
import fse from "fs-extra";
|
||||
import { join, basename, dirname } from "node:path";
|
||||
import { platform, what_platform } from "./platform/index.js";
|
||||
@@ -37,7 +38,7 @@ if (!argv) {
|
||||
}
|
||||
|
||||
function initdir(){
|
||||
if(!fse.existsSync(unzip_path)){
|
||||
if(!fs.existsSync(unzip_path)){
|
||||
fse.ensureDirSync(join(unzip_path,"rubbish"))
|
||||
}
|
||||
}
|
||||
@@ -56,7 +57,7 @@ async function main(modpack_path: string) {
|
||||
if (/\/$/.test(entry.fileName)) {
|
||||
} else if (entry.fileName.includes("overrides/")) {
|
||||
const zipfilex = join(unzip_path, zipname,entry.fileName.replace("overrides/",""))
|
||||
if(!fse.existsSync(zipfilex)){
|
||||
if(!fs.existsSync(zipfilex)){
|
||||
zipfile.openReadStream(entry,(err,stream)=>{ //读取overrides文件夹下的所有文件和文件夹
|
||||
const dir = dirname(zipfilex)
|
||||
fse.ensureDirSync(dir);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import cp from "child_process";
|
||||
import fsExtra from "fs-extra/esm";
|
||||
import fsExtra from "fs-extra";
|
||||
import got from "got";
|
||||
export default async function install(
|
||||
mcver: string,
|
||||
@@ -16,4 +16,4 @@ export default async function install(
|
||||
`java -jar fabric-installer-1.0.1.jar server -mcver ${mcver} -loader ${fabricver}`,
|
||||
{ cwd: path, stdio: "ignore" }
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
import AdmZip from "adm-zip";
|
||||
import fsExtra from "fs-extra/esm";
|
||||
import fsExtra from "fs-extra";
|
||||
import gotx from "got";
|
||||
import { xfastdownload } from "../utils/utils.js";
|
||||
import { LOGGER } from "../utils/logger.js";
|
||||
@@ -73,4 +73,4 @@ export default async function install(
|
||||
stdio: "ignore",
|
||||
});
|
||||
LOGGER.info("安装NeoForge完成!");
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
import pMap from "p-map";
|
||||
import pRetry from "p-retry";
|
||||
import fs from "node:fs"
|
||||
import fse from "fs-extra"
|
||||
import yauzl from "yauzl";
|
||||
import got from "got";
|
||||
@@ -35,7 +36,7 @@ export async function fastdownload(data:[string,string]){
|
||||
const bar = multibar.create(size, 0, {filename: e[1]})
|
||||
try{
|
||||
await pRetry(async()=>{
|
||||
if(!fse.existsSync(e[1])){
|
||||
if(!fs.existsSync(e[1])){
|
||||
await got.get(e[0],{
|
||||
responseType:"buffer",
|
||||
}).on('downloadProgress',(progress)=>{
|
||||
@@ -105,7 +106,7 @@ export async function xfastdownload(
|
||||
url !== null &&
|
||||
url !== "" &&
|
||||
path !== null &&
|
||||
!fse.existsSync(e[1])
|
||||
!fs.existsSync(e[1])
|
||||
) {
|
||||
const res = (await got.get(e[0])).rawBody; //下载文件
|
||||
await fse.outputFile(e[1], res); //保存文件
|
||||
|
||||
Reference in New Issue
Block a user