@fanwang/pack-util 3.2.1 → 3.2.3

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/bin/index.js CHANGED
@@ -16,7 +16,7 @@ const program = new Command()
16
16
  program
17
17
  .name('pack-util')
18
18
  .description('Pack all installed package in ./node_modules, and publish to Nexus self-hosted Registry.')
19
- .version('3.2.1')
19
+ .version('3.2.3')
20
20
 
21
21
  const limit = pLimit(10)
22
22
  async function getPackageInfos(packageManager) {
@@ -91,7 +91,14 @@ async function packPackage(packageName) {
91
91
  // 直接利用依赖包的下载地址进行下载
92
92
  async function downloadPackage(packageUrl) {
93
93
  const urlObj = new url.URL(packageUrl)
94
- const filename = urlObj.pathname.substring(urlObj.pathname.lastIndexOf('/') + 1)
94
+ let filename = urlObj.pathname.substring(urlObj.pathname.lastIndexOf('/') + 1)
95
+
96
+ // 使用正则表达式提取命名空间,并添加在文件名前面
97
+ const namespaceMatch = urlObj.pathname.match(/@([^/]+)/)
98
+ if (namespaceMatch) {
99
+ filename = `${namespaceMatch[1]}-${filename}`
100
+ }
101
+
95
102
  const fileStream = createWriteStream(`./node_modules_pack/${filename}`)
96
103
  let res
97
104
  try {
Binary file
package/package.json CHANGED
@@ -1,46 +1,46 @@
1
- {
2
- "name": "@fanwang/pack-util",
3
- "version": "3.2.1",
4
- "description": "Pack all installed package in ./node_modules, and publish to Nexus self-hosted Registry.",
5
- "bin": {
6
- "pack-util": "./bin/index.js"
7
- },
8
- "publishConfig": {
9
- "access": "public"
10
- },
11
- "engines": {
12
- "node": ">= 16.17.0"
13
- },
14
- "type": "module",
15
- "scripts": {
16
- "test": "node bin/index.js pack",
17
- "commit": "git add . && czg && git push",
18
- "release": "bumpp package.json bin/index.js"
19
- },
20
- "repository": {
21
- "type": "git",
22
- "url": "https://github.com/vampirefan/pack-util.git"
23
- },
24
- "keywords": [
25
- "npm",
26
- "pack",
27
- "publish"
28
- ],
29
- "author": "fanwang",
30
- "license": "MIT",
31
- "dependencies": {
32
- "commander": "^9.5.0",
33
- "execa": "^9.4.0",
34
- "form-data": "^4.0.0",
35
- "inquirer": "^9.3.7",
36
- "node-fetch": "^3.3.2",
37
- "p-limit": "^6.1.0",
38
- "yaml": "^2.5.1"
39
- },
40
- "devDependencies": {
41
- "@antfu/eslint-config": "^3.7.3",
42
- "bumpp": "^9.6.1",
43
- "czg": "^1.10.1",
44
- "taze": "^0.17.2"
45
- }
46
- }
1
+ {
2
+ "name": "@fanwang/pack-util",
3
+ "type": "module",
4
+ "version": "3.2.3",
5
+ "description": "Pack all installed package in ./node_modules, and publish to Nexus self-hosted Registry.",
6
+ "author": "fanwang",
7
+ "license": "MIT",
8
+ "repository": {
9
+ "type": "git",
10
+ "url": "https://github.com/vampirefan/pack-util.git"
11
+ },
12
+ "keywords": [
13
+ "npm",
14
+ "pack",
15
+ "publish"
16
+ ],
17
+ "bin": {
18
+ "pack-util": "./bin/index.js"
19
+ },
20
+ "publishConfig": {
21
+ "access": "public"
22
+ },
23
+ "engines": {
24
+ "node": ">= 16.17.0"
25
+ },
26
+ "scripts": {
27
+ "test": "node bin/index.js pack",
28
+ "commit": "git add . && czg && git push",
29
+ "release": "bumpp package.json bin/index.js"
30
+ },
31
+ "dependencies": {
32
+ "commander": "9.5.0",
33
+ "execa": "9.4.0",
34
+ "form-data": "4.0.0",
35
+ "inquirer": "9.3.7",
36
+ "node-fetch": "3.3.2",
37
+ "p-limit": "6.1.0",
38
+ "yaml": "2.5.1"
39
+ },
40
+ "devDependencies": {
41
+ "@antfu/eslint-config": "3.7.3",
42
+ "bumpp": "9.6.1",
43
+ "czg": "1.10.1",
44
+ "taze": "0.17.2"
45
+ }
46
+ }