@alauda/doom 0.6.8 → 0.6.11
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
CHANGED
|
@@ -107,11 +107,16 @@ program
|
|
|
107
107
|
const { config: configFile, prefix, v: version, force, } = this.optsWithGlobals();
|
|
108
108
|
const { config } = await loadConfig(root, configFile, prefix, version, force);
|
|
109
109
|
const docDirectory = config.root;
|
|
110
|
-
|
|
110
|
+
const runBuild = () => build({
|
|
111
111
|
config,
|
|
112
112
|
appDirectory: CWD,
|
|
113
113
|
docDirectory,
|
|
114
114
|
});
|
|
115
|
+
await runBuild();
|
|
116
|
+
if (process.env.__DOOM_REBUILD__ === 'true') {
|
|
117
|
+
logger.info('Rebuilding...');
|
|
118
|
+
await runBuild();
|
|
119
|
+
}
|
|
115
120
|
});
|
|
116
121
|
program
|
|
117
122
|
.command('preview')
|
package/lib/cli/load-config.js
CHANGED
|
@@ -2,10 +2,8 @@ import fs from 'node:fs';
|
|
|
2
2
|
import path from 'node:path';
|
|
3
3
|
import { nodeTypes } from '@mdx-js/mdx';
|
|
4
4
|
import { addLeadingSlash, addTrailingSlash, normalizeSlash, removeLeadingSlash, removeTrailingSlash, } from '@rspress/core';
|
|
5
|
-
import { pluginPreview } from '@rspress/plugin-preview';
|
|
6
5
|
import { logger } from '@rspress/shared/logger';
|
|
7
6
|
import { transformerMetaHighlight, transformerMetaWordHighlight, transformerNotationDiff, transformerNotationErrorLevel, transformerNotationFocus, transformerNotationHighlight, transformerNotationWordHighlight, transformerRemoveNotationEscape, } from '@shikijs/transformers';
|
|
8
|
-
import getPort from 'get-port';
|
|
9
7
|
import rehypeRaw from 'rehype-raw';
|
|
10
8
|
import { apiPlugin, autoSidebarPlugin, createTransformerCallouts, globalPlugin, shikiPlugin, } from '../plugins/index.js';
|
|
11
9
|
import { normalizeVersion } from '../shared/index.js';
|
|
@@ -21,7 +19,7 @@ const zhLocaleConfig = {
|
|
|
21
19
|
prevPageText: '上一页',
|
|
22
20
|
nextPageText: '下一页',
|
|
23
21
|
};
|
|
24
|
-
const getCommonConfig =
|
|
22
|
+
const getCommonConfig = (config, cliRoot, prefix, configFilePath, version, force) => {
|
|
25
23
|
const fallbackToZh = 'lang' in config && config.lang == null;
|
|
26
24
|
const root = resolveDocRoot(CWD, cliRoot, config.root);
|
|
27
25
|
let base = addLeadingSlash(config.base || '/');
|
|
@@ -67,12 +65,6 @@ const getCommonConfig = async (config, cliRoot, prefix, configFilePath, version,
|
|
|
67
65
|
}),
|
|
68
66
|
},
|
|
69
67
|
plugins: [
|
|
70
|
-
pluginPreview({
|
|
71
|
-
iframeOptions: {
|
|
72
|
-
devPort: await getPort({ port: 7891 }),
|
|
73
|
-
},
|
|
74
|
-
defaultRenderMode: 'pure',
|
|
75
|
-
}),
|
|
76
68
|
apiPlugin(config.api),
|
|
77
69
|
autoSidebarPlugin(config.sidebar),
|
|
78
70
|
globalPlugin({
|
|
@@ -174,7 +166,7 @@ export async function loadConfig(root, configFile, prefix, version, force) {
|
|
|
174
166
|
}
|
|
175
167
|
}
|
|
176
168
|
const normalizedVersion = normalizeVersion(version);
|
|
177
|
-
const commonConfig =
|
|
169
|
+
const commonConfig = getCommonConfig(config, root, prefix, configFilePath, normalizedVersion, force);
|
|
178
170
|
const mergedConfig = mergeRsbuildConfig(commonConfig, config, {
|
|
179
171
|
base: commonConfig.base,
|
|
180
172
|
root: commonConfig.root,
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import fs from 'node:fs/promises';
|
|
2
2
|
import os from 'node:os';
|
|
3
3
|
import path from 'node:path';
|
|
4
|
+
import { isProduction } from '@rspress/core';
|
|
4
5
|
import { logger } from '@rspress/shared/logger';
|
|
5
6
|
import { render } from 'ejs';
|
|
6
7
|
import { simpleGit } from 'simple-git';
|
|
@@ -113,7 +114,8 @@ const FIELD_MAPPER = {
|
|
|
113
114
|
zh: 'customfield_13800',
|
|
114
115
|
en: 'customfield_13801',
|
|
115
116
|
};
|
|
116
|
-
const { JIRA_TOKEN, JIRA_USERNAME, JIRA_PASSWORD } = process.env;
|
|
117
|
+
const { CI, JIRA_TOKEN, JIRA_USERNAME, JIRA_PASSWORD } = process.env;
|
|
118
|
+
const isCi = CI !== 'false' && !!CI;
|
|
117
119
|
const issuesToMdast = (issues, lang) => {
|
|
118
120
|
return issues
|
|
119
121
|
.map((issue) => {
|
|
@@ -229,8 +231,6 @@ export const remarkReplace = function ({ lang, localBasePath, root, items, force
|
|
|
229
231
|
const frontmatterNode = getFrontmatterNode(originalAst);
|
|
230
232
|
let frontmatter = frontmatterNode &&
|
|
231
233
|
parse(frontmatterNode.value);
|
|
232
|
-
const relativePath = path.relative(root, filepath);
|
|
233
|
-
const currLang = lang === null ? 'zh' : relativePath.split('/')[0];
|
|
234
234
|
const newAstChildren = [];
|
|
235
235
|
const newContentChildren = [];
|
|
236
236
|
let index = 0;
|
|
@@ -238,6 +238,8 @@ export const remarkReplace = function ({ lang, localBasePath, root, items, force
|
|
|
238
238
|
let refName = '';
|
|
239
239
|
let matched;
|
|
240
240
|
let checkContent = false;
|
|
241
|
+
const relativePath = path.relative(root, filepath);
|
|
242
|
+
const currLang = lang === null ? 'zh' : relativePath.split('/')[0];
|
|
241
243
|
for (const node of ast.children) {
|
|
242
244
|
index++;
|
|
243
245
|
if (node.type !== (isMdx ? 'mdxFlowExpression' : 'html')) {
|
|
@@ -305,8 +307,14 @@ export const remarkReplace = function ({ lang, localBasePath, root, items, force
|
|
|
305
307
|
continue;
|
|
306
308
|
}
|
|
307
309
|
if ((matched = node.value.match(isMdx ? MDX_RELEASE_PATTERN : MD_RELEASE_COMMENT_PATTERN))) {
|
|
308
|
-
|
|
309
|
-
|
|
310
|
+
if (start != null) {
|
|
311
|
+
logger.warn(`Invalid release-notes-for-bugs comment ${red(refName)}, nested reference blocks are not allowed`);
|
|
312
|
+
newAstChildren.push(node);
|
|
313
|
+
}
|
|
314
|
+
else {
|
|
315
|
+
const releaseContent = await resolveRelease(releaseNotes?.queryTemplates ?? {}, matched[1].trim(), currLang);
|
|
316
|
+
newAstChildren.push(releaseContent ?? node);
|
|
317
|
+
}
|
|
310
318
|
newContentChildren.push(node);
|
|
311
319
|
}
|
|
312
320
|
}
|
|
@@ -326,12 +334,23 @@ export const remarkReplace = function ({ lang, localBasePath, root, items, force
|
|
|
326
334
|
if (checkContent) {
|
|
327
335
|
const newContent = processor.stringify({
|
|
328
336
|
...ast,
|
|
329
|
-
children: newContentChildren
|
|
330
|
-
.
|
|
331
|
-
|
|
337
|
+
children: newContentChildren.flat().filter((n) => {
|
|
338
|
+
if (n.type !== 'mdxjsEsm') {
|
|
339
|
+
return true;
|
|
340
|
+
}
|
|
341
|
+
const matched = n.value.match(/^import\b.+\bfrom\b\s+(['"])([^'"]+)\1$/);
|
|
342
|
+
return !matched?.[2] || !path.isAbsolute(matched[2]);
|
|
343
|
+
}),
|
|
332
344
|
});
|
|
333
345
|
if (content !== newContent) {
|
|
334
346
|
await fs.writeFile(filepath, newContent);
|
|
347
|
+
if (!vfile.data.original && isProduction()) {
|
|
348
|
+
const message = `Reference block in \`${cyan(relativePath)}\` has been updated, please commit the changes`;
|
|
349
|
+
if (isCi) {
|
|
350
|
+
process.env.__DOOM_REBUILD__ = 'true';
|
|
351
|
+
}
|
|
352
|
+
logger.warn(message);
|
|
353
|
+
}
|
|
335
354
|
return;
|
|
336
355
|
}
|
|
337
356
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@alauda/doom",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.11",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Doctor Doom making docs.",
|
|
6
6
|
"repository": {
|
|
@@ -41,14 +41,12 @@
|
|
|
41
41
|
"@inquirer/prompts": "^7.2.1",
|
|
42
42
|
"@openapi-contrib/openapi-schema-to-json-schema": "^5.1.0",
|
|
43
43
|
"@rspress/core": "1.39.3",
|
|
44
|
-
"@rspress/plugin-preview": "1.39.3",
|
|
45
44
|
"@shikijs/transformers": "^1.26.1",
|
|
46
45
|
"chokidar": "^4.0.3",
|
|
47
46
|
"clsx": "^2.1.1",
|
|
48
47
|
"commander": "^12.1.0",
|
|
49
48
|
"ejs": "^3.1.10",
|
|
50
49
|
"es-toolkit": "^1.31.0",
|
|
51
|
-
"get-port": "^7.1.0",
|
|
52
50
|
"openapi-types": "^12.1.3",
|
|
53
51
|
"react-markdown": "^8.0.7",
|
|
54
52
|
"rehype-raw": "^6.1.1",
|