@alauda/doom 0.14.11 → 0.14.13
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/lib/cli/index.js +3 -1
- package/lib/cli/translate.js +6 -4
- package/package.json +5 -5
package/lib/cli/index.js
CHANGED
|
@@ -30,7 +30,9 @@ program
|
|
|
30
30
|
.option('-v <version>', 'Specify the version of the documentation')
|
|
31
31
|
.option('-b, --base <base>', 'Override the base of the documentation')
|
|
32
32
|
.option('-p, --prefix <prefix>', 'Specify the prefix of the documentation base')
|
|
33
|
-
.option('-f, --force [boolean]',
|
|
33
|
+
.option('-f, --force [boolean]', `Force to
|
|
34
|
+
1. fetch latest reference remotes or scaffolding templates, otherwise use local cache
|
|
35
|
+
2. translate ignore hash equality check and original text`, (value) => !!value && value !== 'false', false)
|
|
34
36
|
.option('-i, --ignore [boolean]', 'Ignore internal routes', (value) => !!value && value !== 'false', false)
|
|
35
37
|
.option('-d, --download [boolean]', 'Display download pdf link on nav bar', (value) => !!value && value !== 'false', false)
|
|
36
38
|
.command('dev', { isDefault: true })
|
package/lib/cli/translate.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import crypto from 'node:crypto';
|
|
2
2
|
import fs from 'node:fs/promises';
|
|
3
3
|
import path from 'node:path';
|
|
4
|
+
import { removeLeadingSlash } from '@rspress/shared';
|
|
4
5
|
import { logger } from '@rspress/shared/logger';
|
|
5
6
|
import { Command } from 'commander';
|
|
6
7
|
import { render } from 'ejs';
|
|
@@ -30,6 +31,7 @@ const DEFAULT_SYSTEM_PROMPT = `
|
|
|
30
31
|
- 以下是常见的相关术语词汇对应表(中文 -> English)
|
|
31
32
|
* ACP -> ACP
|
|
32
33
|
* 灵雀云 -> Alauda
|
|
34
|
+
* 容器组 -> Pods
|
|
33
35
|
- 移除 {/* reference-start */}, {/* reference-end */}, <!-- reference-start --> 和 <!-- reference-end --> 相关的注释
|
|
34
36
|
- 翻译过程中务必保留原文中的 \\< 转义字符不要做任何转义变更
|
|
35
37
|
|
|
@@ -95,7 +97,7 @@ export const translateCommand = new Command('translate')
|
|
|
95
97
|
.requiredOption('-g, --glob <path...>', 'Glob patterns for source dirs/files')
|
|
96
98
|
.option('-C, --copy [boolean]', 'Wether to copy relative assets to the target directory instead of following links', (value) => !!value && value !== 'false', false)
|
|
97
99
|
.action(async function (root) {
|
|
98
|
-
const { source, target, glob: globs, copy, ...globalOptions } = this.optsWithGlobals();
|
|
100
|
+
const { source, target, glob: globs, copy, force, ...globalOptions } = this.optsWithGlobals();
|
|
99
101
|
if (!Object.hasOwn(LANGUAGE_CODES, source) ||
|
|
100
102
|
!Object.hasOwn(LANGUAGE_CODES, target) ||
|
|
101
103
|
source === target) {
|
|
@@ -112,7 +114,7 @@ export const translateCommand = new Command('translate')
|
|
|
112
114
|
process.exitCode = 1;
|
|
113
115
|
return;
|
|
114
116
|
}
|
|
115
|
-
const matched = await glob(globs, {
|
|
117
|
+
const matched = await glob(globs.map(removeLeadingSlash), {
|
|
116
118
|
absolute: true,
|
|
117
119
|
cwd: sourceDir,
|
|
118
120
|
onlyFiles: false,
|
|
@@ -147,7 +149,7 @@ export const translateCommand = new Command('translate')
|
|
|
147
149
|
targetContent = await fs.readFile(targetFilePath, 'utf-8');
|
|
148
150
|
targetFrontmatter = matter(targetContent).data;
|
|
149
151
|
if (targetFrontmatter.i18n?.disableAutoTranslation ||
|
|
150
|
-
targetFrontmatter.sourceSHA === sourceSHA) {
|
|
152
|
+
(!force && targetFrontmatter.sourceSHA === sourceSHA)) {
|
|
151
153
|
return;
|
|
152
154
|
}
|
|
153
155
|
}
|
|
@@ -171,7 +173,7 @@ export const translateCommand = new Command('translate')
|
|
|
171
173
|
children: ast.children.map((it) => normalizeImgSrc(it, normalizeImgSrcOptions)),
|
|
172
174
|
}),
|
|
173
175
|
target,
|
|
174
|
-
targetContent,
|
|
176
|
+
targetContent: force ? '' : targetContent,
|
|
175
177
|
additionalPrompts: targetFrontmatter?.i18n?.additionalPrompts ??
|
|
176
178
|
sourceFrontmatter.i18n?.additionalPrompts,
|
|
177
179
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@alauda/doom",
|
|
3
|
-
"version": "0.14.
|
|
3
|
+
"version": "0.14.13",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Doctor Doom making docs.",
|
|
6
6
|
"repository": {
|
|
@@ -45,8 +45,8 @@
|
|
|
45
45
|
"dependencies": {
|
|
46
46
|
"@inquirer/prompts": "^7.3.3",
|
|
47
47
|
"@openapi-contrib/openapi-schema-to-json-schema": "^5.1.0",
|
|
48
|
-
"@playwright/browser-chromium": "^1.
|
|
49
|
-
"@rspress/core": "1.43.
|
|
48
|
+
"@playwright/browser-chromium": "^1.51.0",
|
|
49
|
+
"@rspress/core": "1.43.2",
|
|
50
50
|
"@shikijs/transformers": "^3.1.0",
|
|
51
51
|
"chokidar": "^4.0.3",
|
|
52
52
|
"cli-progress": "^3.12.0",
|
|
@@ -63,7 +63,7 @@
|
|
|
63
63
|
"pdf-lib": "^1.17.1",
|
|
64
64
|
"pdf-merger-js": "^5.1.2",
|
|
65
65
|
"picomatch": "^4.0.2",
|
|
66
|
-
"playwright": "^1.
|
|
66
|
+
"playwright": "^1.51.0",
|
|
67
67
|
"react-markdown": "^8.0.7",
|
|
68
68
|
"rehype-raw": "^6.1.1",
|
|
69
69
|
"remark-directive": "^2.0.1",
|
|
@@ -97,7 +97,7 @@
|
|
|
97
97
|
"prettier-plugin-pkg": "^0.18.1",
|
|
98
98
|
"simple-git-hooks": "^2.11.1",
|
|
99
99
|
"typescript": "^5.8.2",
|
|
100
|
-
"typescript-eslint": "^8.26.
|
|
100
|
+
"typescript-eslint": "^8.26.1"
|
|
101
101
|
},
|
|
102
102
|
"publishConfig": {
|
|
103
103
|
"access": "public"
|