@alauda/doom 0.6.8 → 0.6.9
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')
|
|
@@ -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
|
}
|
|
@@ -332,6 +340,13 @@ export const remarkReplace = function ({ lang, localBasePath, root, items, force
|
|
|
332
340
|
});
|
|
333
341
|
if (content !== newContent) {
|
|
334
342
|
await fs.writeFile(filepath, newContent);
|
|
343
|
+
if (!vfile.data.original && isProduction()) {
|
|
344
|
+
const message = `Reference block in \`${cyan(relativePath)}\` has been updated, please commit the changes`;
|
|
345
|
+
if (isCi) {
|
|
346
|
+
process.env.__DOOM_REBUILD__ = 'true';
|
|
347
|
+
}
|
|
348
|
+
logger.warn(message);
|
|
349
|
+
}
|
|
335
350
|
return;
|
|
336
351
|
}
|
|
337
352
|
}
|