@fanwang/pack-util 2.0.0 → 2.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -1
- package/bin/index.js +11 -7
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -21,8 +21,9 @@ npm install -g @fanwang/pack-util
|
|
|
21
21
|
Set-ExecutionPolicy RemoteSigned
|
|
22
22
|
```
|
|
23
23
|
|
|
24
|
-
|
|
24
|
+
建议先将源仓库设为阿里镜像仓库,这样打包速度更快(yarn 和 npm 需要同时设置):
|
|
25
25
|
```sh
|
|
26
|
+
yarn config set registry https://registry.npmmirror.com
|
|
26
27
|
npm config set registry https://registry.npmmirror.com
|
|
27
28
|
```
|
|
28
29
|
|
package/bin/index.js
CHANGED
|
@@ -12,7 +12,7 @@ const program = new Command()
|
|
|
12
12
|
program
|
|
13
13
|
.name('pack-util')
|
|
14
14
|
.description('Pack all installed package in ./node_modules, and publish to Nexus self-hosted Registry.')
|
|
15
|
-
.version('2.0.
|
|
15
|
+
.version('2.0.1')
|
|
16
16
|
|
|
17
17
|
const getPackageInfos = async (packageManager) => {
|
|
18
18
|
if (packageManager === 'yarn') {
|
|
@@ -52,14 +52,18 @@ const packPackage = async (packageName) => {
|
|
|
52
52
|
const downloadPackage = async (packageUrl) => {
|
|
53
53
|
const urlObj = url.parse(packageUrl)
|
|
54
54
|
const filename = urlObj.pathname.substring(urlObj.pathname.lastIndexOf('/') + 1)
|
|
55
|
+
const fileStream = createWriteStream('./node_modules_pack/' + filename)
|
|
55
56
|
await fetch(packageUrl).then(res => {
|
|
56
|
-
res.body.pipe(
|
|
57
|
+
res.body.pipe(fileStream)
|
|
58
|
+
})
|
|
59
|
+
fileStream.on('finish', () => {
|
|
60
|
+
fileStream.close()
|
|
61
|
+
index++
|
|
62
|
+
process.stdout.clearLine()
|
|
63
|
+
process.stdout.cursorTo(0)
|
|
64
|
+
process.stdout.write(`${index}: ${filename}`) // 在同一行打印处理进度
|
|
65
|
+
return filename
|
|
57
66
|
})
|
|
58
|
-
index++
|
|
59
|
-
process.stdout.clearLine()
|
|
60
|
-
process.stdout.cursorTo(0)
|
|
61
|
-
process.stdout.write(`${index}: ${filename}`) // 在同一行打印处理进度
|
|
62
|
-
return filename
|
|
63
67
|
}
|
|
64
68
|
|
|
65
69
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fanwang/pack-util",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.1",
|
|
4
4
|
"description": "Pack all installed package in ./node_modules, and publish to Nexus self-hosted Registry.",
|
|
5
5
|
"bin": {
|
|
6
6
|
"pack-util": "./bin/index.js"
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
"access": "public"
|
|
10
10
|
},
|
|
11
11
|
"engines": {
|
|
12
|
-
"node": ">=
|
|
12
|
+
"node": ">= 16.17.0"
|
|
13
13
|
},
|
|
14
14
|
"type": "module",
|
|
15
15
|
"scripts": {
|