From 16eca8f10ba511a20510627fda5d830da0bd8944 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=AC=A7=E5=A6=82=E6=A0=8B?= Date: Mon, 3 Jul 2023 15:24:01 +0800 Subject: [PATCH 1/6] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E6=9B=B4=E5=A4=9A?= =?UTF-8?q?=E6=97=A5=E5=BF=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .eslintrc.json | 14 ++ README.md | 5 + bin/index.js | 43 ++-- package.json | 5 +- yarn.lock | 543 ++++++++++++++++++++++++++++++++++++++++++++++++- 5 files changed, 594 insertions(+), 16 deletions(-) create mode 100644 .eslintrc.json diff --git a/.eslintrc.json b/.eslintrc.json new file mode 100644 index 0000000..9b33fdc --- /dev/null +++ b/.eslintrc.json @@ -0,0 +1,14 @@ +{ + "env": { + "node": true, + "commonjs": true, + "es2021": true + }, + "extends": "eslint:recommended", + "parserOptions": { + "ecmaVersion": "latest" + }, + "rules": { + "no-unused-vars": "warn" + } +} diff --git a/README.md b/README.md index 5cd66d3..d44158f 100644 --- a/README.md +++ b/README.md @@ -9,6 +9,11 @@ npm install coding-generic -g ## 使用 +- 推送单个制品 ```shell coding-generic --username=[:password] --path= --registry= ``` +- 推送文件夹(仅 1.2.7 及以上版本支持) +```shell +coding-generic -u=coding@coding.com --dir --path= --registry= +``` \ No newline at end of file diff --git a/bin/index.js b/bin/index.js index c28c4ed..0e1744f 100755 --- a/bin/index.js +++ b/bin/index.js @@ -39,10 +39,12 @@ const upload = async (filePath, parts = [], requestUrl) => { const uploadChunk = async (currentChunk, currentChunkIndex, parts, isRetry) => { if (parts.some(({ partNumber, size }) => partNumber === currentChunkIndex && size === currentChunk.length)) { bar.tick(); + logger.info(`分片(${currentChunkIndex})已经上传,跳过 (path: ${filePath}) , url: ${requestUrl})`); return Promise.resolve(); } try { + logger.info(`开始上传分片(${currentChunkIndex}) (path: ${filePath}) , url: ${requestUrl})`); await _uploadChunk(requestUrl, { uploadId, version, @@ -55,8 +57,11 @@ const upload = async (filePath, parts = [], requestUrl) => { }, Authorization }); + logger.info(`分片(${currentChunkIndex})上传完毕 (path: ${filePath}) , url: ${requestUrl})`); bar.tick(); } catch (error) { + console.error(`分片(${currentChunkIndex})上传失败 (path: ${filePath}) , url: ${requestUrl})`); + logger.error(`分片(${currentChunkIndex})上传失败 (path: ${filePath}) , url: ${requestUrl})`); logger.error(error.message); logger.error(error.stack); if (['ECONNREFUSED', 'ECONNRESET', 'ENOENT', 'EPROTO'].includes(error.code)) { @@ -64,9 +69,11 @@ const upload = async (filePath, parts = [], requestUrl) => { if (!isRetry) { logger.warn('retry') logger.warn(error.code); + logger.info(`重试分片(${currentChunkIndex})上传 (path: ${filePath}) , url: ${requestUrl})`); await uploadChunk(currentChunk, currentChunkIndex, parts, true); } else { console.log(chalk.red('网络连接异常,请重新执行命令继续上传')); + logger.error(`分片(${currentChunkIndex})上传时网络连接异常 (path: ${filePath}) , url: ${requestUrl})`); process.exit(1); } } else { @@ -77,18 +84,20 @@ const upload = async (filePath, parts = [], requestUrl) => { } console.log(`\n开始上传 (${filePath})\n`); - logger.info(`开始上传 (${filePath})`); + logger.info(`开始上传 (path: ${filePath}) , url: ${requestUrl})`); try { - const chunkIndexs = new Array(totalChunk).fill("").map((_, index) => index + 1) + const chunkIndexs = new Array(totalChunk).fill("").map((_, index) => index + 1); + + logger.info(`分片总数:${totalChunk},分片大小:${chunkSize} (path: ${filePath}) , url: ${requestUrl})`); await BlueBirdPromise.map(chunkIndexs, (currentChunkIndex) => { const start = (currentChunkIndex - 1) * chunkSize; const end = ((start + chunkSize) >= fileSize) ? fileSize : start + chunkSize - 1; const stream = fs.createReadStream(filePath, { start, end }) let buf = []; - return new Promise((resolve) => { + return new Promise((resolve, reject) => { stream.on('data', data => { buf.push(data) }) @@ -101,6 +110,7 @@ const upload = async (filePath, parts = [], requestUrl) => { resolve(); }) }).catch(error => { + logger.error(`读取分片 ${currentChunkIndex} 数据失败 (path: ${filePath}) , url: ${requestUrl})`); throw Error(error) }) }, { concurrency: argv.concurrency }) @@ -117,7 +127,8 @@ const upload = async (filePath, parts = [], requestUrl) => { const merge = async () => { - console.log(chalk.cyan('正在合并分片,请稍等...')) + console.log(chalk.cyan('正在合并分片,请稍等...')); + logger.info(`正在合并分片 (path: ${filePath}) , url: ${requestUrl})`); return await _mergeAllChunks(requestUrl, { version, uploadId, @@ -132,21 +143,24 @@ const upload = async (filePath, parts = [], requestUrl) => { try { const res = await withRetry(merge, 3, 500); if (res.code) { + logger.error(`合并分片失败 (path: ${filePath}) , url: ${requestUrl})`); throw (res.message); } } catch (error) { logger.error(error.message); logger.error(error.stack); console.log(chalk.red((error.response && error.response.data) || error.message)); - return; + process.exit(1); } console.log(chalk.green(`\n上传完毕 (${filePath})\n`)) - logger.info('************************ 上传完毕 ************************') + logger.info(`************************ 上传完毕 (path: ${filePath}) , url: ${requestUrl}) ************************`) } const getFileMD5Success = async (filePath, requestUrl) => { + let uploadedParts = [] try { + logger.info(`获取已上传信息 (path: ${filePath} , url: ${requestUrl})`); const res = await _getExistChunks(requestUrl, { fileSize, version, @@ -158,20 +172,23 @@ const getFileMD5Success = async (filePath, requestUrl) => { throw (res.message); } uploadId = res.data.uploadId; - + logger.info(`上传的 UploadId: ${uploadId} (path: ${filePath} , url: ${requestUrl})`); // 上传过一部分 if (Array.isArray(res.data.parts)) { - await upload(filePath, res.data.parts, requestUrl); + uploadedParts = res.data.parts } else { // 未上传过 - await upload(filePath, [], requestUrl); + uploadedParts = [] } } catch (error) { + logger.error(`获取已上传信息错误 (path: ${filePath} , url: ${requestUrl})`); logger.error(error.message); logger.error(error.stack); console.log(chalk.red((error.response && error.response.data) || error.message)); process.exit(1); } + + await upload(filePath, uploadedParts, requestUrl); } const getFileMD5 = async (filePath, requestUrl) => { @@ -186,8 +203,8 @@ const getFileMD5 = async (filePath, requestUrl) => { logger.info(`开始计算 MD5 (${filePath})`); const bar = new ProgressBar(':bar [:current/:total] :percent ', { total: totalChunk }); - await new Promise(resolve => { - stream = fs.createReadStream(filePath, { highWaterMark: chunkSize }); + await new Promise((resolve, reject) => { + const stream = fs.createReadStream(filePath, { highWaterMark: chunkSize }); stream.on('data', chunk => { bar.tick(); spark.append(chunk) @@ -203,6 +220,7 @@ const getFileMD5 = async (filePath, requestUrl) => { resolve(); }) }).catch(error => { + logger.error(`计算 MD5 失败(${filePath})`); throw Error(error); }) } catch (error) { @@ -215,6 +233,7 @@ const getFileMD5 = async (filePath, requestUrl) => { const uploadFile = async (filePath, size, requestUrl) => { fileSize = size; + logger.info(`('************************ 开始上传 (${filePath}) ('************************`); await getFileMD5(filePath, requestUrl); md5 = ''; uploadId = ''; @@ -245,7 +264,7 @@ const uploadDir = async (dir) => { logger.error(error.stack); process.exit(1); } else { - resolve(files) + return files; } } diff --git a/package.json b/package.json index cea991a..e147922 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "coding-generic", - "version": "1.2.7", + "version": "1.2.8", "description": "", "main": "index.js", "bin": { @@ -26,5 +26,8 @@ "repository": { "type": "git", "url": "git@github.com:Coding/coding-generic.git" + }, + "devDependencies": { + "eslint": "^8.44.0" } } diff --git a/yarn.lock b/yarn.lock index 9abb3cc..4fe19fb 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2,6 +2,11 @@ # yarn lockfile v1 +"@aashutoshrathi/word-wrap@^1.2.3": + version "1.2.6" + resolved "https://registry.yarnpkg.com/@aashutoshrathi/word-wrap/-/word-wrap-1.2.6.tgz#bd9154aec9983f77b3a034ecaa015c2e4201f6cf" + integrity sha512-1Yjs2SvM8TflER/OD3cOjhWWOZb58A2t7wpE2S9XfBYTiIl+XFhQG2bjy4Pu1I+EAlCNUzRDYDdFwFYUKvXcIA== + "@dabh/diagnostics@^2.0.2": version "2.0.2" resolved "https://registry.npm.taobao.org/@dabh/diagnostics/download/@dabh/diagnostics-2.0.2.tgz#290d08f7b381b8f94607dc8f471a12c675f9db31" @@ -11,7 +16,89 @@ enabled "2.0.x" kuler "^2.0.0" -ajv@^6.12.2, ajv@^6.12.3: +"@eslint-community/eslint-utils@^4.2.0": + version "4.4.0" + resolved "https://registry.yarnpkg.com/@eslint-community/eslint-utils/-/eslint-utils-4.4.0.tgz#a23514e8fb9af1269d5f7788aa556798d61c6b59" + integrity sha512-1/sA4dwrzBAyeUoQ6oxahHKmrZvsnLCg4RfxW3ZFGGmQkSNQPFNLV9CUEFQP1x9EYXHTo5p6xdhZM1Ne9p/AfA== + dependencies: + eslint-visitor-keys "^3.3.0" + +"@eslint-community/regexpp@^4.4.0": + version "4.5.1" + resolved "https://registry.yarnpkg.com/@eslint-community/regexpp/-/regexpp-4.5.1.tgz#cdd35dce4fa1a89a4fd42b1599eb35b3af408884" + integrity sha512-Z5ba73P98O1KUYCCJTUeVpja9RcGoMdncZ6T49FCUl2lN38JtCJ+3WgIDBv0AuY4WChU5PmtJmOCTlN6FZTFKQ== + +"@eslint/eslintrc@^2.1.0": + version "2.1.0" + resolved "https://registry.yarnpkg.com/@eslint/eslintrc/-/eslintrc-2.1.0.tgz#82256f164cc9e0b59669efc19d57f8092706841d" + integrity sha512-Lj7DECXqIVCqnqjjHMPna4vn6GJcMgul/wuS0je9OZ9gsL0zzDpKPVtcG1HaDVc+9y+qgXneTeUMbCqXJNpH1A== + dependencies: + ajv "^6.12.4" + debug "^4.3.2" + espree "^9.6.0" + globals "^13.19.0" + ignore "^5.2.0" + import-fresh "^3.2.1" + js-yaml "^4.1.0" + minimatch "^3.1.2" + strip-json-comments "^3.1.1" + +"@eslint/js@8.44.0": + version "8.44.0" + resolved "https://registry.yarnpkg.com/@eslint/js/-/js-8.44.0.tgz#961a5903c74139390478bdc808bcde3fc45ab7af" + integrity sha512-Ag+9YM4ocKQx9AarydN0KY2j0ErMHNIocPDrVo8zAE44xLTjEtz81OdR68/cydGtk6m6jDb5Za3r2useMzYmSw== + +"@humanwhocodes/config-array@^0.11.10": + version "0.11.10" + resolved "https://registry.yarnpkg.com/@humanwhocodes/config-array/-/config-array-0.11.10.tgz#5a3ffe32cc9306365fb3fd572596cd602d5e12d2" + integrity sha512-KVVjQmNUepDVGXNuoRRdmmEjruj0KfiGSbS8LVc12LMsWDQzRXJ0qdhN8L8uUigKpfEHRhlaQFY0ib1tnUbNeQ== + dependencies: + "@humanwhocodes/object-schema" "^1.2.1" + debug "^4.1.1" + minimatch "^3.0.5" + +"@humanwhocodes/module-importer@^1.0.1": + version "1.0.1" + resolved "https://registry.yarnpkg.com/@humanwhocodes/module-importer/-/module-importer-1.0.1.tgz#af5b2691a22b44be847b0ca81641c5fb6ad0172c" + integrity sha512-bxveV4V8v5Yb4ncFTT3rPSgZBOpCkjfK0y4oVVVJwIuDVBRMDXrPyXRL988i5ap9m9bnyEEjWfm5WkBmtffLfA== + +"@humanwhocodes/object-schema@^1.2.1": + version "1.2.1" + resolved "https://registry.yarnpkg.com/@humanwhocodes/object-schema/-/object-schema-1.2.1.tgz#b520529ec21d8e5945a1851dfd1c32e94e39ff45" + integrity sha512-ZnQMnLV4e7hDlUvw8H+U8ASL02SS2Gn6+9Ac3wGGLIe7+je2AeAOxPY+izIPJDfFDb7eDjev0Us8MO1iFRN8hA== + +"@nodelib/fs.scandir@2.1.5": + version "2.1.5" + resolved "https://registry.yarnpkg.com/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz#7619c2eb21b25483f6d167548b4cfd5a7488c3d5" + integrity sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g== + dependencies: + "@nodelib/fs.stat" "2.0.5" + run-parallel "^1.1.9" + +"@nodelib/fs.stat@2.0.5": + version "2.0.5" + resolved "https://registry.yarnpkg.com/@nodelib/fs.stat/-/fs.stat-2.0.5.tgz#5bd262af94e9d25bd1e71b05deed44876a222e8b" + integrity sha512-RkhPPp2zrqDAQA/2jNhnztcPAlv64XdhIp7a7454A5ovI7Bukxgt7MX7udwAu3zg1DcpPU0rz3VV1SeaqvY4+A== + +"@nodelib/fs.walk@^1.2.8": + version "1.2.8" + resolved "https://registry.yarnpkg.com/@nodelib/fs.walk/-/fs.walk-1.2.8.tgz#e95737e8bb6746ddedf69c556953494f196fe69a" + integrity sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg== + dependencies: + "@nodelib/fs.scandir" "2.1.5" + fastq "^1.6.0" + +acorn-jsx@^5.3.2: + version "5.3.2" + resolved "https://registry.yarnpkg.com/acorn-jsx/-/acorn-jsx-5.3.2.tgz#7ed5bb55908b3b2f1bc55c6af1653bada7f07937" + integrity sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ== + +acorn@^8.9.0: + version "8.9.0" + resolved "https://registry.yarnpkg.com/acorn/-/acorn-8.9.0.tgz#78a16e3b2bcc198c10822786fa6679e245db5b59" + integrity sha512-jaVNAFBHNLXspO543WnNNPZFRtavh3skAkITqD0/2aeMkKZTN+254PyhwxFYrk3vQ1xfY+2wbesJMs/JC8/PwQ== + +ajv@^6.10.0, ajv@^6.12.2, ajv@^6.12.3, ajv@^6.12.4: version "6.12.6" resolved "https://registry.npm.taobao.org/ajv/download/ajv-6.12.6.tgz?cache=0&sync_timestamp=1603561547443&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fajv%2Fdownload%2Fajv-6.12.6.tgz#baf5a62e802b07d977034586f8c3baf5adf26df4" integrity sha1-uvWmLoArB9l3A0WG+MO69a3ybfQ= @@ -26,6 +113,11 @@ ansi-regex@^5.0.0: resolved "https://registry.npm.taobao.org/ansi-regex/download/ansi-regex-5.0.0.tgz#388539f55179bf39339c81af30a654d69f87cb75" integrity sha1-OIU59VF5vzkznIGvMKZU1p+Hy3U= +ansi-regex@^5.0.1: + version "5.0.1" + resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-5.0.1.tgz#082cb2c89c9fe8659a311a53bd6a4dc5301db304" + integrity sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ== + ansi-styles@^4.0.0, ansi-styles@^4.1.0: version "4.3.0" resolved "https://registry.npm.taobao.org/ansi-styles/download/ansi-styles-4.3.0.tgz?cache=0&sync_timestamp=1601839122515&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fansi-styles%2Fdownload%2Fansi-styles-4.3.0.tgz#edd803628ae71c04c85ae7a0906edad34b648937" @@ -33,6 +125,11 @@ ansi-styles@^4.0.0, ansi-styles@^4.1.0: dependencies: color-convert "^2.0.1" +argparse@^2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/argparse/-/argparse-2.0.1.tgz#246f50f3ca78a3240f6c997e8a9bd1eac49e4b38" + integrity sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q== + asn1@~0.2.3: version "0.2.4" resolved "https://registry.npm.taobao.org/asn1/download/asn1-0.2.4.tgz#8d2475dfab553bb33e77b54e59e880bb8ce23136" @@ -94,6 +191,14 @@ bluebird@^3.7.2: resolved "https://registry.yarnpkg.com/bluebird/-/bluebird-3.7.2.tgz#9f229c15be272454ffa973ace0dbee79a1b0c36f" integrity sha512-XpNj6GDQzdfW+r2Wnn7xiSAd7TM3jzkxGXBGTtWKuSXv1xUV+azxAm8jdWZN06QTQk+2N2XB9jRDkvbmQmcRtg== +brace-expansion@^1.1.7: + version "1.1.11" + resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-1.1.11.tgz#3c7fcbf529d87226f3d2f52b966ff5271eb441dd" + integrity sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA== + dependencies: + balanced-match "^1.0.0" + concat-map "0.0.1" + brace-expansion@^2.0.1: version "2.0.1" resolved "https://mirrors.tencent.com/npm/brace-expansion/-/brace-expansion-2.0.1.tgz#1edc459e0f0c548486ecf9fc99f2221364b9a0ae" @@ -101,11 +206,24 @@ brace-expansion@^2.0.1: dependencies: balanced-match "^1.0.0" +callsites@^3.0.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/callsites/-/callsites-3.1.0.tgz#b3630abd8943432f54b3f0519238e33cd7df2f73" + integrity sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ== + caseless@~0.12.0: version "0.12.0" resolved "https://registry.npm.taobao.org/caseless/download/caseless-0.12.0.tgz#1b681c21ff84033c826543090689420d187151dc" integrity sha1-G2gcIf+EAzyCZUMJBolCDRhxUdw= +chalk@^4.0.0: + version "4.1.2" + resolved "https://registry.yarnpkg.com/chalk/-/chalk-4.1.2.tgz#aac4e2b7734a740867aeb16bf02aad556a1e7a01" + integrity sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA== + dependencies: + ansi-styles "^4.1.0" + supports-color "^7.1.0" + chalk@^4.1.0: version "4.1.0" resolved "https://registry.npm.taobao.org/chalk/download/chalk-4.1.0.tgz#4e14870a618d9e2edd97dd8345fd9d9dc315646a" @@ -183,6 +301,11 @@ combined-stream@^1.0.6, combined-stream@^1.0.8, combined-stream@~1.0.6: dependencies: delayed-stream "~1.0.0" +concat-map@0.0.1: + version "0.0.1" + resolved "https://registry.yarnpkg.com/concat-map/-/concat-map-0.0.1.tgz#d8a96bd77fd68df7793a73036a3ba0d5405d477b" + integrity sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg== + conf@^7.1.2: version "7.1.2" resolved "https://registry.npm.taobao.org/conf/download/conf-7.1.2.tgz#d9678a9d8f04de8bf5cd475105da8fdae49c2ec4" @@ -214,6 +337,15 @@ cos-nodejs-sdk-v5@^2.8.2: request "^2.88.0" xml2js "^0.4.19" +cross-spawn@^7.0.2: + version "7.0.3" + resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-7.0.3.tgz#f73a85b9d5d41d045551c177e2882d4ac85728a6" + integrity sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w== + dependencies: + path-key "^3.1.0" + shebang-command "^2.0.0" + which "^2.0.1" + dashdash@^1.12.0: version "1.14.1" resolved "https://registry.npm.taobao.org/dashdash/download/dashdash-1.14.1.tgz?cache=0&sync_timestamp=1601073454623&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fdashdash%2Fdownload%2Fdashdash-1.14.1.tgz#853cfa0f7cbe2fed5de20326b8dd581035f6e2f0" @@ -228,11 +360,30 @@ debounce-fn@^4.0.0: dependencies: mimic-fn "^3.0.0" +debug@^4.1.1, debug@^4.3.2: + version "4.3.4" + resolved "https://registry.yarnpkg.com/debug/-/debug-4.3.4.tgz#1319f6579357f2338d3337d2cdd4914bb5dcc865" + integrity sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ== + dependencies: + ms "2.1.2" + +deep-is@^0.1.3: + version "0.1.4" + resolved "https://registry.yarnpkg.com/deep-is/-/deep-is-0.1.4.tgz#a6f2dce612fadd2ef1f519b73551f17e85199831" + integrity sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ== + delayed-stream@~1.0.0: version "1.0.0" resolved "https://registry.npm.taobao.org/delayed-stream/download/delayed-stream-1.0.0.tgz#df3ae199acadfb7d440aaae0b29e2272b24ec619" integrity sha1-3zrhmayt+31ECqrgsp4icrJOxhk= +doctrine@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/doctrine/-/doctrine-3.0.0.tgz#addebead72a6574db783639dc87a121773973961" + integrity sha512-yS+Q5i3hBf7GBkd4KG8a7eBNNWNGLTaEwwYWUijIYM7zrlYDM0BFXHjjPWlWZ1Rg7UaddZeIDmi9jF3HmqiQ2w== + dependencies: + esutils "^2.0.2" + dot-prop@^5.2.0: version "5.3.0" resolved "https://registry.npm.taobao.org/dot-prop/download/dot-prop-5.3.0.tgz#90ccce708cd9cd82cc4dc8c3ddd9abdd55b20e88" @@ -268,6 +419,102 @@ escalade@^3.1.1: resolved "https://registry.npm.taobao.org/escalade/download/escalade-3.1.1.tgz?cache=0&sync_timestamp=1602567224085&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fescalade%2Fdownload%2Fescalade-3.1.1.tgz#d8cfdc7000965c5a0174b4a82eaa5c0552742e40" integrity sha1-2M/ccACWXFoBdLSoLqpcBVJ0LkA= +escape-string-regexp@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz#14ba83a5d373e3d311e5afca29cf5bfad965bf34" + integrity sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA== + +eslint-scope@^7.2.0: + version "7.2.0" + resolved "https://registry.yarnpkg.com/eslint-scope/-/eslint-scope-7.2.0.tgz#f21ebdafda02352f103634b96dd47d9f81ca117b" + integrity sha512-DYj5deGlHBfMt15J7rdtyKNq/Nqlv5KfU4iodrQ019XESsRnwXH9KAE0y3cwtUHDo2ob7CypAnCqefh6vioWRw== + dependencies: + esrecurse "^4.3.0" + estraverse "^5.2.0" + +eslint-visitor-keys@^3.3.0, eslint-visitor-keys@^3.4.1: + version "3.4.1" + resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-3.4.1.tgz#c22c48f48942d08ca824cc526211ae400478a994" + integrity sha512-pZnmmLwYzf+kWaM/Qgrvpen51upAktaaiI01nsJD/Yr3lMOdNtq0cxkrrg16w64VtisN6okbs7Q8AfGqj4c9fA== + +eslint@^8.44.0: + version "8.44.0" + resolved "https://registry.yarnpkg.com/eslint/-/eslint-8.44.0.tgz#51246e3889b259bbcd1d7d736a0c10add4f0e500" + integrity sha512-0wpHoUbDUHgNCyvFB5aXLiQVfK9B0at6gUvzy83k4kAsQ/u769TQDX6iKC+aO4upIHO9WSaA3QoXYQDHbNwf1A== + dependencies: + "@eslint-community/eslint-utils" "^4.2.0" + "@eslint-community/regexpp" "^4.4.0" + "@eslint/eslintrc" "^2.1.0" + "@eslint/js" "8.44.0" + "@humanwhocodes/config-array" "^0.11.10" + "@humanwhocodes/module-importer" "^1.0.1" + "@nodelib/fs.walk" "^1.2.8" + ajv "^6.10.0" + chalk "^4.0.0" + cross-spawn "^7.0.2" + debug "^4.3.2" + doctrine "^3.0.0" + escape-string-regexp "^4.0.0" + eslint-scope "^7.2.0" + eslint-visitor-keys "^3.4.1" + espree "^9.6.0" + esquery "^1.4.2" + esutils "^2.0.2" + fast-deep-equal "^3.1.3" + file-entry-cache "^6.0.1" + find-up "^5.0.0" + glob-parent "^6.0.2" + globals "^13.19.0" + graphemer "^1.4.0" + ignore "^5.2.0" + import-fresh "^3.0.0" + imurmurhash "^0.1.4" + is-glob "^4.0.0" + is-path-inside "^3.0.3" + js-yaml "^4.1.0" + json-stable-stringify-without-jsonify "^1.0.1" + levn "^0.4.1" + lodash.merge "^4.6.2" + minimatch "^3.1.2" + natural-compare "^1.4.0" + optionator "^0.9.3" + strip-ansi "^6.0.1" + strip-json-comments "^3.1.0" + text-table "^0.2.0" + +espree@^9.6.0: + version "9.6.0" + resolved "https://registry.yarnpkg.com/espree/-/espree-9.6.0.tgz#80869754b1c6560f32e3b6929194a3fe07c5b82f" + integrity sha512-1FH/IiruXZ84tpUlm0aCUEwMl2Ho5ilqVh0VvQXw+byAz/4SAciyHLlfmL5WYqsvD38oymdUwBss0LtK8m4s/A== + dependencies: + acorn "^8.9.0" + acorn-jsx "^5.3.2" + eslint-visitor-keys "^3.4.1" + +esquery@^1.4.2: + version "1.5.0" + resolved "https://registry.yarnpkg.com/esquery/-/esquery-1.5.0.tgz#6ce17738de8577694edd7361c57182ac8cb0db0b" + integrity sha512-YQLXUplAwJgCydQ78IMJywZCceoqk1oH01OERdSAJc/7U2AylwjhSCLDEtqwg811idIS/9fIU5GjG73IgjKMVg== + dependencies: + estraverse "^5.1.0" + +esrecurse@^4.3.0: + version "4.3.0" + resolved "https://registry.yarnpkg.com/esrecurse/-/esrecurse-4.3.0.tgz#7ad7964d679abb28bee72cec63758b1c5d2c9921" + integrity sha512-KmfKL3b6G+RXvP8N1vr3Tq1kL/oCFgn2NYXEtqP8/L3pKapUA4G8cFVaoF3SU323CD4XypR/ffioHmkti6/Tag== + dependencies: + estraverse "^5.2.0" + +estraverse@^5.1.0, estraverse@^5.2.0: + version "5.3.0" + resolved "https://registry.yarnpkg.com/estraverse/-/estraverse-5.3.0.tgz#2eea5290702f26ab8fe5370370ff86c965d21123" + integrity sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA== + +esutils@^2.0.2: + version "2.0.3" + resolved "https://registry.yarnpkg.com/esutils/-/esutils-2.0.3.tgz#74d2eb4de0b8da1293711910d50775b9b710ef64" + integrity sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g== + extend@~3.0.2: version "3.0.2" resolved "https://registry.npm.taobao.org/extend/download/extend-3.0.2.tgz?cache=0&sync_timestamp=1589682707348&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fextend%2Fdownload%2Fextend-3.0.2.tgz#f8b1136b4071fbd8eb140aff858b1019ec2915fa" @@ -283,7 +530,7 @@ extsprintf@^1.2.0: resolved "https://registry.npm.taobao.org/extsprintf/download/extsprintf-1.4.0.tgz#e2689f8f356fad62cca65a3a91c5df5f9551692f" integrity sha1-4mifjzVvrWLMplo6kcXfX5VRaS8= -fast-deep-equal@^3.1.1: +fast-deep-equal@^3.1.1, fast-deep-equal@^3.1.3: version "3.1.3" resolved "https://registry.npm.taobao.org/fast-deep-equal/download/fast-deep-equal-3.1.3.tgz#3a7d56b559d6cbc3eb512325244e619a65c6c525" integrity sha1-On1WtVnWy8PrUSMlJE5hmmXGxSU= @@ -293,16 +540,35 @@ fast-json-stable-stringify@^2.0.0: resolved "https://registry.npm.taobao.org/fast-json-stable-stringify/download/fast-json-stable-stringify-2.1.0.tgz#874bf69c6f404c2b5d99c481341399fd55892633" integrity sha1-h0v2nG9ATCtdmcSBNBOZ/VWJJjM= +fast-levenshtein@^2.0.6: + version "2.0.6" + resolved "https://registry.yarnpkg.com/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz#3d8a5c66883a16a30ca8643e851f19baa7797917" + integrity sha512-DCXu6Ifhqcks7TZKY3Hxp3y6qphY5SJZmrWMDrKcERSOXWQdMhU9Ig/PYrzyw/ul9jOIyh0N4M0tbC5hodg8dw== + fast-safe-stringify@^2.0.4: version "2.0.7" resolved "https://registry.npm.taobao.org/fast-safe-stringify/download/fast-safe-stringify-2.0.7.tgz#124aa885899261f68aedb42a7c080de9da608743" integrity sha1-EkqohYmSYfaK7bQqfAgN6dpgh0M= +fastq@^1.6.0: + version "1.15.0" + resolved "https://registry.yarnpkg.com/fastq/-/fastq-1.15.0.tgz#d04d07c6a2a68fe4599fea8d2e103a937fae6b3a" + integrity sha512-wBrocU2LCXXa+lWBt8RoIRD89Fi8OdABODa/kEnyeyjS5aZO5/GNvI5sEINADqP/h8M29UHTHUb53sUu5Ihqdw== + dependencies: + reusify "^1.0.4" + fecha@^4.2.0: version "4.2.0" resolved "https://registry.npm.taobao.org/fecha/download/fecha-4.2.0.tgz#3ffb6395453e3f3efff850404f0a59b6747f5f41" integrity sha1-P/tjlUU+Pz7/+FBATwpZtnR/X0E= +file-entry-cache@^6.0.1: + version "6.0.1" + resolved "https://registry.yarnpkg.com/file-entry-cache/-/file-entry-cache-6.0.1.tgz#211b2dd9659cb0394b073e7323ac3c933d522027" + integrity sha512-7Gps/XWymbLk2QLYK4NzpMOrYjMhdIxXuIvy2QBsLE6ljuodKvdkWs/cpyJJ3CVIVpH0Oi1Hvg1ovbMzLdFBBg== + dependencies: + flat-cache "^3.0.4" + file-stream-rotator@^0.5.7: version "0.5.7" resolved "https://registry.npm.taobao.org/file-stream-rotator/download/file-stream-rotator-0.5.7.tgz#868a2e5966f7640a17dd86eda0e4467c089f6286" @@ -317,6 +583,27 @@ find-up@^3.0.0: dependencies: locate-path "^3.0.0" +find-up@^5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/find-up/-/find-up-5.0.0.tgz#4c92819ecb7083561e4f4a240a86be5198f536fc" + integrity sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng== + dependencies: + locate-path "^6.0.0" + path-exists "^4.0.0" + +flat-cache@^3.0.4: + version "3.0.4" + resolved "https://registry.yarnpkg.com/flat-cache/-/flat-cache-3.0.4.tgz#61b0338302b2fe9f957dcc32fc2a87f1c3048b11" + integrity sha512-dm9s5Pw7Jc0GvMYbshN6zchCA9RgQlzzEZX3vylR9IqFfS8XciblUXOKfW6SiuJ0e13eDYZoZV5wdrev7P3Nwg== + dependencies: + flatted "^3.1.0" + rimraf "^3.0.2" + +flatted@^3.1.0: + version "3.2.7" + resolved "https://registry.yarnpkg.com/flatted/-/flatted-3.2.7.tgz#609f39207cb614b89d0765b477cb2d437fbf9787" + integrity sha512-5nqDSxl8nn5BSNxyR3n4I6eDmbolI6WT+QqR547RwxQapgjQBmtktdP+HTBb/a/zLsbzERTONyUB5pefh5TtjQ== + fn.name@1.x.x: version "1.1.0" resolved "https://registry.npm.taobao.org/fn.name/download/fn.name-1.1.0.tgz#26cad8017967aea8731bc42961d04a3d5988accc" @@ -367,6 +654,25 @@ getpass@^0.1.1: dependencies: assert-plus "^1.0.0" +glob-parent@^6.0.2: + version "6.0.2" + resolved "https://registry.yarnpkg.com/glob-parent/-/glob-parent-6.0.2.tgz#6d237d99083950c79290f24c7642a3de9a28f9e3" + integrity sha512-XxwI8EOhVQgWp6iDL+3b0r86f4d6AX6zSU55HfB4ydCEuXLXc5FcYeOu+nnGftS4TEju/11rt4KJPTMgbfmv4A== + dependencies: + is-glob "^4.0.3" + +glob@^7.1.3: + version "7.2.3" + resolved "https://registry.yarnpkg.com/glob/-/glob-7.2.3.tgz#b8df0fb802bbfa8e89bd1d938b4e16578ed44f2b" + integrity sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q== + dependencies: + fs.realpath "^1.0.0" + inflight "^1.0.4" + inherits "2" + minimatch "^3.1.1" + once "^1.3.0" + path-is-absolute "^1.0.0" + glob@^8.0.3: version "8.0.3" resolved "https://mirrors.tencent.com/npm/glob/-/glob-8.0.3.tgz#415c6eb2deed9e502c68fa44a272e6da6eeca42e" @@ -378,6 +684,18 @@ glob@^8.0.3: minimatch "^5.0.1" once "^1.3.0" +globals@^13.19.0: + version "13.20.0" + resolved "https://registry.yarnpkg.com/globals/-/globals-13.20.0.tgz#ea276a1e508ffd4f1612888f9d1bad1e2717bf82" + integrity sha512-Qg5QtVkCy/kv3FUSlu4ukeZDVf9ee0iXLAUYX13gbR17bnejFTzr4iS9bY7kwCf1NztRNm1t91fjOiyx4CSwPQ== + dependencies: + type-fest "^0.20.2" + +graphemer@^1.4.0: + version "1.4.0" + resolved "https://registry.yarnpkg.com/graphemer/-/graphemer-1.4.0.tgz#fb2f1d55e0e3a1849aeffc90c4fa0dd53a0e66c6" + integrity sha512-EtKwoO6kxCL9WO5xipiHTZlSzBm7WLT627TqC/uVRd0HKmq8NXyebnNYxDoBi7wt8eTWrUrKXCOVaFq9x1kgag== + har-schema@^2.0.0: version "2.0.0" resolved "https://registry.npm.taobao.org/har-schema/download/har-schema-2.0.0.tgz#a94c2224ebcac04782a0d9035521f24735b7ec92" @@ -405,6 +723,24 @@ http-signature@~1.2.0: jsprim "^1.2.2" sshpk "^1.7.0" +ignore@^5.2.0: + version "5.2.4" + resolved "https://registry.yarnpkg.com/ignore/-/ignore-5.2.4.tgz#a291c0c6178ff1b960befe47fcdec301674a6324" + integrity sha512-MAb38BcSbH0eHNBxn7ql2NH/kX33OkB3lZ1BNdh7ENeRChHTYsTvWrMubiIAMNS2llXEEgZ1MUOBtXChP3kaFQ== + +import-fresh@^3.0.0, import-fresh@^3.2.1: + version "3.3.0" + resolved "https://registry.yarnpkg.com/import-fresh/-/import-fresh-3.3.0.tgz#37162c25fcb9ebaa2e6e53d5b4d88ce17d9e0c2b" + integrity sha512-veYYhQa+D1QBKznvhUHxb8faxlrwUnxseDAbAp457E0wLNio2bOSKnjYDhMj+YiAq61xrMGhQk9iXVk5FzgQMw== + dependencies: + parent-module "^1.0.0" + resolve-from "^4.0.0" + +imurmurhash@^0.1.4: + version "0.1.4" + resolved "https://registry.yarnpkg.com/imurmurhash/-/imurmurhash-0.1.4.tgz#9218b9b2b928a238b13dc4fb6b6d576f231453ea" + integrity sha512-JmXMZ6wuvDmLiHEml9ykzqO6lwFbof0GG4IkcGaENdCRDDmMVnny7s5HsIgHCbaq0w2MyPhDqkhTUgS2LU2PHA== + inflight@^1.0.4: version "1.0.6" resolved "https://mirrors.tencent.com/npm/inflight/-/inflight-1.0.6.tgz#49bd6331d7d02d0c09bc910a1075ba8165b56df9" @@ -423,16 +759,33 @@ is-arrayish@^0.3.1: resolved "https://registry.npm.taobao.org/is-arrayish/download/is-arrayish-0.3.2.tgz#4574a2ae56f7ab206896fb431eaeed066fdf8f03" integrity sha1-RXSirlb3qyBolvtDHq7tBm/fjwM= +is-extglob@^2.1.1: + version "2.1.1" + resolved "https://registry.yarnpkg.com/is-extglob/-/is-extglob-2.1.1.tgz#a88c02535791f02ed37c76a1b9ea9773c833f8c2" + integrity sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ== + is-fullwidth-code-point@^3.0.0: version "3.0.0" resolved "https://registry.npm.taobao.org/is-fullwidth-code-point/download/is-fullwidth-code-point-3.0.0.tgz#f116f8064fe90b3f7844a38997c0b75051269f1d" integrity sha1-8Rb4Bk/pCz94RKOJl8C3UFEmnx0= +is-glob@^4.0.0, is-glob@^4.0.3: + version "4.0.3" + resolved "https://registry.yarnpkg.com/is-glob/-/is-glob-4.0.3.tgz#64f61e42cbbb2eec2071a9dac0b28ba1e65d5084" + integrity sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg== + dependencies: + is-extglob "^2.1.1" + is-obj@^2.0.0: version "2.0.0" resolved "https://registry.npm.taobao.org/is-obj/download/is-obj-2.0.0.tgz#473fb05d973705e3fd9620545018ca8e22ef4982" integrity sha1-Rz+wXZc3BeP9liBUUBjKjiLvSYI= +is-path-inside@^3.0.3: + version "3.0.3" + resolved "https://registry.yarnpkg.com/is-path-inside/-/is-path-inside-3.0.3.tgz#d231362e53a07ff2b0e0ea7fed049161ffd16283" + integrity sha512-Fd4gABb+ycGAmKou8eMftCupSir5lRxqf4aD/vd0cD2qc4HL07OjCeuHMr8Ro4CoMaeCKDB0/ECBOVWjTwUvPQ== + is-stream@^2.0.0: version "2.0.0" resolved "https://registry.npm.taobao.org/is-stream/download/is-stream-2.0.0.tgz#bde9c32680d6fae04129d6ac9d921ce7815f78e3" @@ -448,11 +801,23 @@ isarray@~1.0.0: resolved "https://registry.npm.taobao.org/isarray/download/isarray-1.0.0.tgz#bb935d48582cba168c06834957a54a3e07124f11" integrity sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE= +isexe@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/isexe/-/isexe-2.0.0.tgz#e8fbf374dc556ff8947a10dcb0572d633f2cfa10" + integrity sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw== + isstream@~0.1.2: version "0.1.2" resolved "https://registry.npm.taobao.org/isstream/download/isstream-0.1.2.tgz#47e63f7af55afa6f92e1500e690eb8b8529c099a" integrity sha1-R+Y/evVa+m+S4VAOaQ64uFKcCZo= +js-yaml@^4.1.0: + version "4.1.0" + resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-4.1.0.tgz#c1fb65f8f5017901cdd2c951864ba18458a10602" + integrity sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA== + dependencies: + argparse "^2.0.1" + jsbn@~0.1.0: version "0.1.1" resolved "https://registry.npm.taobao.org/jsbn/download/jsbn-0.1.1.tgz?cache=0&sync_timestamp=1589682745609&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fjsbn%2Fdownload%2Fjsbn-0.1.1.tgz#a5e654c2e5a2deb5f201d96cefbca80c0ef2f513" @@ -473,6 +838,11 @@ json-schema@0.2.3: resolved "https://registry.npm.taobao.org/json-schema/download/json-schema-0.2.3.tgz#b480c892e59a2f05954ce727bd3f2a4e882f9e13" integrity sha1-tIDIkuWaLwWVTOcnvT8qTogvnhM= +json-stable-stringify-without-jsonify@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz#9db7b59496ad3f3cfef30a75142d2d930ad72651" + integrity sha512-Bdboy+l7tA3OGW6FjyFHWkP5LuByj1Tk33Ljyq0axyzdk9//JSi2u3fP1QSmd1KNwq6VOKYGlAu87CisVir6Pw== + json-stringify-safe@~5.0.1: version "5.0.1" resolved "https://registry.npm.taobao.org/json-stringify-safe/download/json-stringify-safe-5.0.1.tgz?cache=0&sync_timestamp=1589682771374&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fjson-stringify-safe%2Fdownload%2Fjson-stringify-safe-5.0.1.tgz#1296a2d58fd45f19a0f6ce01d65701e2c735b6eb" @@ -498,6 +868,14 @@ kuler@^2.0.0: resolved "https://registry.npm.taobao.org/kuler/download/kuler-2.0.0.tgz#e2c570a3800388fb44407e851531c1d670b061b3" integrity sha1-4sVwo4ADiPtEQH6FFTHB1nCwYbM= +levn@^0.4.1: + version "0.4.1" + resolved "https://registry.yarnpkg.com/levn/-/levn-0.4.1.tgz#ae4562c007473b932a6200d403268dd2fffc6ade" + integrity sha512-+bT2uH4E5LGE7h/n3evcS/sQlJXCpIp6ym8OWJ5eV6+67Dsql/LaaT7qJBAt2rzfoa/5QBGBhxDix1dMt2kQKQ== + dependencies: + prelude-ls "^1.2.1" + type-check "~0.4.0" + locate-path@^3.0.0: version "3.0.0" resolved "https://registry.npm.taobao.org/locate-path/download/locate-path-3.0.0.tgz#dbec3b3ab759758071b58fe59fc41871af21400e" @@ -506,6 +884,18 @@ locate-path@^3.0.0: p-locate "^3.0.0" path-exists "^3.0.0" +locate-path@^6.0.0: + version "6.0.0" + resolved "https://registry.yarnpkg.com/locate-path/-/locate-path-6.0.0.tgz#55321eb309febbc59c4801d931a72452a681d286" + integrity sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw== + dependencies: + p-locate "^5.0.0" + +lodash.merge@^4.6.2: + version "4.6.2" + resolved "https://registry.yarnpkg.com/lodash.merge/-/lodash.merge-4.6.2.tgz#558aa53b43b661e1925a0afdfa36a9a1085fe57a" + integrity sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ== + logform@^2.2.0: version "2.2.0" resolved "https://registry.npm.taobao.org/logform/download/logform-2.2.0.tgz?cache=0&sync_timestamp=1592729921183&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Flogform%2Fdownload%2Flogform-2.2.0.tgz#40f036d19161fc76b68ab50fdc7fe495544492f2" @@ -546,6 +936,13 @@ mimic-fn@^3.0.0: resolved "https://registry.npm.taobao.org/mimic-fn/download/mimic-fn-3.1.0.tgz?cache=0&sync_timestamp=1596095644798&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fmimic-fn%2Fdownload%2Fmimic-fn-3.1.0.tgz#65755145bbf3e36954b949c16450427451d5ca74" integrity sha1-ZXVRRbvz42lUuUnBZFBCdFHVynQ= +minimatch@^3.0.5, minimatch@^3.1.1, minimatch@^3.1.2: + version "3.1.2" + resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.1.2.tgz#19cd194bfd3e428f049a70817c038d89ab4be35b" + integrity sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw== + dependencies: + brace-expansion "^1.1.7" + minimatch@^5.0.1: version "5.1.0" resolved "https://mirrors.tencent.com/npm/minimatch/-/minimatch-5.1.0.tgz#1717b464f4971b144f6aabe8f2d0b8e4511e09c7" @@ -558,11 +955,16 @@ moment@^2.11.2: resolved "https://registry.npm.taobao.org/moment/download/moment-2.29.1.tgz#b2be769fa31940be9eeea6469c075e35006fa3d3" integrity sha1-sr52n6MZQL6e7qZGnAdeNQBvo9M= -ms@^2.1.1: +ms@2.1.2, ms@^2.1.1: version "2.1.2" resolved "https://registry.npm.taobao.org/ms/download/ms-2.1.2.tgz#d09d1f357b443f493382a8eb3ccd183872ae6009" integrity sha1-0J0fNXtEP0kzgqjrPM0YOHKuYAk= +natural-compare@^1.4.0: + version "1.4.0" + resolved "https://registry.yarnpkg.com/natural-compare/-/natural-compare-1.4.0.tgz#4abebfeed7541f2c27acfb29bdbbd15c8d5ba4f7" + integrity sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw== + oauth-sign@~0.9.0: version "0.9.0" resolved "https://registry.npm.taobao.org/oauth-sign/download/oauth-sign-0.9.0.tgz?cache=0&sync_timestamp=1589682811909&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Foauth-sign%2Fdownload%2Foauth-sign-0.9.0.tgz#47a7b016baa68b5fa0ecf3dee08a85c679ac6455" @@ -594,6 +996,18 @@ onetime@^5.1.0: dependencies: mimic-fn "^2.1.0" +optionator@^0.9.3: + version "0.9.3" + resolved "https://registry.yarnpkg.com/optionator/-/optionator-0.9.3.tgz#007397d44ed1872fdc6ed31360190f81814e2c64" + integrity sha512-JjCoypp+jKn1ttEFExxhetCKeJt9zhAgAve5FXHixTvFDW/5aEktX9bufBKLRRMdU7bNtpLfcGu94B3cdEJgjg== + dependencies: + "@aashutoshrathi/word-wrap" "^1.2.3" + deep-is "^0.1.3" + fast-levenshtein "^2.0.6" + levn "^0.4.1" + prelude-ls "^1.2.1" + type-check "^0.4.0" + p-limit@^2.0.0: version "2.3.0" resolved "https://registry.npm.taobao.org/p-limit/download/p-limit-2.3.0.tgz#3dd33c647a214fdfffd835933eb086da0dc21db1" @@ -601,6 +1015,13 @@ p-limit@^2.0.0: dependencies: p-try "^2.0.0" +p-limit@^3.0.2: + version "3.1.0" + resolved "https://registry.yarnpkg.com/p-limit/-/p-limit-3.1.0.tgz#e1daccbe78d0d1388ca18c64fea38e3e57e3706b" + integrity sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ== + dependencies: + yocto-queue "^0.1.0" + p-locate@^3.0.0: version "3.0.0" resolved "https://registry.npm.taobao.org/p-locate/download/p-locate-3.0.0.tgz#322d69a05c0264b25997d9f40cd8a891ab0064a4" @@ -608,16 +1029,45 @@ p-locate@^3.0.0: dependencies: p-limit "^2.0.0" +p-locate@^5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/p-locate/-/p-locate-5.0.0.tgz#83c8315c6785005e3bd021839411c9e110e6d834" + integrity sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw== + dependencies: + p-limit "^3.0.2" + p-try@^2.0.0: version "2.2.0" resolved "https://registry.npm.taobao.org/p-try/download/p-try-2.2.0.tgz#cb2868540e313d61de58fafbe35ce9004d5540e6" integrity sha1-yyhoVA4xPWHeWPr741zpAE1VQOY= +parent-module@^1.0.0: + version "1.0.1" + resolved "https://registry.yarnpkg.com/parent-module/-/parent-module-1.0.1.tgz#691d2709e78c79fae3a156622452d00762caaaa2" + integrity sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g== + dependencies: + callsites "^3.0.0" + path-exists@^3.0.0: version "3.0.0" resolved "https://registry.npm.taobao.org/path-exists/download/path-exists-3.0.0.tgz#ce0ebeaa5f78cb18925ea7d810d7b59b010fd515" integrity sha1-zg6+ql94yxiSXqfYENe1mwEP1RU= +path-exists@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/path-exists/-/path-exists-4.0.0.tgz#513bdbe2d3b95d7762e8c1137efa195c6c61b5b3" + integrity sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w== + +path-is-absolute@^1.0.0: + version "1.0.1" + resolved "https://registry.yarnpkg.com/path-is-absolute/-/path-is-absolute-1.0.1.tgz#174b9268735534ffbc7ace6bf53a5a9e1b5c5f5f" + integrity sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg== + +path-key@^3.1.0: + version "3.1.1" + resolved "https://registry.yarnpkg.com/path-key/-/path-key-3.1.1.tgz#581f6ade658cbba65a0d3380de7753295054f375" + integrity sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q== + performance-now@^2.1.0: version "2.1.0" resolved "https://registry.npm.taobao.org/performance-now/download/performance-now-2.1.0.tgz#6309f4e0e5fa913ec1c69307ae364b4b377c9e7b" @@ -630,6 +1080,11 @@ pkg-up@^3.1.0: dependencies: find-up "^3.0.0" +prelude-ls@^1.2.1: + version "1.2.1" + resolved "https://registry.yarnpkg.com/prelude-ls/-/prelude-ls-1.2.1.tgz#debc6489d7a6e6b0e7611888cec880337d316396" + integrity sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g== + process-nextick-args@~2.0.0: version "2.0.1" resolved "https://registry.npm.taobao.org/process-nextick-args/download/process-nextick-args-2.0.1.tgz#7820d9b16120cc55ca9ae7792680ae7dba6d7fe2" @@ -663,6 +1118,11 @@ qs@~6.5.2: resolved "https://registry.npm.taobao.org/qs/download/qs-6.5.2.tgz#cb3ae806e8740444584ef154ce8ee98d403f3e36" integrity sha1-yzroBuh0BERYTvFUzo7pjUA/PjY= +queue-microtask@^1.2.2: + version "1.2.3" + resolved "https://registry.yarnpkg.com/queue-microtask/-/queue-microtask-1.2.3.tgz#4929228bbc724dfac43e0efb058caf7b6cfb6243" + integrity sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A== + readable-stream@^2.3.7: version "2.3.7" resolved "https://registry.npm.taobao.org/readable-stream/download/readable-stream-2.3.7.tgz?cache=0&sync_timestamp=1589682741447&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Freadable-stream%2Fdownload%2Freadable-stream-2.3.7.tgz#1eca1cf711aef814c04f62252a36a62f6cb23b57" @@ -716,6 +1176,30 @@ require-directory@^2.1.1: resolved "https://registry.npm.taobao.org/require-directory/download/require-directory-2.1.1.tgz#8c64ad5fd30dab1c976e2344ffe7f792a6a6df42" integrity sha1-jGStX9MNqxyXbiNE/+f3kqam30I= +resolve-from@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/resolve-from/-/resolve-from-4.0.0.tgz#4abcd852ad32dd7baabfe9b40e00a36db5f392e6" + integrity sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g== + +reusify@^1.0.4: + version "1.0.4" + resolved "https://registry.yarnpkg.com/reusify/-/reusify-1.0.4.tgz#90da382b1e126efc02146e90845a88db12925d76" + integrity sha512-U9nH88a3fc/ekCF1l0/UP1IosiuIjyTh7hBvXVMHYgVcfGvt897Xguj2UOLDeI5BG2m7/uwyaLVT6fbtCwTyzw== + +rimraf@^3.0.2: + version "3.0.2" + resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-3.0.2.tgz#f1a5402ba6220ad52cc1282bac1ae3aa49fd061a" + integrity sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA== + dependencies: + glob "^7.1.3" + +run-parallel@^1.1.9: + version "1.2.0" + resolved "https://registry.yarnpkg.com/run-parallel/-/run-parallel-1.2.0.tgz#66d1368da7bdf921eb9d95bd1a9229e7f21a43ee" + integrity sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA== + dependencies: + queue-microtask "^1.2.2" + safe-buffer@^5.0.1, safe-buffer@^5.1.2, safe-buffer@~5.2.0: version "5.2.1" resolved "https://registry.npm.taobao.org/safe-buffer/download/safe-buffer-5.2.1.tgz?cache=0&sync_timestamp=1589682795646&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fsafe-buffer%2Fdownload%2Fsafe-buffer-5.2.1.tgz#1eaf9fa9bdb1fdd4ec75f58f9cdb4e6b7827eec6" @@ -746,6 +1230,18 @@ semver@^7.3.2: resolved "https://registry.npm.taobao.org/semver/download/semver-7.3.2.tgz?cache=0&sync_timestamp=1589682805026&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fsemver%2Fdownload%2Fsemver-7.3.2.tgz#604962b052b81ed0786aae84389ffba70ffd3938" integrity sha1-YElisFK4HtB4aq6EOJ/7pw/9OTg= +shebang-command@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/shebang-command/-/shebang-command-2.0.0.tgz#ccd0af4f8835fbdc265b82461aaf0c36663f34ea" + integrity sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA== + dependencies: + shebang-regex "^3.0.0" + +shebang-regex@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/shebang-regex/-/shebang-regex-3.0.0.tgz#ae16f1644d873ecad843b0307b143362d4c42172" + integrity sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A== + simple-swizzle@^0.2.2: version "0.2.2" resolved "https://registry.npm.taobao.org/simple-swizzle/download/simple-swizzle-0.2.2.tgz#a4da6b635ffcccca33f70d17cb92592de95e557a" @@ -813,6 +1309,18 @@ strip-ansi@^6.0.0: dependencies: ansi-regex "^5.0.0" +strip-ansi@^6.0.1: + version "6.0.1" + resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9" + integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A== + dependencies: + ansi-regex "^5.0.1" + +strip-json-comments@^3.1.0, strip-json-comments@^3.1.1: + version "3.1.1" + resolved "https://registry.yarnpkg.com/strip-json-comments/-/strip-json-comments-3.1.1.tgz#31f1281b3832630434831c310c01cccda8cbe006" + integrity sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig== + supports-color@^7.1.0: version "7.2.0" resolved "https://registry.npm.taobao.org/supports-color/download/supports-color-7.2.0.tgz?cache=0&sync_timestamp=1598611709087&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fsupports-color%2Fdownload%2Fsupports-color-7.2.0.tgz#1b7dcdcb32b8138801b3e478ba6a51caa89648da" @@ -825,6 +1333,11 @@ text-hex@1.0.x: resolved "https://registry.npm.taobao.org/text-hex/download/text-hex-1.0.0.tgz#69dc9c1b17446ee79a92bf5b884bb4b9127506f5" integrity sha1-adycGxdEbueakr9biEu0uRJ1BvU= +text-table@^0.2.0: + version "0.2.0" + resolved "https://registry.yarnpkg.com/text-table/-/text-table-0.2.0.tgz#7f5ee823ae805207c00af2df4a84ec3fcfa570b4" + integrity sha512-N+8UisAXDGk8PFXP4HAzVR9nbfmVJ3zYLAWiTIoqC5v5isinhr+r5uaO8+7r3BMfuNIufIsA7RdpVgacC2cSpw== + tough-cookie@~2.5.0: version "2.5.0" resolved "https://registry.npm.taobao.org/tough-cookie/download/tough-cookie-2.5.0.tgz?cache=0&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Ftough-cookie%2Fdownload%2Ftough-cookie-2.5.0.tgz#cd9fb2a0aa1d5a12b473bd9fb96fa3dcff65ade2" @@ -850,6 +1363,18 @@ tweetnacl@^0.14.3, tweetnacl@~0.14.0: resolved "https://registry.npm.taobao.org/tweetnacl/download/tweetnacl-0.14.5.tgz?cache=0&sync_timestamp=1589682745749&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Ftweetnacl%2Fdownload%2Ftweetnacl-0.14.5.tgz#5ae68177f192d4456269d108afa93ff8743f4f64" integrity sha1-WuaBd/GS1EViadEIr6k/+HQ/T2Q= +type-check@^0.4.0, type-check@~0.4.0: + version "0.4.0" + resolved "https://registry.yarnpkg.com/type-check/-/type-check-0.4.0.tgz#07b8203bfa7056c0657050e3ccd2c37730bab8f1" + integrity sha512-XleUoc9uwGXqjWwXaUTZAmzMcFZ5858QA2vvx1Ur5xIcixXIP+8LnFDgRplU30us6teqdlskFfu+ae4K79Ooew== + dependencies: + prelude-ls "^1.2.1" + +type-fest@^0.20.2: + version "0.20.2" + resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-0.20.2.tgz#1bf207f4b28f91583666cb5fbd327887301cd5f4" + integrity sha512-Ne+eE4r0/iWnpAxD852z3A+N0Bt5RN//NjJwRd2VFHEmrywxf5vsZlh4R6lixl6B+wz/8d+maTSAkN1FIkI3LQ== + uri-js@^4.2.2: version "4.4.0" resolved "https://registry.npm.taobao.org/uri-js/download/uri-js-4.4.0.tgz#aa714261de793e8a82347a7bcc9ce74e86f28602" @@ -876,6 +1401,13 @@ verror@1.10.0: core-util-is "1.0.2" extsprintf "^1.2.0" +which@^2.0.1: + version "2.0.2" + resolved "https://registry.yarnpkg.com/which/-/which-2.0.2.tgz#7c6a8dd0a636a0327e10b59c9286eee93f3f51b1" + integrity sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA== + dependencies: + isexe "^2.0.0" + winston-daily-rotate-file@^4.5.0: version "4.5.0" resolved "https://registry.npm.taobao.org/winston-daily-rotate-file/download/winston-daily-rotate-file-4.5.0.tgz#3914ac57c4bdae1138170bec85af0c2217b253b1" @@ -958,3 +1490,8 @@ yargs@^16.0.3: string-width "^4.2.0" y18n "^5.0.2" yargs-parser "^20.2.2" + +yocto-queue@^0.1.0: + version "0.1.0" + resolved "https://registry.yarnpkg.com/yocto-queue/-/yocto-queue-0.1.0.tgz#0294eb3dee05028d31ee1a5fa2c556a6aaf10a1b" + integrity sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q== From 7faff7f0612080b5f18b63893d4d0e5ff06f2261 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=AC=A7=E5=A6=82=E6=A0=8B?= Date: Mon, 3 Jul 2023 15:51:53 +0800 Subject: [PATCH 2/6] =?UTF-8?q?=E6=9B=B4=E6=96=B0=20README?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index d44158f..47ac96c 100644 --- a/README.md +++ b/README.md @@ -11,9 +11,9 @@ npm install coding-generic -g - 推送单个制品 ```shell -coding-generic --username=[:password] --path= --registry= +coding-generic -u=[:password] --path= --registry= ``` - 推送文件夹(仅 1.2.7 及以上版本支持) ```shell -coding-generic -u=coding@coding.com --dir --path= --registry= +coding-generic -u=[:password] --dir --path= --registry= ``` \ No newline at end of file diff --git a/package.json b/package.json index e147922..c43e1a5 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "coding-generic", - "version": "1.2.8", + "version": "1.2.9", "description": "", "main": "index.js", "bin": { From fc5c9b5a16e4f21b688806a97e24a1cd7b054d99 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=AC=A7=E5=A6=82=E6=A0=8B?= Date: Mon, 3 Jul 2023 15:51:53 +0800 Subject: [PATCH 3/6] =?UTF-8?q?=E6=97=A5=E5=BF=97=E8=AE=B0=E5=BD=95?= =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bin/index.js | 23 ++++++++++++++++++----- package.json | 2 +- 2 files changed, 19 insertions(+), 6 deletions(-) diff --git a/bin/index.js b/bin/index.js index 0e1744f..e8811d6 100755 --- a/bin/index.js +++ b/bin/index.js @@ -74,10 +74,12 @@ const upload = async (filePath, parts = [], requestUrl) => { } else { console.log(chalk.red('网络连接异常,请重新执行命令继续上传')); logger.error(`分片(${currentChunkIndex})上传时网络连接异常 (path: ${filePath}) , url: ${requestUrl})`); + await logger.close(); process.exit(1); } } else { console.log(chalk.red((error.response && error.response.data) || error.message)); + await logger.close(); process.exit(1); } } @@ -119,6 +121,7 @@ const upload = async (filePath, parts = [], requestUrl) => { logger.error(error.message); logger.error(error.stack); console.log(chalk(error.message)); + await logger.close(); process.exit(1); } @@ -150,6 +153,7 @@ const upload = async (filePath, parts = [], requestUrl) => { logger.error(error.message); logger.error(error.stack); console.log(chalk.red((error.response && error.response.data) || error.message)); + await logger.close(); process.exit(1); } @@ -169,6 +173,7 @@ const getFileMD5Success = async (filePath, requestUrl) => { Authorization }); if (res.code) { + logger.info(`获取已上传信息错误(1): ${JSON.stringify(res)} (path: ${filePath} , url: ${requestUrl})`); throw (res.message); } uploadId = res.data.uploadId; @@ -181,10 +186,11 @@ const getFileMD5Success = async (filePath, requestUrl) => { uploadedParts = [] } } catch (error) { - logger.error(`获取已上传信息错误 (path: ${filePath} , url: ${requestUrl})`); + logger.error(`获取已上传信息错误(2) (path: ${filePath} , url: ${requestUrl})`); logger.error(error.message); logger.error(error.stack); console.log(chalk.red((error.response && error.response.data) || error.message)); + await logger.close(); process.exit(1); } @@ -227,13 +233,14 @@ const getFileMD5 = async (filePath, requestUrl) => { console.log(chalk.red((error.response && error.response.data) || error.message)); logger.error(error.message); logger.error(error.stack); + await logger.close(); process.exit(1); } } const uploadFile = async (filePath, size, requestUrl) => { fileSize = size; - logger.info(`('************************ 开始上传 (${filePath}) ('************************`); + logger.info(`************************ 开始上传 (${filePath}) ************************`); await getFileMD5(filePath, requestUrl); md5 = ''; uploadId = ''; @@ -262,6 +269,7 @@ const uploadDir = async (dir) => { console.log(chalk.red((error.response && error.response.data) || error.message)); logger.error(error.message); logger.error(error.stack); + await logger.close(); process.exit(1); } else { return files; @@ -290,9 +298,11 @@ const beforeUpload = async (filePath) => { const isDirectory = stat.isDirectory(); if (isDirectory && !isUploadDir) { console.log(chalk.red(`\n${filePath}不合法,需指定一个文件\n`)) + await logger.close(); process.exit(1); } else if (!isDirectory && isUploadDir) { console.log(chalk.red(`\n${filePath}不合法,需指定一个文件夹\n`)) + await logger.close(); process.exit(1); } fSize = stat.size; @@ -304,6 +314,7 @@ const beforeUpload = async (filePath) => { logger.error(error.stack); console.log(chalk.red((error.response && error.response.data) || error.message)); } + await logger.close(); process.exit(1); } if (isUploadDir) { @@ -313,16 +324,18 @@ const beforeUpload = async (filePath) => { } } -const onUpload = (_username, _password) => { +const onUpload = async (_username, _password) => { Authorization = generateAuthorization(_username, _password); logger.info('************************ 准备上传 ************************') if (path.isAbsolute(argv.path)) { - beforeUpload(argv.path); + await beforeUpload(argv.path); } else { - beforeUpload(path.join(process.cwd(), argv.path)) + await beforeUpload(path.join(process.cwd(), argv.path)) } + + await logger.close(); } const [username, password] = argv.username.split(':'); diff --git a/package.json b/package.json index c43e1a5..5a5ba6e 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "coding-generic", - "version": "1.2.9", + "version": "1.2.10", "description": "", "main": "index.js", "bin": { From b776111dd62c81b8b2082941eba5158b2cd21d51 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=AC=A7=E5=A6=82=E6=A0=8B?= Date: Tue, 4 Jul 2023 18:14:11 +0800 Subject: [PATCH 4/6] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=97=A0=E6=B3=95?= =?UTF-8?q?=E8=AE=B0=E5=BD=95=E6=97=A5=E5=BF=97=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bin/index.js | 40 +++++++++++++++++++-------------------- lib/log.js | 5 ++++- lib/request.js | 51 ++++++++++++++++++++++++++++++++++++++------------ package.json | 2 +- 4 files changed, 63 insertions(+), 35 deletions(-) diff --git a/bin/index.js b/bin/index.js index e8811d6..aadf408 100755 --- a/bin/index.js +++ b/bin/index.js @@ -74,13 +74,13 @@ const upload = async (filePath, parts = [], requestUrl) => { } else { console.log(chalk.red('网络连接异常,请重新执行命令继续上传')); logger.error(`分片(${currentChunkIndex})上传时网络连接异常 (path: ${filePath}) , url: ${requestUrl})`); - await logger.close(); - process.exit(1); + await logger.close(() => process.exit(1)); + throw error; } } else { console.log(chalk.red((error.response && error.response.data) || error.message)); - await logger.close(); - process.exit(1); + await logger.close(() => process.exit(1)); + throw error; } } } @@ -121,8 +121,8 @@ const upload = async (filePath, parts = [], requestUrl) => { logger.error(error.message); logger.error(error.stack); console.log(chalk(error.message)); - await logger.close(); - process.exit(1); + await logger.close(() => process.exit(1)); + throw error; } @@ -153,8 +153,8 @@ const upload = async (filePath, parts = [], requestUrl) => { logger.error(error.message); logger.error(error.stack); console.log(chalk.red((error.response && error.response.data) || error.message)); - await logger.close(); - process.exit(1); + await logger.close(() => process.exit(1)); + throw error; } console.log(chalk.green(`\n上传完毕 (${filePath})\n`)) @@ -189,9 +189,9 @@ const getFileMD5Success = async (filePath, requestUrl) => { logger.error(`获取已上传信息错误(2) (path: ${filePath} , url: ${requestUrl})`); logger.error(error.message); logger.error(error.stack); - console.log(chalk.red((error.response && error.response.data) || error.message)); - await logger.close(); - process.exit(1); + console.log(chalk.red((error.response && error.response.data) || error.message), `(path: ${filePath} , url: ${requestUrl}`); + await logger.close(() => process.exit(1)); + throw error; } await upload(filePath, uploadedParts, requestUrl); @@ -233,8 +233,8 @@ const getFileMD5 = async (filePath, requestUrl) => { console.log(chalk.red((error.response && error.response.data) || error.message)); logger.error(error.message); logger.error(error.stack); - await logger.close(); - process.exit(1); + await logger.close(() => process.exit(1)); + throw error; } } @@ -269,8 +269,8 @@ const uploadDir = async (dir) => { console.log(chalk.red((error.response && error.response.data) || error.message)); logger.error(error.message); logger.error(error.stack); - await logger.close(); - process.exit(1); + await logger.close(() => process.exit(1)); + throw error; } else { return files; } @@ -298,12 +298,10 @@ const beforeUpload = async (filePath) => { const isDirectory = stat.isDirectory(); if (isDirectory && !isUploadDir) { console.log(chalk.red(`\n${filePath}不合法,需指定一个文件\n`)) - await logger.close(); - process.exit(1); + await logger.close(() => process.exit(1)); } else if (!isDirectory && isUploadDir) { console.log(chalk.red(`\n${filePath}不合法,需指定一个文件夹\n`)) - await logger.close(); - process.exit(1); + await logger.close(() => process.exit(1)); } fSize = stat.size; } catch (error) { @@ -314,8 +312,8 @@ const beforeUpload = async (filePath) => { logger.error(error.stack); console.log(chalk.red((error.response && error.response.data) || error.message)); } - await logger.close(); - process.exit(1); + await logger.close(() => process.exit(1)); + throw error; } if (isUploadDir) { await uploadDir(filePath); diff --git a/lib/log.js b/lib/log.js index 08ed0fd..c8bf8f8 100644 --- a/lib/log.js +++ b/lib/log.js @@ -1,9 +1,12 @@ const { createLogger, format, transports } = require('winston'); const { combine, timestamp, printf } = format; +const util = require('util') const userHome = process.env.HOME || process.env.USERPROFILE; -const formatLog = printf(({ level, message, timestamp }) => `${timestamp} ${level}: ${JSON.stringify(message)}`); +const formatLog = printf(({ level, message, timestamp }) => { + return `${timestamp} ${level}: ${JSON.stringify(util.inspect(message))}` +}); const transport = new (transports.DailyRotateFile)({ filename: `${userHome}/.coding/log/coding-generic/%DATE%.log`, zippedArchive: true, diff --git a/lib/request.js b/lib/request.js index abfd037..fd1226e 100644 --- a/lib/request.js +++ b/lib/request.js @@ -1,4 +1,35 @@ const axios = require('axios'); +const util = require('util') +const logger = require('./log'); + + +const http = axios.create({ + withCredentials: true, +}) + + +// 响应拦截器 +const responseSuccess = response => { + return Promise.resolve(response) +} + +const responseFailed = error => { + const url = error.config?.url + console.error('网络请求错误', `(${url})`); + logger.error(`网络请求错误 (${url})`); + logger.error(JSON.stringify(util.inspect(error))); + const { response } = error + if (response) { + console.error('网络请求错误', response.data); + logger.error(response.data); + logger.error(response); + + } + return Promise.reject(error) +} +http.interceptors.response.use(responseSuccess, responseFailed) + + /** * 获取已经上传完成的分片信息 @@ -12,10 +43,10 @@ const getExistChunks = (requestUrl, { fileSize, version, fileTag -}, { +}, { Authorization }) => { - return axios.post(`${requestUrl}?version=${version}&fileTag=${fileTag}&fileSize=${fileSize}&action=part-init`, {}, { + return http.post(`${requestUrl}?version=${version}&fileTag=${fileTag}&fileSize=${fileSize}&action=part-init`, {}, { headers: { Authorization } }) } @@ -32,22 +63,18 @@ const getExistChunks = (requestUrl, { * @param {string} Authorization */ const uploadChunk = (requestUrl, { - uploadId, + uploadId, version, - partNumber, - size, + partNumber, + size, currentChunk, }, { headers, Authorization }) => { - return axios({ + return http.post(`${requestUrl}?version=${version}&uploadId=${uploadId}&partNumber=${partNumber}&size=${size}&action=part-upload`, currentChunk, { maxContentLength: Infinity, - maxBodyLength: Infinity, - method: 'post', - url: `${requestUrl}?version=${version}&uploadId=${uploadId}&partNumber=${partNumber}&size=${size}&action=part-upload`, - data: currentChunk, - headers: { Authorization, ...headers } + maxBodyLength: Infinity, headers: { Authorization, ...headers } }) } @@ -68,7 +95,7 @@ const mergeAllChunks = (requestUrl, { }, { Authorization }) => { - return axios.post(`${requestUrl}?version=${version}&uploadId=${uploadId}&fileTag=${fileTag}&size=${fileSize}&action=part-complete`, {}, { + return http.post(`${requestUrl}?version=${version}&uploadId=${uploadId}&fileTag=${fileTag}&size=${fileSize}&action=part-complete`, {}, { headers: { Authorization } }) } diff --git a/package.json b/package.json index 5a5ba6e..3042290 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "coding-generic", - "version": "1.2.10", + "version": "1.2.11", "description": "", "main": "index.js", "bin": { From 2e7ba931ea6b577cf4f7bb0efa565890018fa33f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=AC=A7=E5=A6=82=E6=A0=8B?= Date: Wed, 5 Jul 2023 10:30:45 +0800 Subject: [PATCH 5/6] =?UTF-8?q?=E8=AF=AD=E6=B3=95=E5=85=BC=E5=AE=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/request.js | 2 +- package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/request.js b/lib/request.js index fd1226e..30a3681 100644 --- a/lib/request.js +++ b/lib/request.js @@ -14,7 +14,7 @@ const responseSuccess = response => { } const responseFailed = error => { - const url = error.config?.url + const url = error && error.config && error.config.url console.error('网络请求错误', `(${url})`); logger.error(`网络请求错误 (${url})`); logger.error(JSON.stringify(util.inspect(error))); diff --git a/package.json b/package.json index 3042290..6686fb2 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "coding-generic", - "version": "1.2.11", + "version": "1.2.12", "description": "", "main": "index.js", "bin": { From 7673b7c7696b98f3a2fc0ae7f7d18a5c3ce589fe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=AC=A7=E5=A6=82=E6=A0=8B?= Date: Fri, 20 Oct 2023 15:59:32 +0800 Subject: [PATCH 6/6] =?UTF-8?q?=E6=94=AF=E6=8C=81=E4=B8=8B=E8=BD=BD?= =?UTF-8?q?=E6=96=87=E4=BB=B6=E5=A4=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 5 +++++ bin/index.js | 12 +++++++++-- lib/argv.js | 7 ++++++- lib/download.js | 54 +++++++++++++++++++++++++++++++++++++++++++++++++ lib/request.js | 33 ++++++++++++++++++++++++++++-- lib/utils.js | 3 ++- package.json | 2 +- 7 files changed, 109 insertions(+), 7 deletions(-) create mode 100644 lib/download.js diff --git a/README.md b/README.md index 47ac96c..f38d2bf 100644 --- a/README.md +++ b/README.md @@ -16,4 +16,9 @@ coding-generic -u=[:password] --path= --registry=[:password] --dir --path= --registry= +``` + +- 下载文件夹(仅 1.2.13 及以上版本支持) +```shell +coding-generic --pull -u=[:password] --registry=/list/?version= ``` \ No newline at end of file diff --git a/bin/index.js b/bin/index.js index aadf408..758580c 100755 --- a/bin/index.js +++ b/bin/index.js @@ -18,6 +18,7 @@ const { getExistChunks: _getExistChunks, uploadChunk: _uploadChunk, mergeAllChun const { withRetry } = require('../lib/withRetry'); const argv = require('../lib/argv'); +const { onDownload } = require('../lib/download'); const { requestUrl, version } = getRegistryInfo(argv.registry); @@ -339,7 +340,11 @@ const onUpload = async (_username, _password) => { const [username, password] = argv.username.split(':'); if (username && password) { - onUpload(username, password); + if (argv.pull) { + onDownload() + } else { + onUpload(username, password); + } } else { prompts([ { @@ -353,7 +358,10 @@ if (username && password) { ).then(async (answers) => { if (!answers.password) { return; + } if (argv.pull) { + onDownload() + } else { + onUpload(argv.username, answers.password); } - onUpload(argv.username, answers.password); }) } diff --git a/lib/argv.js b/lib/argv.js index 3f4939c..e76b8ea 100644 --- a/lib/argv.js +++ b/lib/argv.js @@ -1,6 +1,7 @@ const argv = require('yargs') .usage('上传文件: coding-generic --username=[:PASSWORD] --path= --registry=') .usage('上传文件夹: coding-generic --username=[:PASSWORD] --dir --path= --registry=') + .usage('下载文件夹: coding-generic --pull --username=[:PASSWORD] --registry=/list/?version=') .options({ username: { alias: 'u', @@ -10,7 +11,7 @@ const argv = require('yargs') path: { alias: 'p', describe: '需要上传的文件路径', - demandOption: true + // demandOption: true }, registry: { alias: 'r', @@ -27,6 +28,10 @@ const argv = require('yargs') alias: 'd', describe: '上传文件夹', boolean: true, + }, + pull: { + describe: '下载', + boolean: true, } }) .alias('version', 'v') diff --git a/lib/download.js b/lib/download.js new file mode 100644 index 0000000..a2a6f47 --- /dev/null +++ b/lib/download.js @@ -0,0 +1,54 @@ +const fs = require('fs'); +const path = require('path'); +const logger = require('./log'); +const { generateAuthorization, getRegistryInfo } = require('./utils'); +const { fetchDownloadList, downloadFile } = require('../lib/request'); +const argv = require('./argv'); + +const { version, host, protocol, pathname } = getRegistryInfo(argv.registry); + +let Authorization = ''; + +const onDownload = async () => { + console.log('************************ 准备下载 ************************'); + logger.info('************************ 准备下载 ************************'); + Authorization = generateAuthorization(argv.username, argv.password); + const res = await fetchDownloadList(argv.registry, Authorization) + const { status, fileInfos = [] } = res.data + if (status === 200) { + await downloadFiles(fileInfos) + console.log('************************ 下载完毕 ************************'); + logger.info('************************ 下载完毕 ************************'); + } +} + +const downloadFiles = async (fileInfos = []) => { + try { + return await Promise.all(fileInfos.map(async info => { + console.log(`正在下载 ${info.fileName} ...`); + logger.info(`正在下载 ${info.fileName} ...`); + const p = path.join(process.cwd(), info.fileName); + const dir = p.split('/').slice(0, -1).join('/'); + if (dir && !fs.existsSync(dir)) { + fs.mkdirSync(dir); + } + const writer = fs.createWriteStream(p); + const url = `${protocol}//${path.join(host, path.join(pathname.split('/').slice(0, -2).join('/'), info.fileName))}` + const res = await downloadFile(url, { version }, Authorization); + await res.data.pipe(writer) + await writer.end(); + await writer.close(); + console.log(`下载 ${info.fileName} 完成`); + logger.info(`下载 ${info.fileName} 完成`); + })); + } catch (error) { + console.log(error); + logger.error(error); + throw error; + } + +} + +module.exports = { + onDownload +} \ No newline at end of file diff --git a/lib/request.js b/lib/request.js index 30a3681..8f8a4f0 100644 --- a/lib/request.js +++ b/lib/request.js @@ -14,6 +14,7 @@ const responseSuccess = response => { } const responseFailed = error => { + console.log('eeee=>', error) const url = error && error.config && error.config.url console.error('网络请求错误', `(${url})`); logger.error(`网络请求错误 (${url})`); @@ -100,8 +101,36 @@ const mergeAllChunks = (requestUrl, { }) } + +const fetchDownloadList = async (registry, Authorization) => { + return http.post(registry, { + }, { + headers: { Authorization } + }) + +} + +//http:/codingcorp-generic.pkg.coding-artifacts.test-codingcorp.woa.com/coding-xxx-567023e/generic-public/test/coding-coding +//http://codingcorp-generic.pkg.coding-artifacts.test-codingcorp.woa.com/coding-xxx-567023e/generic-public/test/coding-coding + +const downloadFile = async (url, params, Authorization) => { + return axios.get(url, { + params, + headers: { + Authorization + }, + responseType: 'stream' + }); + +} + + module.exports = { getExistChunks, uploadChunk, - mergeAllChunks -} \ No newline at end of file + mergeAllChunks, + fetchDownloadList, + downloadFile +} + + diff --git a/lib/utils.js b/lib/utils.js index 91ffcae..eea611d 100644 --- a/lib/utils.js +++ b/lib/utils.js @@ -23,7 +23,8 @@ const getRegistryInfo = (registry) => { const { version } = querystring.parse(query) return { requestUrl: `${protocol}//${path.join(host, pathname)}`, - version: !version || version === '' ? 'latest' : version + version: !version || version === '' ? 'latest' : version, + host, protocol, pathname } } diff --git a/package.json b/package.json index 6686fb2..2082296 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "coding-generic", - "version": "1.2.12", + "version": "1.2.13", "description": "", "main": "index.js", "bin": {