@alauda/doom 0.0.0-alpha.10 → 0.0.0-alpha.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/load-config.js +29 -18
- package/package.json +6 -6
package/lib/cli/load-config.js
CHANGED
|
@@ -11,6 +11,9 @@ import { pkgResolve } from '../utils/helpers.js';
|
|
|
11
11
|
const DEFAULT_LOGO = '/logo.svg';
|
|
12
12
|
const COMMON_CONFIG = {
|
|
13
13
|
lang: 'en',
|
|
14
|
+
route: {
|
|
15
|
+
exclude: ['shared/**/*', 'components/**/*', 'doom.config.*'],
|
|
16
|
+
},
|
|
14
17
|
markdown: {
|
|
15
18
|
checkDeadLinks: true,
|
|
16
19
|
mdxRs: false,
|
|
@@ -40,6 +43,15 @@ const COMMON_CONFIG = {
|
|
|
40
43
|
server: {
|
|
41
44
|
open: true,
|
|
42
45
|
},
|
|
46
|
+
tools: {
|
|
47
|
+
rspack: {
|
|
48
|
+
resolve: {
|
|
49
|
+
extensionAlias: {
|
|
50
|
+
'.js': ['.ts', '.tsx', '.js'],
|
|
51
|
+
},
|
|
52
|
+
},
|
|
53
|
+
},
|
|
54
|
+
},
|
|
43
55
|
},
|
|
44
56
|
};
|
|
45
57
|
const findConfig = (basePath) => {
|
|
@@ -62,29 +74,28 @@ export async function loadConfig(root, configFile) {
|
|
|
62
74
|
configFilePath = findConfig(path.resolve('docs', DEFAULT_CONFIG_NAME));
|
|
63
75
|
}
|
|
64
76
|
}
|
|
77
|
+
let config;
|
|
78
|
+
const { loadConfig, mergeRsbuildConfig } = await import('@rsbuild/core');
|
|
65
79
|
if (!configFilePath) {
|
|
66
80
|
logger.info(`No doom config file found in ${process.cwd()}`);
|
|
67
|
-
return {
|
|
68
|
-
config: {},
|
|
69
|
-
};
|
|
70
81
|
}
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
82
|
+
else {
|
|
83
|
+
try {
|
|
84
|
+
if (YAML_EXTENSIONS.includes(path.extname(configFilePath))) {
|
|
85
|
+
config = parse(fs.readFileSync(configFilePath, 'utf-8'));
|
|
86
|
+
}
|
|
87
|
+
else {
|
|
88
|
+
const { content } = await loadConfig({
|
|
89
|
+
cwd: path.dirname(configFilePath),
|
|
90
|
+
path: configFilePath,
|
|
91
|
+
});
|
|
92
|
+
config = content;
|
|
93
|
+
}
|
|
76
94
|
}
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
cwd: path.dirname(configFilePath),
|
|
80
|
-
path: configFilePath,
|
|
81
|
-
});
|
|
82
|
-
config = content;
|
|
95
|
+
catch {
|
|
96
|
+
logger.error(`Failed to load config from ${configFilePath}`);
|
|
83
97
|
}
|
|
84
98
|
}
|
|
85
|
-
catch {
|
|
86
|
-
logger.error(`Failed to load config from ${configFilePath}`);
|
|
87
|
-
}
|
|
88
99
|
const mergedConfig = mergeRsbuildConfig(COMMON_CONFIG, config ?? {});
|
|
89
100
|
const base = addLeadingSlash(mergedConfig.base || '/');
|
|
90
101
|
mergedConfig.base = base;
|
|
@@ -108,7 +119,7 @@ export async function loadConfig(root, configFile) {
|
|
|
108
119
|
}
|
|
109
120
|
if (mergedConfig.i18nSourcePath) {
|
|
110
121
|
if (!path.isAbsolute(mergedConfig.i18nSourcePath)) {
|
|
111
|
-
mergedConfig.i18nSourcePath = path.resolve(configFilePath, mergedConfig.i18nSourcePath);
|
|
122
|
+
mergedConfig.i18nSourcePath = path.resolve(configFilePath ?? mergedConfig.root, mergedConfig.i18nSourcePath);
|
|
112
123
|
}
|
|
113
124
|
}
|
|
114
125
|
else {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@alauda/doom",
|
|
3
|
-
"version": "0.0.0-alpha.
|
|
3
|
+
"version": "0.0.0-alpha.11",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Doctor Doom making docs.",
|
|
6
6
|
"repository": "https://gitlab-ce.alauda.cn/idp/Doom",
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
"swc-node": "node --enable-source-maps --import @swc-node/register/esm-register"
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@rspress/core": "^1.
|
|
36
|
+
"@rspress/core": "^1.36.0",
|
|
37
37
|
"chokidar": "^4.0.1",
|
|
38
38
|
"commander": "^12.1.0",
|
|
39
39
|
"rehype-raw": "^6.1.1",
|
|
@@ -41,20 +41,20 @@
|
|
|
41
41
|
"yoctocolors": "^2.1.1"
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|
|
44
|
-
"@eslint/js": "^9.
|
|
44
|
+
"@eslint/js": "^9.14.0",
|
|
45
45
|
"@swc-node/register": "^1.10.9",
|
|
46
|
-
"@swc/core": "1.
|
|
46
|
+
"@swc/core": "1.9.2",
|
|
47
47
|
"@types/eslint__js": "^8.42.3",
|
|
48
48
|
"@types/fs-extra": "^11.0.4",
|
|
49
49
|
"@types/node": "~18.13.0",
|
|
50
|
-
"eslint": "^9.
|
|
50
|
+
"eslint": "^9.14.0",
|
|
51
51
|
"lint-staged": "^15.2.10",
|
|
52
52
|
"npm-run-all2": "^7.0.1",
|
|
53
53
|
"prettier": "^3.3.3",
|
|
54
54
|
"prettier-plugin-pkg": "^0.18.1",
|
|
55
55
|
"simple-git-hooks": "^2.11.1",
|
|
56
56
|
"typescript": "^5.6.3",
|
|
57
|
-
"typescript-eslint": "^8.
|
|
57
|
+
"typescript-eslint": "^8.14.0"
|
|
58
58
|
},
|
|
59
59
|
"publishConfig": {
|
|
60
60
|
"access": "public"
|