@zzclub/z-cli 0.5.2 → 0.5.4

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/CHANGELOG.md CHANGED
@@ -1,6 +1,30 @@
1
1
  # Changelog
2
2
 
3
3
 
4
+ ## v0.5.4
5
+
6
+ [compare changes](https://github.com/aatrooox/z-cli/compare/v0.5.3...v0.5.4)
7
+
8
+ ### 🚀 Enhancements
9
+
10
+ - 增加node版本提示 ([5eb02cb](https://github.com/aatrooox/z-cli/commit/5eb02cb))
11
+
12
+ ### ❤️ Contributors
13
+
14
+ - Aatrox <gnakzz@qq.com>
15
+
16
+ ## v0.5.3
17
+
18
+ [compare changes](https://github.com/aatrooox/z-cli/compare/v0.5.2...v0.5.3)
19
+
20
+ ### 🩹 Fixes
21
+
22
+ - 优化提示 ([5d8e6f6](https://github.com/aatrooox/z-cli/commit/5d8e6f6))
23
+
24
+ ### ❤️ Contributors
25
+
26
+ - Aatrox <gnakzz@qq.com>
27
+
4
28
  ## v0.5.2
5
29
 
6
30
  [compare changes](https://github.com/aatrooox/z-cli/compare/v0.5.1...v0.5.2)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zzclub/z-cli",
3
- "version": "0.5.2",
3
+ "version": "0.5.4",
4
4
  "description": "all-in-one 工具箱,专为提升日常及工作效率而生",
5
5
  "main": "src/index.js",
6
6
  "type": "module",
@@ -174,7 +174,7 @@ function startTranslate(limitedWords, cb) {
174
174
  : word.value;
175
175
  if (res.error_code) {
176
176
  const spinner = ora();
177
- spinner.warn('翻译出错:' + JSON.stringify(res))
177
+ spinner.warn(`翻译[${word.value}]时出错:` + JSON.stringify(res))
178
178
  }
179
179
  word.value = translate_result;
180
180
  });
package/src/index.js CHANGED
@@ -7,11 +7,12 @@ import { configCmd } from "./command/config.js";
7
7
  import { setCmd } from "./command/set.js";
8
8
  import { tinyCmd } from "./command/tiny.js";
9
9
  import { picgoCmd } from "./command/picgo.js";
10
- import { checkUpdate } from './utils/common.js'
10
+ import { checkUpdate, checkNodeVersion } from './utils/common.js'
11
11
  import { i18nCmd } from "./command/i18n.js";
12
12
  const program = new Command();
13
13
 
14
14
  initProgram(program, async () => {
15
+ checkNodeVersion()
15
16
  await checkUpdate()
16
17
  registerCommand(program, translateCmd);
17
18
 
@@ -198,3 +198,21 @@ export async function checkUpdate() {
198
198
  // 静默处理错误
199
199
  }
200
200
  }
201
+
202
+
203
+ export async function checkNodeVersion() {
204
+ const currentNodeVersion = process.versions.node;
205
+ const semver = currentNodeVersion.split('.');
206
+ const major = parseInt(semver[0], 10);
207
+ const minor = parseInt(semver[1], 10);
208
+
209
+ if (major < 18 || (major === 18 && minor < 18)) {
210
+ console.error(
211
+ chalk.red('\n❌ Node版本过低:') +
212
+ chalk.yellow('建议升级到 ') +
213
+ chalk.green('18.18.0') +
214
+ chalk.yellow(' 或更高版本。\n') +
215
+ chalk.gray('当前版本:') + chalk.red(currentNodeVersion)
216
+ );
217
+ }
218
+ }