@zzclub/z-cli 0.5.1 → 0.5.2

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,18 @@
1
1
  # Changelog
2
2
 
3
3
 
4
+ ## v0.5.2
5
+
6
+ [compare changes](https://github.com/aatrooox/z-cli/compare/v0.5.1...v0.5.2)
7
+
8
+ ### 🩹 Fixes
9
+
10
+ - 翻译功能bug ([603625c](https://github.com/aatrooox/z-cli/commit/603625c))
11
+
12
+ ### ❤️ Contributors
13
+
14
+ - Aatrox <gnakzz@qq.com>
15
+
4
16
  ## v0.5.1
5
17
 
6
18
  [compare changes](https://github.com/aatrooox/z-cli/compare/v0.5.0...v0.5.1)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zzclub/z-cli",
3
- "version": "0.5.1",
3
+ "version": "0.5.2",
4
4
  "description": "all-in-one 工具箱,专为提升日常及工作效率而生",
5
5
  "main": "src/index.js",
6
6
  "type": "module",
@@ -172,6 +172,10 @@ function startTranslate(limitedWords, cb) {
172
172
  let translate_result = res.trans_result
173
173
  ? res.trans_result[0].dst
174
174
  : word.value;
175
+ if (res.error_code) {
176
+ const spinner = ora();
177
+ spinner.warn('翻译出错:' + JSON.stringify(res))
178
+ }
175
179
  word.value = translate_result;
176
180
  });
177
181
  curIndex++;
@@ -4,13 +4,14 @@ import { readJsonFile } from "../utils/file.js";
4
4
  import axios from "axios";
5
5
  import { dirname } from "node:path"
6
6
  import { fileURLToPath } from "node:url"
7
+ import { getLocalConfig } from "../utils/common.js";
7
8
 
8
9
  const __filename = fileURLToPath(import.meta.url);
9
10
  const __dirname = dirname(__filename);
10
11
  let salt = new Date().getTime();
11
12
  let appid, key;
12
13
  async function genUser() {
13
- let config = await readJsonFile(path.resolve(__dirname, "../config.json"));
14
+ let config = await getLocalConfig();
14
15
  let translateConfig = config.translate;
15
16
  appid = translateConfig.account.appId; // appid
16
17
  key = translateConfig.account.key; // 密钥