@simonyea/holysheep-cli 1.1.5 → 1.1.6
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 -2
- package/package.json +1 -1
- package/src/index.js +29 -0
package/README.md
CHANGED
|
@@ -58,7 +58,7 @@ npm install -g @simonyea/holysheep-cli
|
|
|
58
58
|
No npm? Try npx (no install needed):
|
|
59
59
|
|
|
60
60
|
```bash
|
|
61
|
-
npx @simonyea/holysheep-cli setup
|
|
61
|
+
npx @simonyea/holysheep-cli@latest setup
|
|
62
62
|
```
|
|
63
63
|
|
|
64
64
|
### Quick Start
|
|
@@ -152,7 +152,7 @@ npm install -g @simonyea/holysheep-cli
|
|
|
152
152
|
没有 npm?用 npx 免安装直接运行:
|
|
153
153
|
|
|
154
154
|
```bash
|
|
155
|
-
npx @simonyea/holysheep-cli setup
|
|
155
|
+
npx @simonyea/holysheep-cli@latest setup
|
|
156
156
|
```
|
|
157
157
|
|
|
158
158
|
### 快速开始
|
package/package.json
CHANGED
package/src/index.js
CHANGED
|
@@ -13,6 +13,34 @@ if (process.platform === 'win32') {
|
|
|
13
13
|
} catch {}
|
|
14
14
|
}
|
|
15
15
|
|
|
16
|
+
// 异步检查最新版本(不阻塞主流程)
|
|
17
|
+
function checkLatestVersion() {
|
|
18
|
+
try {
|
|
19
|
+
const https = require('https')
|
|
20
|
+
const req = https.get(
|
|
21
|
+
`https://registry.npmjs.org/@simonyea/holysheep-cli/latest`,
|
|
22
|
+
{ timeout: 3000 },
|
|
23
|
+
(res) => {
|
|
24
|
+
let data = ''
|
|
25
|
+
res.on('data', chunk => { data += chunk })
|
|
26
|
+
res.on('end', () => {
|
|
27
|
+
try {
|
|
28
|
+
const latest = JSON.parse(data).version
|
|
29
|
+
if (latest && latest !== pkg.version) {
|
|
30
|
+
console.log()
|
|
31
|
+
console.log(chalk.yellow(`⚠️ 发现新版本 v${latest}(当前 v${pkg.version})`))
|
|
32
|
+
console.log(chalk.cyan(` 建议运行: npx @simonyea/holysheep-cli@latest setup`))
|
|
33
|
+
console.log(chalk.gray(` 或更新: npm install -g @simonyea/holysheep-cli@latest`))
|
|
34
|
+
}
|
|
35
|
+
} catch {}
|
|
36
|
+
})
|
|
37
|
+
}
|
|
38
|
+
)
|
|
39
|
+
req.on('error', () => {})
|
|
40
|
+
req.setTimeout(3000, () => req.destroy())
|
|
41
|
+
} catch {}
|
|
42
|
+
}
|
|
43
|
+
|
|
16
44
|
// Banner
|
|
17
45
|
function printBanner() {
|
|
18
46
|
console.log()
|
|
@@ -66,6 +94,7 @@ program
|
|
|
66
94
|
.option('-a, --all', '配置所有已安装的工具(跳过选择)')
|
|
67
95
|
.action(async (opts) => {
|
|
68
96
|
printBanner()
|
|
97
|
+
checkLatestVersion() // 异步检查版本,不阻塞
|
|
69
98
|
await require('./commands/setup')(opts)
|
|
70
99
|
})
|
|
71
100
|
|