@alauda/doom 0.19.3 → 0.19.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.
@@ -217,15 +217,17 @@ export const translateCommand = new Command('translate')
217
217
  }
218
218
  }
219
219
  await limit(async () => {
220
- const relativePath = path.relative(docsDir, sourceFilePath);
221
- logger.info(`Translating ${cyan(relativePath)}`);
220
+ const sourceRelativePath = path.relative(docsDir, sourceFilePath);
221
+ const targetRelativePath = path.relative(docsDir, targetFilePath);
222
+ logger.info(`Translating ${cyan(sourceRelativePath)} to ${cyan(targetRelativePath)}`);
222
223
  const isMdx = sourceFilePath.endsWith('.mdx');
223
224
  const processor = isMdx ? mdxProcessor : mdProcessor;
224
225
  const ast = processor.parse(escapeMarkdownHeadingIds(sourceContent));
226
+ const targetBase = path.dirname(targetFilePath);
225
227
  const normalizeImgSrcOptions = {
226
228
  localPublicBase: path.resolve(docsDir, 'public'),
227
229
  sourceBase: path.dirname(sourceFilePath),
228
- targetBase: path.dirname(targetFilePath),
230
+ targetBase,
229
231
  translating: { source, target, copy },
230
232
  };
231
233
  const normalizedSourceContent = processor.stringify({
@@ -248,9 +250,9 @@ export const translateCommand = new Command('translate')
248
250
  newFrontmatter.title = sourceFrontmatter.i18n.title[target];
249
251
  }
250
252
  targetContent = matter.stringify(content.startsWith('\n') ? content : '\n' + content, newFrontmatter);
251
- await fs.mkdir(path.dirname(targetFilePath), { recursive: true });
253
+ await fs.mkdir(targetBase, { recursive: true });
252
254
  await fs.writeFile(targetFilePath, targetContent);
253
- logger.info(`${cyan(relativePath)} translated`);
255
+ logger.info(`${cyan(sourceRelativePath)} translated to ${cyan(targetRelativePath)}`);
254
256
  allSourceFilePaths.delete(sourceFilePath);
255
257
  });
256
258
  }));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alauda/doom",
3
- "version": "0.19.3",
3
+ "version": "0.19.4",
4
4
  "type": "module",
5
5
  "description": "Doctor Doom making docs.",
6
6
  "repository": "https://gitlab-ce.alauda.cn/idp/Doom.git",