-
-
Notifications
You must be signed in to change notification settings - Fork 95
/
@docusaurus-core-npm-2.1.0-ee70472f68.patch
55 lines (54 loc) · 2.71 KB
/
@docusaurus-core-npm-2.1.0-ee70472f68.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
diff --git a/bin/docusaurus.mjs b/bin/docusaurus.mjs
index a9df67b31e6d0a41ff85438bfaa47ef195bf0c8e..98a03e66e51d22d34b182e40324ab475840d93a6 100755
--- a/bin/docusaurus.mjs
+++ b/bin/docusaurus.mjs
@@ -77,6 +77,10 @@ cli
'copy TypeScript theme files when possible (default: false)',
)
.option('--danger', 'enable swizzle for unsafe component of themes')
+ .option(
+ '--config <config>',
+ 'path to Docusaurus config file (default: `[siteDir]/docusaurus.config.js`)',
+ )
.action(swizzle);
cli
diff --git a/lib/commands/swizzle/common.js b/lib/commands/swizzle/common.js
index d17b3eb609b0ee991029bc87b2060aad24c80e44..3d5d755e405b45382fc642ae61fe6e26e53a9c1a 100644
--- a/lib/commands/swizzle/common.js
+++ b/lib/commands/swizzle/common.js
@@ -43,6 +43,7 @@ function normalizeOptions(options) {
list: options.list ?? false,
wrap: options.wrap ?? false,
eject: options.eject ?? false,
+ config: options.config ?? undefined
};
}
exports.normalizeOptions = normalizeOptions;
diff --git a/lib/commands/swizzle/context.js b/lib/commands/swizzle/context.js
index 1bbac3d8437516c635dfeaefbbed492b6d8e4281..ea5eef59d926a3c380b429d418cdfa04780600cf 100644
--- a/lib/commands/swizzle/context.js
+++ b/lib/commands/swizzle/context.js
@@ -10,8 +10,8 @@ exports.initSwizzleContext = void 0;
const server_1 = require("../../server");
const init_1 = require("../../server/plugins/init");
const configs_1 = require("../../server/plugins/configs");
-async function initSwizzleContext(siteDir) {
- const context = await (0, server_1.loadContext)({ siteDir });
+async function initSwizzleContext(siteDir, options) {
+ const context = await (0, server_1.loadContext)({ siteDir, config: options.config });
const plugins = await (0, init_1.initPlugins)(context);
const pluginConfigs = await (0, configs_1.loadPluginConfigs)(context);
return {
diff --git a/lib/commands/swizzle/index.js b/lib/commands/swizzle/index.js
index 8522917836c2dc36779353eb044ec79d326b445f..83e41349c4f8dfad50f59f8bce17e991b2ed588e 100644
--- a/lib/commands/swizzle/index.js
+++ b/lib/commands/swizzle/index.js
@@ -62,7 +62,7 @@ async function swizzle(themeNameParam = undefined, componentNameParam = undefine
const siteDir = await fs_extra_1.default.realpath(siteDirParam);
const options = (0, common_1.normalizeOptions)(optionsParam);
const { list, danger, typescript } = options;
- const { plugins } = await (0, context_1.initSwizzleContext)(siteDir);
+ const { plugins } = await (0, context_1.initSwizzleContext)(siteDir, options);
const themeNames = (0, themes_1.getThemeNames)(plugins);
if (list && !themeNameParam) {
await listAllThemeComponents({ themeNames, plugins, typescript });