From 854c28259995f9a304fb14a850ba55663b6a06af Mon Sep 17 00:00:00 2001 From: kunkka Date: Tue, 27 Oct 2020 01:42:49 +0800 Subject: [PATCH] feat: unified script --- package.json | 10 +++++----- script/{setup.js => pull.js} | 8 ++++++-- 2 files changed, 11 insertions(+), 7 deletions(-) rename script/{setup.js => pull.js} (93%) diff --git a/package.json b/package.json index 1b955a6..5d0a920 100644 --- a/package.json +++ b/package.json @@ -6,11 +6,11 @@ "serve": "vue-cli-service serve", "build": "vue-cli-service build", "lint": "vue-cli-service lint", - "prettier": "npx prettier --write ./src", - "napi_run": "cd ./NeteaseCloudMusicApi-master && npm run start", - "napi_pull": "node script/setup.js v3.45.1", - "napi_install": "cd ./NeteaseCloudMusicApi-master && npm install", - "setup": "npm run napi_pull && npm run napi_install" + "prettier": "npx prettier --write ./src ./script", + "napi:run": "cd ./NeteaseCloudMusicApi-master && npm run start", + "napi:pull": "node script/pull.js", + "napi:install": "cd ./NeteaseCloudMusicApi-master && npm install", + "napi:setup": "npm run napi:pull && npm run napi:install" }, "husky": { "hooks": { diff --git a/script/setup.js b/script/pull.js similarity index 93% rename from script/setup.js rename to script/pull.js index 8576895..8f75eb8 100644 --- a/script/setup.js +++ b/script/pull.js @@ -49,7 +49,11 @@ async function download(options, fileName, callback) { res.on("data", (chunk) => { if (len) { cur += chunk.length; - console.log(`Downloading ${fix2((100.0 * cur) / len)}% ${fix2(cur / MEGA)}/${fix2(total)}mb`); + console.log( + `Downloading ${fix2((100.0 * cur) / len)}% ${fix2( + cur / MEGA + )}/${fix2(total)}mb` + ); } }); res.on("end", () => { @@ -93,7 +97,7 @@ async function unzip(source, target) { download(options, fileName, (text) => { console.log(text); }).then((path) => { - console.log(path) + console.log(path); // Unzip process return unzip(path, dest); });