mine-auto-cli 2.3.0 → 2.3.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/package.json +2 -2
- package/src/commander/commands/check.ts +13 -13
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mine-auto-cli",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "2.3.
|
|
4
|
+
"version": "2.3.1",
|
|
5
5
|
"exports": "./dist/index.js",
|
|
6
6
|
"main": "./dist/index.js",
|
|
7
7
|
"type": "module",
|
|
@@ -67,4 +67,4 @@
|
|
|
67
67
|
"typescript": "^5.4.5",
|
|
68
68
|
"vite": "^5.2.10"
|
|
69
69
|
}
|
|
70
|
-
}
|
|
70
|
+
}
|
|
@@ -50,15 +50,17 @@ const progressLog = (progress: number, total: number) => {
|
|
|
50
50
|
const getVersionLog = (name: string, value: string, distTags: NPMResponse['dist-tags']) => {
|
|
51
51
|
let tag = 'latest'
|
|
52
52
|
defaultConfig.resolve.some(item => {
|
|
53
|
-
const
|
|
53
|
+
const spaceIndex = item.lastIndexOf('@')
|
|
54
|
+
if (spaceIndex <= 0) return true
|
|
55
|
+
const curName = item.slice(0, spaceIndex)
|
|
56
|
+
const curTag = item.slice(spaceIndex + 1)
|
|
54
57
|
if (name === curName) {
|
|
55
58
|
tag = curTag
|
|
56
59
|
return true
|
|
57
60
|
}
|
|
58
61
|
})
|
|
59
62
|
const newVersion = defaultConfig.prefix + distTags[tag]
|
|
60
|
-
|
|
61
|
-
return { text: { name, value, newVersion, tag }, newVersion }
|
|
63
|
+
return { name, value, newVersion, tag }
|
|
62
64
|
}
|
|
63
65
|
|
|
64
66
|
/**
|
|
@@ -77,19 +79,17 @@ const getValueLength = (value: string, i: number) => (+!i + 1) * value.length
|
|
|
77
79
|
export const formatterVersion = (oldVersion: string, newVersion: string): string | false => {
|
|
78
80
|
const oldV = oldVersion.match(/\d.+/g)![0].split('.')
|
|
79
81
|
const newV = newVersion.match(/\d.+/g)![0].split('.')
|
|
80
|
-
const index = newV.findIndex((item, i) => +item > +oldV[i])
|
|
81
|
-
|
|
82
|
+
const index = newV.slice(0, -1).findIndex((item, i) => +item > +oldV[i])
|
|
82
83
|
const mainName = defaultConfig.prefix + newV[0]
|
|
83
|
-
|
|
84
84
|
switch (index) {
|
|
85
85
|
case 0:
|
|
86
86
|
return chalk.red(newVersion)
|
|
87
87
|
case 1:
|
|
88
88
|
return `${mainName}.${chalk.yellow(newV[1])}.${chalk.yellow(newV[2])}`
|
|
89
|
-
case 2:
|
|
90
|
-
return `${mainName}.${newV[1]}.${chalk.green(newV[2])}`
|
|
91
89
|
default:
|
|
92
|
-
|
|
90
|
+
const oldVLast = oldV.at(-1) as string
|
|
91
|
+
const newVLast = newV.at(-1) as string
|
|
92
|
+
return oldVLast !== newVLast && parseInt(newVLast) >= parseInt(oldVLast) ? `${mainName}.${newV[1]}.${chalk.green(newV[2])}` : false
|
|
93
93
|
}
|
|
94
94
|
}
|
|
95
95
|
|
|
@@ -126,7 +126,7 @@ const outVersionLog = (versionLogs: VersionLog[]) => {
|
|
|
126
126
|
spacer = ' '
|
|
127
127
|
}
|
|
128
128
|
|
|
129
|
-
const text = `${name + nameSpace}
|
|
129
|
+
const text = `${name + nameSpace} ${valueSpace + value} ${spacer} ${newVersionSpace + newVersion} ${tagSpace + tag}`
|
|
130
130
|
showLog && outLog.push(text)
|
|
131
131
|
})
|
|
132
132
|
if (outLog.length > 1) {
|
|
@@ -156,15 +156,15 @@ const taskProgress = async (allPackages: Record<string, string>, keys: string[],
|
|
|
156
156
|
/**
|
|
157
157
|
* 获取日志信息
|
|
158
158
|
*/
|
|
159
|
-
const
|
|
160
|
-
versionLogs.push(
|
|
159
|
+
const logItem = getVersionLog(name, value, data['dist-tags'])
|
|
160
|
+
versionLogs.push(logItem)
|
|
161
161
|
|
|
162
162
|
/**
|
|
163
163
|
* 收集新包信息
|
|
164
164
|
*/
|
|
165
165
|
keys.forEach(key => {
|
|
166
166
|
const item = newPackages[key]
|
|
167
|
-
item && item[name] && (item[name] = newVersion)
|
|
167
|
+
item && item[name] && (item[name] = logItem.newVersion)
|
|
168
168
|
})
|
|
169
169
|
|
|
170
170
|
/**
|