cc-translate 0.5.8 → 0.5.9

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/index.js CHANGED
@@ -244,7 +244,6 @@ export class CwalletTranslate {
244
244
  folderName: this.CACHE_ROOT_PATH,
245
245
  });
246
246
  });
247
- checkEnvNodeVersion();
248
247
  this.OPENAI_KEY = params.key;
249
248
  this.CACHE_ROOT_PATH = params.cacheFileRootPath;
250
249
  this.ENTRY_ROOT_PATH = params.fileRootPath;
@@ -253,6 +252,7 @@ export class CwalletTranslate {
253
252
  this.OUTPUT_ROOT_PATH = params.outputRootPath;
254
253
  this.fineTune = params.fineTune;
255
254
  this.languages = (_c = params.languages) !== null && _c !== void 0 ? _c : [];
255
+ checkEnvNodeVersion();
256
256
  this.createOpenAIClient();
257
257
  }
258
258
  get supportLanguages() {
package/lib/utils.js CHANGED
@@ -110,7 +110,7 @@ export const dequeue = (queue) => __awaiter(void 0, void 0, void 0, function* ()
110
110
  }
111
111
  }
112
112
  });
113
- const REQUIRED_VERSION = ">=20.12.1";
113
+ const REQUIRED_VERSION = ">=18.16.0";
114
114
  export const checkEnvNodeVersion = () => {
115
115
  // 检查当前 Node.js 版本
116
116
  if (!semver.satisfies(process.version, REQUIRED_VERSION)) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cc-translate",
3
- "version": "0.5.8",
3
+ "version": "0.5.9",
4
4
  "description": "A language translation tool based on OpenAI",
5
5
  "author": "maybe",
6
6
  "type": "module",
package/src/index.ts CHANGED
@@ -14,7 +14,6 @@ import {
14
14
  SupportLanguageType,
15
15
  } from "./types";
16
16
  import {
17
- checkEnvNodeVersion,
18
17
  dequeue,
19
18
  getRandomNumber,
20
19
  notExistsToCreateFile,
@@ -60,7 +59,6 @@ export class CwalletTranslate {
60
59
  this.OUTPUT_ROOT_PATH = params.outputRootPath;
61
60
  this.fineTune = params.fineTune;
62
61
  this.languages = params.languages ?? [];
63
- checkEnvNodeVersion();
64
62
  this.createOpenAIClient();
65
63
  }
66
64
 
@@ -1,7 +1,6 @@
1
1
  import path from "path";
2
2
  import fs from "fs";
3
3
  import {
4
- checkEnvNodeVersion,
5
4
  intersection,
6
5
  notExistsToCreateFile,
7
6
  readJsonFileSync,
@@ -84,7 +83,6 @@ export const registerLanguageCacheFile = async (
84
83
  * 根据已翻译文件生成缓存
85
84
  */
86
85
  export const generateCache = async (params: IGenerateCacheParams) => {
87
- checkEnvNodeVersion();
88
86
  const { sourceFolderPath, languages, exportFolderPath, sourceLanguage } =
89
87
  params;
90
88
 
@@ -169,7 +167,6 @@ const readFile = (sourceFolderPath: string, fileName: string): ICacheFile => {
169
167
  * @param params
170
168
  */
171
169
  export const deleteBatchCache = (params: IDeleteSingleCacheParams) => {
172
- checkEnvNodeVersion();
173
170
  const { keys, cacheFolderPath, languages, cacheFileName } = params;
174
171
  let deleteLanguages: string[] = [];
175
172
  const localLanguages = fs.readdirSync(cacheFolderPath);
package/src/lib/utils.ts CHANGED
@@ -112,13 +112,3 @@ export const dequeue = async (queue: (() => Promise<void>)[]) => {
112
112
  }
113
113
  }
114
114
  };
115
- const REQUIRED_VERSION = ">=18.16.0";
116
- export const checkEnvNodeVersion = () => {
117
- // 检查当前 Node.js 版本
118
- if (!semver.satisfies(process.version, REQUIRED_VERSION)) {
119
- console.error(
120
- `\x1b[31mError:\x1b[0m Unsupported Node.js version. Current version: ${process.version}. Required: ${REQUIRED_VERSION}.`
121
- );
122
- process.exit(1);
123
- }
124
- };