mirror of
https://github.com/facebook/docusaurus.git
synced 2025-08-03 00:39:45 +02:00
feat(v2): allow plugin to extendCli (#1843)
* feat(v2): allow plugin to extendCli * rename to externalCommand
This commit is contained in:
parent
46e8e03be0
commit
b1f6951fbb
10 changed files with 137 additions and 52 deletions
|
@ -130,6 +130,23 @@ configureWebpack(config, isServer, {getBabelLoader, getCacheLoader}) {
|
|||
},
|
||||
```
|
||||
|
||||
## extendCli(cli)
|
||||
|
||||
Register an extra command to enhance the CLI of docusaurus. `cli` is [commander](https://www.npmjs.com/package/commander) object.
|
||||
|
||||
Example:
|
||||
|
||||
```js
|
||||
extendCli(cli) {
|
||||
cli
|
||||
.command('roll')
|
||||
.description('Roll a random number between 1 and 1000')
|
||||
.action(() => {
|
||||
console.log(Math.floor(Math.random() * 1000 + 1));
|
||||
});
|
||||
},
|
||||
```
|
||||
|
||||
<!--
|
||||
For example, the in docusaurus-plugin-content-docs:
|
||||
|
||||
|
@ -210,6 +227,10 @@ module.exports = function(context, opts) {
|
|||
// in the client bundle. These modules are imported globally before
|
||||
// React even renders the initial UI.
|
||||
},
|
||||
|
||||
extendCli(cli) {
|
||||
// Register an extra command to enhance the CLI of docusaurus
|
||||
},
|
||||
};
|
||||
};
|
||||
```
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue