@alauda/doom 0.14.11 → 0.14.12
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 +5 -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';
|
|
@@ -95,7 +96,7 @@ export const translateCommand = new Command('translate')
|
|
|
95
96
|
.requiredOption('-g, --glob <path...>', 'Glob patterns for source dirs/files')
|
|
96
97
|
.option('-C, --copy [boolean]', 'Wether to copy relative assets to the target directory instead of following links', (value) => !!value && value !== 'false', false)
|
|
97
98
|
.action(async function (root) {
|
|
98
|
-
const { source, target, glob: globs, copy, ...globalOptions } = this.optsWithGlobals();
|
|
99
|
+
const { source, target, glob: globs, copy, force, ...globalOptions } = this.optsWithGlobals();
|
|
99
100
|
if (!Object.hasOwn(LANGUAGE_CODES, source) ||
|
|
100
101
|
!Object.hasOwn(LANGUAGE_CODES, target) ||
|
|
101
102
|
source === target) {
|
|
@@ -112,7 +113,7 @@ export const translateCommand = new Command('translate')
|
|
|
112
113
|
process.exitCode = 1;
|
|
113
114
|
return;
|
|
114
115
|
}
|
|
115
|
-
const matched = await glob(globs, {
|
|
116
|
+
const matched = await glob(globs.map(removeLeadingSlash), {
|
|
116
117
|
absolute: true,
|
|
117
118
|
cwd: sourceDir,
|
|
118
119
|
onlyFiles: false,
|
|
@@ -147,7 +148,7 @@ export const translateCommand = new Command('translate')
|
|
|
147
148
|
targetContent = await fs.readFile(targetFilePath, 'utf-8');
|
|
148
149
|
targetFrontmatter = matter(targetContent).data;
|
|
149
150
|
if (targetFrontmatter.i18n?.disableAutoTranslation ||
|
|
150
|
-
targetFrontmatter.sourceSHA === sourceSHA) {
|
|
151
|
+
(!force && targetFrontmatter.sourceSHA === sourceSHA)) {
|
|
151
152
|
return;
|
|
152
153
|
}
|
|
153
154
|
}
|
|
@@ -171,7 +172,7 @@ export const translateCommand = new Command('translate')
|
|
|
171
172
|
children: ast.children.map((it) => normalizeImgSrc(it, normalizeImgSrcOptions)),
|
|
172
173
|
}),
|
|
173
174
|
target,
|
|
174
|
-
targetContent,
|
|
175
|
+
targetContent: force ? '' : targetContent,
|
|
175
176
|
additionalPrompts: targetFrontmatter?.i18n?.additionalPrompts ??
|
|
176
177
|
sourceFrontmatter.i18n?.additionalPrompts,
|
|
177
178
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@alauda/doom",
|
|
3
|
-
"version": "0.14.
|
|
3
|
+
"version": "0.14.12",
|
|
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"
|