Skip to content

Commit 4f8931f

Browse files
authored
Fix: Allow plugin paths to be relative in webdoc.conf.json (#154)
1 parent fdba115 commit 4f8931f

File tree

4 files changed

+21
-3
lines changed

4 files changed

+21
-3
lines changed

.idea/codestream.xml

Lines changed: 7 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
console.log("plugin-hello-world: Hello world!");

example/webdoc.conf.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33
"include": "./src/**/*"
44
},
55
"plugins": [
6-
"plugins/markdown"
6+
"plugins/markdown",
7+
"./plugins/plugin-hello-world.js"
78
],
89
"template": {
910
"readme": "./README.md",

packages/webdoc-cli/src/index.js

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,8 +90,17 @@ async function main(argv: yargs.Argv) {
9090
}
9191

9292
// Plugin should invoke installPlugin to whatever APIs it uses.
93-
// $FlowFixMe
94-
require(pluginPath);
93+
try {
94+
// $FlowFixMe
95+
require(pluginPath);
96+
} catch {
97+
try {
98+
// $FlowFixMe
99+
require(path.join(path.dirname(argv.config), pluginPath));
100+
} catch {
101+
log.error(tag.CLI, `Failed to resolve plugin: ${pluginPath}`);
102+
}
103+
}
95104
}
96105
}
97106

0 commit comments

Comments
 (0)