@alauda/doom 0.0.0-alpha.8 → 0.1.0
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/README.md +2 -0
- package/assets/logo.svg +1 -0
- package/lib/cli/constants.d.ts +2 -0
- package/lib/cli/constants.js +2 -0
- package/lib/cli/index.js +11 -16
- package/lib/cli/load-config.js +108 -52
- package/lib/plugins/auto-sidebar/walk.js +3 -1
- package/package.json +15 -8
package/README.md
CHANGED
package/assets/logo.svg
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="176" height="176" fill="none" fill-rule="evenodd" xmlns:v="https://vecta.io/nano"><path fill="#d8d8d8" opacity="0" d="M-8-12h200v200H-8z"/><g fill-rule="nonzero"><path d="M87.833 21.333c26.676 0 49.476 19.026 54.897 45.198l-5.879-2.798c-.977-.489-2.074-.733-3.173-.733a7.12 7.12 0 0 0-3.173.733L99.635 78.498c-2.014.976-3.477 2.746-3.966 4.941l-7.627 33.128c-.549 2.197 0 4.454 1.403 6.222l21.355 26.542c.609.768 1.345 1.386 2.162 1.84H40.539c-20.62-.063-37.871-15.908-39.99-36.729s11.578-39.912 31.75-44.252c3.967-28.039 27.63-48.857 55.534-48.857z" fill="#4da2f8"/><path d="M84.293 95.674l2.909 2.62 2.957 2.747 1.197 1.135-3.313 14.392c-.549 2.197 0 4.454 1.403 6.222l21.355 26.542c.609.768 1.345 1.386 2.162 1.84H40.539c-20.62-.063-37.871-15.908-39.99-36.729s11.578-39.912 31.75-44.252C45.8 68.435 63.132 76.93 84.293 95.674z" fill="#b3d7fc"/><path d="M175.166 115.81l-6.933-30.118c-.444-1.996-1.775-3.604-3.605-4.492l-28.065-13.367a6.47 6.47 0 0 0-2.884-.666 6.47 6.47 0 0 0-2.884.666l-28.065 13.423c-1.831.887-3.161 2.496-3.605 4.492l-6.933 30.117c-.499 1.997 0 4.049 1.275 5.657l19.413 24.129a6.54 6.54 0 0 0 5.158 2.495l31.28-.054c1.997 0 3.883-.943 5.158-2.496l19.415-24.127c1.275-1.608 1.719-3.661 1.275-5.657h0z" fill="#007af5"/><path d="M161.577 116.865c-.166 0-.278 0-.444-.057-.056-.054-.11-.054-.166-.054-.11 0-.222-.056-.332-.056-.388-.11-.666-.222-.999-.388-.166-.056-.332-.166-.499-.222h-.056c-1.055-.387-1.996-.721-2.884-.831h-.11c-.334 0-.5.166-.722.277-.054 0-.054.056-.11.056l-.666-.112a21.5 21.5 0 0 1-2.328 4.992c-1.887 2.996-4.382 5.436-7.322 7.156l.277.665c0 .056-.054.056-.054.11-.056.278-.166.502-.056.888.278.831.832 1.664 1.441 2.608v.054c.112.166.222.278.334.443.222.278.443.556.61.888.054.056.11.166.166.278 0 .056.054.056.054.11.222.444.222.943.11 1.387s-.443.777-.831.999a1.48 1.48 0 0 1-.665.166c-.666 0-1.331-.388-1.665-1.055 0 0-.054-.054-.054-.11-.056-.11-.112-.166-.166-.278-.168-.332-.222-.665-.334-.997l-.166-.5v-.054c-.388-1.055-.721-1.997-1.165-2.774-.222-.332-.443-.444-.721-.499-.056-.056-.056-.056-.11-.056l-.334-.609a24.66 24.66 0 0 1-2.884.831c-1.552.388-3.217.555-4.824.555a21.67 21.67 0 0 1-7.766-1.443l-.388.722c-.054.054-.054.054-.11.054-.222.112-.499.168-.721.5-.5.777-.778 1.663-1.165 2.773l-.166.5c-.112.332-.166.61-.334.997-.068.085-.123.178-.166.278 0 0-.054.056-.054.11-.332.61-.999 1.055-1.665 1.055-.221 0-.443-.056-.665-.166-.832-.388-1.165-1.443-.721-2.386 0 0 .054-.054.054-.11.056-.112.112-.222.166-.277.223-.334.388-.612.61-.888.112-.166.222-.278.332-.444v-.054c.612-.944 1.11-1.775 1.443-2.606.11-.39 0-.666-.112-.888 0-.054-.054-.054-.054-.112l.332-.721a22.46 22.46 0 0 1-2.386-1.608c-3.397-2.683-5.925-6.311-7.264-10.428l-.777.112c-.056 0-.056-.056-.112-.056-.166-.112-.388-.276-.721-.276h-.11c-.888.11-1.831.443-2.884.831h-.056c-.166.056-.332.166-.499.222-.334.166-.612.276-.999.388-.112 0-.222.054-.332.054 0 .056-.056.056-.112.056-.166.056-.277.056-.444.056-.885 0-1.608-.499-1.774-1.275-.166-.888.443-1.831 1.441-2.053.056-.054.112-.054.166-.054.112 0 .222-.056.334-.056.388-.054.721-.112 1.053-.112.168-.054.388-.054.555-.054h.056c1.165-.112 2.164-.222 2.995-.5a1.29 1.29 0 0 0 .61-.609c0-.056.056-.056.056-.112l.721-.221c-.721-5.104.332-10.262 3.106-14.644.054-.166.166-.278.277-.444l-.555-.499v-.112c0-.277 0-.555-.276-.831-.666-.61-1.499-1.109-2.496-1.719-.168-.112-.334-.222-.5-.278-.332-.166-.61-.332-.943-.555-.11-.056-.166-.165-.277-.222-.056 0-.056-.054-.112-.054-.777-.666-.943-1.775-.387-2.496.277-.388.775-.61 1.275-.61a1.94 1.94 0 0 1 1.219.444c0 .054.054.054.112.11.11.11.221.166.276.222.278.277.5.499.722.777.165.11.277.277.387.388.777.831 1.497 1.553 2.219 2.052.146.104.32.162.499.166.112 0 .222-.054.332-.054h.112l.555.387a21.38 21.38 0 0 1 10.983-6.211c.997-.222 1.996-.332 2.995-.444l.054-.721.112-.11c.166-.168.387-.334.444-.722.11-.887-.056-1.886-.168-2.995v-.056c-.054-.222-.054-.388-.11-.555-.11-.332-.166-.666-.166-1.053v-.444c-.013-.475.167-.935.499-1.275.332-.334.777-.555 1.221-.555.943 0 1.719.831 1.719 1.83v.499l-.166 1.055c-.056.168-.112.388-.112.555v.056c-.11 1.109-.222 2.106-.166 2.995.056.388.278.555.444.721l.11.112.056.721a22.15 22.15 0 0 1 11.592 4.604c.777.665 1.553 1.331 2.274 2.108l.666-.444h.11c.112.056.222.056.334.056.179-.004.353-.062.499-.166.721-.5 1.441-1.166 2.219-1.997.165-.11.277-.277.387-.388a9.38 9.38 0 0 1 .722-.777c.11-.054.166-.165.276-.222l.112-.11c.388-.278.775-.444 1.219-.444.5 0 .999.223 1.275.61.556.721.388 1.831-.388 2.496 0 .056-.054.056-.11.11-.11.112-.222.168-.276.222-.334.222-.61.388-.944.555-.166.112-.332.168-.499.278-.999.61-1.83 1.109-2.496 1.719-.222.278-.277.555-.277.832v.11l-.556.5c1.45 2.223 2.502 4.681 3.108 7.264.609 2.608.719 5.27.387 7.82l.721.222c0 .056.056.056.056.112.112.222.222.443.61.61.888.277 1.83.387 2.995.497h.056c.222.057.388.057.555.057.332 0 .666.054 1.055.11.11 0 .221.056.332.056 0 .054.056.054.11.054h.056c.999.278 1.609 1.165 1.609 1.831-.222.721-.944 1.277-1.775 1.277h0z" fill="#fff"/><path d="M136.563 101.5c.468.59 1.304.733 1.942.332l7.264-5.158h.001a16.84 16.84 0 0 0-9.984-4.826l.499 9.041c.056.222.112.443.278.61h0zm-11.036 6.434c.499-.61.443-1.553-.168-2.052l-6.6-5.88c-1.997 3.273-2.828 7.1-2.496 10.872l8.597-2.496a1.1 1.1 0 0 0 .666-.444h0zm3.937-5.825c.832 0 1.441-.665 1.497-1.441l.499-8.875-1.774.334h-.001a16.92 16.92 0 0 0-8.265 4.548l7.378 5.269c.168.112.444.166.666.166h0zm1.718 8.931l2.44 1.165 2.44-1.165.555-2.608-1.664-2.106h-2.718l-1.664 2.106zm9.097 2.608c-.634.316-.959 1.035-.777 1.719l3.493 8.373c2.108-1.387 3.937-3.161 5.324-5.379h.001c.721-1.053 1.277-2.162 1.609-3.383l-8.875-1.497c-.277 0-.555.056-.777.166zm10.259-8.376a17.77 17.77 0 0 0-2.106-5.27l-6.711 6.047a1.32 1.32 0 0 0-.334.61c-.173.777.289 1.555 1.055 1.774l8.485 2.442a17.43 17.43 0 0 0-.387-5.602h-.001 0zm-24.457 8.264l-8.819 1.496v.001a17.48 17.48 0 0 0 6.932 8.707l3.384-8.153c.112-.278.112-.555.054-.887-.166-.721-.831-1.222-1.552-1.165h0zm8.096 3.772c-.61-.332-1.33-.112-1.774.388l-4.383 7.931c1.777.555 3.661.888 5.602.888 1.333 0 2.608-.166 3.883-.444l1.608-.444-4.27-7.709a2.33 2.33 0 0 0-.666-.61h0z" fill="#007af5"/></g></svg>
|
package/lib/cli/constants.d.ts
CHANGED
|
@@ -3,3 +3,5 @@ export declare const YAML_EXTENSIONS: readonly [".yaml", ".yml"];
|
|
|
3
3
|
export declare const JS_EXTENSIONS: readonly [".js", ".ts", ".mjs", ".mts", ".cjs", ".cts"];
|
|
4
4
|
export declare const DEFAULT_EXTENSIONS: readonly [".yaml", ".yml", ".js", ".ts", ".mjs", ".mts", ".cjs", ".cts"];
|
|
5
5
|
export declare const DEFAULT_CONFIGS: ("doom.config.yaml" | "doom.config.yml" | "doom.config.js" | "doom.config.ts" | "doom.config.mjs" | "doom.config.mts" | "doom.config.cjs" | "doom.config.cts")[];
|
|
6
|
+
export declare const I18N_FILE = "i18n.json";
|
|
7
|
+
export declare const CWD: string;
|
package/lib/cli/constants.js
CHANGED
package/lib/cli/index.js
CHANGED
|
@@ -9,12 +9,10 @@ import { watch } from 'chokidar';
|
|
|
9
9
|
import { program } from 'commander';
|
|
10
10
|
import { green } from 'yoctocolors';
|
|
11
11
|
import module from 'node:module';
|
|
12
|
-
import { DEFAULT_CONFIGS } from './constants.js';
|
|
13
|
-
import { loadConfig
|
|
14
|
-
const I18N_FILE = 'i18n.json';
|
|
12
|
+
import { CWD, DEFAULT_CONFIGS, I18N_FILE } from './constants.js';
|
|
13
|
+
import { loadConfig } from './load-config.js';
|
|
15
14
|
const META_FILE = '_meta.json';
|
|
16
15
|
const CONFIG_FILES = [...DEFAULT_CONFIGS, I18N_FILE];
|
|
17
|
-
const cwd = process.cwd();
|
|
18
16
|
const setNodeEnv = (env) => {
|
|
19
17
|
process.env.NODE_ENV = env;
|
|
20
18
|
};
|
|
@@ -36,13 +34,11 @@ program
|
|
|
36
34
|
let cliWatcher;
|
|
37
35
|
const startDevServer = async () => {
|
|
38
36
|
const { config, filepath } = await loadConfig(root, configFile);
|
|
39
|
-
config.root = resolveDocRoot(cwd, root, config.root);
|
|
40
|
-
config.i18nSourcePath = path.resolve(config.root, I18N_FILE);
|
|
41
37
|
const docDirectory = config.root;
|
|
42
38
|
try {
|
|
43
39
|
devServer = await dev({
|
|
44
40
|
config,
|
|
45
|
-
appDirectory:
|
|
41
|
+
appDirectory: CWD,
|
|
46
42
|
docDirectory,
|
|
47
43
|
extraBuilderConfig: {
|
|
48
44
|
server,
|
|
@@ -53,23 +49,26 @@ program
|
|
|
53
49
|
logger.error(err);
|
|
54
50
|
devServer = undefined;
|
|
55
51
|
}
|
|
56
|
-
cliWatcher = watch(filepath
|
|
52
|
+
cliWatcher = watch(filepath
|
|
53
|
+
? [filepath, docDirectory, config.i18nSourcePath]
|
|
54
|
+
: [...CONFIG_FILES, docDirectory], {
|
|
57
55
|
ignoreInitial: true,
|
|
58
56
|
ignored: ['**/node_modules/**', '**/.git/**', '**/.DS_Store/**'],
|
|
59
|
-
cwd,
|
|
57
|
+
cwd: CWD,
|
|
60
58
|
});
|
|
61
59
|
let isRestarting = false;
|
|
62
60
|
cliWatcher.on('all', async (eventName, filepath) => {
|
|
63
61
|
if (eventName === 'add' ||
|
|
64
62
|
eventName === 'unlink' ||
|
|
65
63
|
(eventName === 'change' &&
|
|
66
|
-
(
|
|
64
|
+
(filepath === config.i18nSourcePath ||
|
|
65
|
+
CONFIG_FILES.includes(path.basename(filepath)) ||
|
|
67
66
|
path.basename(filepath) === META_FILE))) {
|
|
68
67
|
if (isRestarting) {
|
|
69
68
|
return;
|
|
70
69
|
}
|
|
71
70
|
isRestarting = true;
|
|
72
|
-
console.log(`\n✨ ${eventName} ${green(path.relative(
|
|
71
|
+
console.log(`\n✨ ${eventName} ${green(path.relative(CWD, filepath))}, dev server will restart...\n`);
|
|
73
72
|
await devServer?.close();
|
|
74
73
|
await cliWatcher.close();
|
|
75
74
|
await startDevServer();
|
|
@@ -95,12 +94,10 @@ program
|
|
|
95
94
|
.action(async (root, { config: configFile }) => {
|
|
96
95
|
setNodeEnv('production');
|
|
97
96
|
const { config } = await loadConfig(root, configFile);
|
|
98
|
-
config.root = resolveDocRoot(cwd, root, config.root);
|
|
99
|
-
config.i18nSourcePath = path.resolve(config.root, I18N_FILE);
|
|
100
97
|
const docDirectory = config.root;
|
|
101
98
|
await build({
|
|
102
99
|
config,
|
|
103
|
-
appDirectory:
|
|
100
|
+
appDirectory: CWD,
|
|
104
101
|
docDirectory,
|
|
105
102
|
});
|
|
106
103
|
})
|
|
@@ -113,8 +110,6 @@ program
|
|
|
113
110
|
.action(async (root, { config: configFile, ...server }) => {
|
|
114
111
|
setNodeEnv('production');
|
|
115
112
|
const { config } = await loadConfig(root, configFile);
|
|
116
|
-
config.root = resolveDocRoot(cwd, root, config.root);
|
|
117
|
-
config.i18nSourcePath = path.resolve(config.root, I18N_FILE);
|
|
118
113
|
await serve({
|
|
119
114
|
config,
|
|
120
115
|
...server,
|
package/lib/cli/load-config.js
CHANGED
|
@@ -1,46 +1,76 @@
|
|
|
1
1
|
import { nodeTypes } from '@mdx-js/mdx';
|
|
2
|
-
import { addLeadingSlash, addTrailingSlash, } from '@rspress/core';
|
|
2
|
+
import { addLeadingSlash, addTrailingSlash, removeLeadingSlash, } from '@rspress/core';
|
|
3
|
+
import { pluginPreview } from '@rspress/plugin-preview';
|
|
3
4
|
import { logger } from '@rspress/shared/logger';
|
|
4
5
|
import fs from 'node:fs';
|
|
5
6
|
import path from 'node:path';
|
|
6
7
|
import rehypeRaw from 'rehype-raw';
|
|
7
8
|
import { parse } from 'yaml';
|
|
8
9
|
import { autoSidebarPlugin, globalPlugin } from '../plugins/index.js';
|
|
9
|
-
import {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
10
|
+
import { pkgResolve } from '../utils/helpers.js';
|
|
11
|
+
import { CWD, DEFAULT_CONFIG_NAME, DEFAULT_EXTENSIONS, I18N_FILE, YAML_EXTENSIONS, } from './constants.js';
|
|
12
|
+
const DEFAULT_LOGO = '/logo.svg';
|
|
13
|
+
const getCommonConfig = (config) => {
|
|
14
|
+
return {
|
|
15
|
+
lang: 'en',
|
|
16
|
+
route: {
|
|
17
|
+
exclude: ['shared/**/*', 'doom.config.*'],
|
|
18
|
+
},
|
|
19
|
+
markdown: {
|
|
20
|
+
checkDeadLinks: true,
|
|
21
|
+
highlightLanguages: [['jsonc', 'json']],
|
|
22
|
+
mdxRs: false,
|
|
23
|
+
rehypePlugins: [[rehypeRaw, { passThrough: nodeTypes }]],
|
|
24
|
+
},
|
|
25
|
+
ssg: {
|
|
26
|
+
strict: true,
|
|
27
|
+
},
|
|
28
|
+
themeConfig: {
|
|
29
|
+
enableScrollToTop: true,
|
|
30
|
+
locales: 'lang' in config && config.lang == null
|
|
31
|
+
? undefined
|
|
32
|
+
: [
|
|
33
|
+
{
|
|
34
|
+
lang: 'zh',
|
|
35
|
+
label: '简体中文',
|
|
36
|
+
searchPlaceholderText: '搜索文档',
|
|
37
|
+
searchNoResultsText: '未搜索到相关结果',
|
|
38
|
+
searchSuggestedQueryText: '可更换不同的关键字后重试',
|
|
39
|
+
outlineTitle: '本页概览',
|
|
40
|
+
prevPageText: '上一页',
|
|
41
|
+
nextPageText: '下一页',
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
lang: 'en',
|
|
45
|
+
label: 'English',
|
|
46
|
+
},
|
|
47
|
+
],
|
|
48
|
+
},
|
|
49
|
+
plugins: [
|
|
50
|
+
pluginPreview({
|
|
51
|
+
iframeOptions: {
|
|
52
|
+
devPort: 7891,
|
|
53
|
+
},
|
|
54
|
+
defaultRenderMode: 'pure',
|
|
55
|
+
}),
|
|
56
|
+
autoSidebarPlugin(),
|
|
57
|
+
globalPlugin(),
|
|
58
|
+
],
|
|
59
|
+
builderConfig: {
|
|
60
|
+
server: {
|
|
61
|
+
open: true,
|
|
31
62
|
},
|
|
32
|
-
{
|
|
33
|
-
|
|
34
|
-
|
|
63
|
+
tools: {
|
|
64
|
+
rspack: {
|
|
65
|
+
resolve: {
|
|
66
|
+
extensionAlias: {
|
|
67
|
+
'.js': ['.ts', '.tsx', '.js'],
|
|
68
|
+
},
|
|
69
|
+
},
|
|
70
|
+
},
|
|
35
71
|
},
|
|
36
|
-
],
|
|
37
|
-
},
|
|
38
|
-
plugins: [autoSidebarPlugin(), globalPlugin()],
|
|
39
|
-
builderConfig: {
|
|
40
|
-
server: {
|
|
41
|
-
open: true,
|
|
42
72
|
},
|
|
43
|
-
}
|
|
73
|
+
};
|
|
44
74
|
};
|
|
45
75
|
const findConfig = (basePath) => {
|
|
46
76
|
return DEFAULT_EXTENSIONS.map((ext) => basePath + ext).find(fs.existsSync);
|
|
@@ -62,36 +92,62 @@ export async function loadConfig(root, configFile) {
|
|
|
62
92
|
configFilePath = findConfig(path.resolve('docs', DEFAULT_CONFIG_NAME));
|
|
63
93
|
}
|
|
64
94
|
}
|
|
95
|
+
let config;
|
|
96
|
+
const { loadConfig, mergeRsbuildConfig } = await import('@rsbuild/core');
|
|
65
97
|
if (!configFilePath) {
|
|
66
98
|
logger.info(`No doom config file found in ${process.cwd()}`);
|
|
67
|
-
return {
|
|
68
|
-
config: {},
|
|
69
|
-
};
|
|
70
99
|
}
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
100
|
+
else {
|
|
101
|
+
try {
|
|
102
|
+
if (YAML_EXTENSIONS.includes(path.extname(configFilePath))) {
|
|
103
|
+
config = parse(fs.readFileSync(configFilePath, 'utf-8'));
|
|
104
|
+
}
|
|
105
|
+
else {
|
|
106
|
+
const { content } = await loadConfig({
|
|
107
|
+
cwd: path.dirname(configFilePath),
|
|
108
|
+
path: configFilePath,
|
|
109
|
+
});
|
|
110
|
+
config = content;
|
|
111
|
+
}
|
|
76
112
|
}
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
cwd: path.dirname(configFilePath),
|
|
80
|
-
path: configFilePath,
|
|
81
|
-
});
|
|
82
|
-
config = content;
|
|
113
|
+
catch {
|
|
114
|
+
logger.error(`Failed to load config from ${configFilePath}`);
|
|
83
115
|
}
|
|
84
116
|
}
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
}
|
|
88
|
-
const mergedConfig = mergeRsbuildConfig(COMMON_CONFIG, config ?? {});
|
|
117
|
+
config ??= {};
|
|
118
|
+
const mergedConfig = mergeRsbuildConfig(getCommonConfig(config), config);
|
|
89
119
|
const base = addLeadingSlash(mergedConfig.base || '/');
|
|
90
120
|
mergedConfig.base = base;
|
|
121
|
+
mergedConfig.root = resolveDocRoot(CWD, root, mergedConfig.root);
|
|
122
|
+
let ensureDefaultLogo = false;
|
|
123
|
+
if (!mergedConfig.logo) {
|
|
124
|
+
mergedConfig.logo = DEFAULT_LOGO;
|
|
125
|
+
ensureDefaultLogo = true;
|
|
126
|
+
}
|
|
127
|
+
if (!mergedConfig.icon) {
|
|
128
|
+
mergedConfig.icon = DEFAULT_LOGO;
|
|
129
|
+
ensureDefaultLogo = true;
|
|
130
|
+
}
|
|
131
|
+
if (ensureDefaultLogo) {
|
|
132
|
+
const publicPath = path.resolve(mergedConfig.root, `public`);
|
|
133
|
+
fs.mkdirSync(publicPath, { recursive: true });
|
|
134
|
+
const logoPath = path.resolve(publicPath, removeLeadingSlash(DEFAULT_LOGO));
|
|
135
|
+
if (!fs.existsSync(logoPath)) {
|
|
136
|
+
fs.copyFileSync(pkgResolve(`assets${DEFAULT_LOGO}`), logoPath);
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
if (mergedConfig.i18nSourcePath) {
|
|
140
|
+
if (!path.isAbsolute(mergedConfig.i18nSourcePath)) {
|
|
141
|
+
mergedConfig.i18nSourcePath = path.resolve(configFilePath ?? mergedConfig.root, mergedConfig.i18nSourcePath);
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
else {
|
|
145
|
+
mergedConfig.i18nSourcePath = path.resolve(mergedConfig.root, I18N_FILE);
|
|
146
|
+
}
|
|
91
147
|
if (!mergedConfig.outDir) {
|
|
92
148
|
mergedConfig.outDir = `dist${base}`;
|
|
93
149
|
}
|
|
94
|
-
if (mergedConfig.builderConfig?.server?.open) {
|
|
150
|
+
if (mergedConfig.builderConfig?.server?.open === true) {
|
|
95
151
|
mergedConfig.builderConfig.server.open = addTrailingSlash(base);
|
|
96
152
|
}
|
|
97
153
|
return {
|
|
@@ -181,7 +181,9 @@ export async function walk(workDir, routePrefix = '/', docsDir, extensions) {
|
|
|
181
181
|
}
|
|
182
182
|
});
|
|
183
183
|
// find the `_meta.json` file in the subdirectory
|
|
184
|
-
const subDirs = (await fs.readdir(workDir)).filter((v) => fs.statSync(path.join(workDir, v)).isDirectory() &&
|
|
184
|
+
const subDirs = (await fs.readdir(workDir)).filter((v) => fs.statSync(path.join(workDir, v)).isDirectory() &&
|
|
185
|
+
v !== 'node_modules' &&
|
|
186
|
+
(workDir !== docsDir || !['public', 'shared'].includes(v)));
|
|
185
187
|
const sidebars = [];
|
|
186
188
|
// Every sub dir will represent a group of sidebar
|
|
187
189
|
const sidebarConfig = {
|
package/package.json
CHANGED
|
@@ -1,19 +1,25 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@alauda/doom",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.1.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Doctor Doom making docs.",
|
|
6
|
-
"repository":
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "git+https://gitlab-ce.alauda.cn/idp/Doom.git"
|
|
9
|
+
},
|
|
7
10
|
"packageManager": "yarn@4.5.0",
|
|
8
11
|
"engines": {
|
|
9
12
|
"node": ">=18.12.0"
|
|
10
13
|
},
|
|
11
|
-
"bin":
|
|
14
|
+
"bin": {
|
|
15
|
+
"doom": "lib/cli/index.js"
|
|
16
|
+
},
|
|
12
17
|
"exports": {
|
|
13
18
|
"./package.json": "./package.json",
|
|
14
19
|
"./runtime": "./lib/runtime/index.js"
|
|
15
20
|
},
|
|
16
21
|
"files": [
|
|
22
|
+
"assets",
|
|
17
23
|
"global.d.ts",
|
|
18
24
|
"lib",
|
|
19
25
|
"styles",
|
|
@@ -32,7 +38,8 @@
|
|
|
32
38
|
"swc-node": "node --enable-source-maps --import @swc-node/register/esm-register"
|
|
33
39
|
},
|
|
34
40
|
"dependencies": {
|
|
35
|
-
"@rspress/core": "^1.
|
|
41
|
+
"@rspress/core": "^1.36.0",
|
|
42
|
+
"@rspress/plugin-preview": "^1.36.0",
|
|
36
43
|
"chokidar": "^4.0.1",
|
|
37
44
|
"commander": "^12.1.0",
|
|
38
45
|
"rehype-raw": "^6.1.1",
|
|
@@ -40,20 +47,20 @@
|
|
|
40
47
|
"yoctocolors": "^2.1.1"
|
|
41
48
|
},
|
|
42
49
|
"devDependencies": {
|
|
43
|
-
"@eslint/js": "^9.
|
|
50
|
+
"@eslint/js": "^9.14.0",
|
|
44
51
|
"@swc-node/register": "^1.10.9",
|
|
45
|
-
"@swc/core": "1.
|
|
52
|
+
"@swc/core": "1.9.2",
|
|
46
53
|
"@types/eslint__js": "^8.42.3",
|
|
47
54
|
"@types/fs-extra": "^11.0.4",
|
|
48
55
|
"@types/node": "~18.13.0",
|
|
49
|
-
"eslint": "^9.
|
|
56
|
+
"eslint": "^9.14.0",
|
|
50
57
|
"lint-staged": "^15.2.10",
|
|
51
58
|
"npm-run-all2": "^7.0.1",
|
|
52
59
|
"prettier": "^3.3.3",
|
|
53
60
|
"prettier-plugin-pkg": "^0.18.1",
|
|
54
61
|
"simple-git-hooks": "^2.11.1",
|
|
55
62
|
"typescript": "^5.6.3",
|
|
56
|
-
"typescript-eslint": "^8.
|
|
63
|
+
"typescript-eslint": "^8.14.0"
|
|
57
64
|
},
|
|
58
65
|
"publishConfig": {
|
|
59
66
|
"access": "public"
|