forked from umijs/umi
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* support command:plugin * bugfix:presets未定义时,UMI_PRESETS为undefined * code formatting * filter plugin.ts * pnpm format
- Loading branch information
Showing
4 changed files
with
44 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,10 @@ | ||
{ | ||
"scripts": { | ||
"dev": "../../packages/umi/bin/umi.js dev" | ||
"start": "pnpm run dev", | ||
"dev": "umi dev", | ||
"plugin": "umi plugin" | ||
}, | ||
"devDependencies": {} | ||
"devDependencies": { | ||
"umi": "workspace:*" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import { IApi } from '../types'; | ||
|
||
export default (api: IApi) => { | ||
api.registerCommand({ | ||
name: 'plugin', | ||
description: 'inspect umi plugins', | ||
fn({ args }) { | ||
const command = args._[0]; | ||
console.log('command', command); | ||
|
||
if (!command) { | ||
throw new Error(` | ||
Sub command not found: umi plugin | ||
Did you mean: | ||
umi plugin list | ||
`); | ||
} | ||
switch (command) { | ||
case 'list': | ||
getPluginList(); | ||
break; | ||
default: | ||
throw new Error(`Unsupported sub command ${command} for umi plugin.`); | ||
} | ||
function getPluginList() { | ||
Object.keys(api.service.plugins).forEach((pluginId: string) => { | ||
const plugin = api.service.plugins[pluginId]; | ||
console.info(`- ${plugin.id}`); | ||
}); | ||
} | ||
}, | ||
}); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.