@alauda/doom 0.19.0 → 0.19.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.
@@ -64,8 +64,8 @@ let openai;
64
64
  const resolveTerms_ = async () => {
65
65
  const terms = await fetchApi('https://gitlab-ce.alauda.cn/alauda-public/product-doc-guide/-/raw/main/terms.yaml', { type: 'text' });
66
66
  const parsedTerms = parse(terms);
67
- return ('- 以下是常见的相关术语词汇对应表(English -> 中文)\n' +
68
- parsedTerms.map(({ en, zh = en }) => ` * ${en} -> ${zh}`).join('\n'));
67
+ return ('- 以下是常见的相关术语词汇对应表(English <-> 中文)\n' +
68
+ parsedTerms.map(({ en, zh = en }) => ` * ${en} <-> ${zh}`).join('\n'));
69
69
  };
70
70
  let termsCache;
71
71
  const resolveTerms = async () => {
@@ -122,6 +122,7 @@ const limit = pRateLimit({
122
122
  concurrency: 10,
123
123
  });
124
124
  const supportedLanguages = SUPPORTED_LANGUAGES.join(', ');
125
+ const shaHash = crypto.createHash('sha256');
125
126
  export const translateCommand = new Command('translate')
126
127
  .description('Translate the documentation')
127
128
  .argument('[root]', 'Root directory of the documentation')
@@ -187,22 +188,20 @@ export const translateCommand = new Command('translate')
187
188
  }
188
189
  }
189
190
  if (toRemoveTargetFilePaths.length > 0) {
190
- logger.warn('Found unmatched target files will be removed:\n', ...toRemoveTargetFilePaths.map((file) => `- ${red(file)}`));
191
+ logger.warn('Found unmatched target files will be removed:\n' +
192
+ toRemoveTargetFilePaths.map((file) => `- ${red(file)}`).join('\n'));
191
193
  await Promise.all(toRemoveTargetFilePaths.map((file) => fs.rm(file)));
192
194
  }
193
195
  }
194
196
  const executor = async () => await Promise.all([...allSourceFilePaths].map(async (sourceFilePath) => {
195
197
  const sourceContent = await fs.readFile(sourceFilePath, 'utf-8');
196
- const sourceFrontmatter = matter(sourceContent)
197
- .data;
198
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
199
+ const { sourceSHA: _sourceSHA, ...sourceFrontmatter } = matter(sourceContent).data;
198
200
  if (sourceFrontmatter.i18n?.disableAutoTranslation) {
199
201
  allSourceFilePaths.delete(sourceFilePath);
200
202
  return;
201
203
  }
202
- const sourceSHA = crypto
203
- .createHash('sha256')
204
- .update(sourceContent)
205
- .digest('hex');
204
+ const sourceSHA = shaHash.update(sourceContent).digest('hex');
206
205
  const targetFilePath = sourceFilePath.replace(sourceDir, targetDir);
207
206
  let targetContent;
208
207
  let targetFrontmatter;
package/package.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "@alauda/doom",
3
- "version": "0.19.0",
3
+ "version": "0.19.2",
4
4
  "type": "module",
5
5
  "description": "Doctor Doom making docs.",
6
6
  "repository": "https://gitlab-ce.alauda.cn/idp/Doom.git",
7
- "packageManager": "yarn@4.9.1",
7
+ "packageManager": "yarn@4.9.0",
8
8
  "engines": {
9
9
  "node": ">=18.17.0 <20 || >=20.1.0"
10
10
  },