Pluggable micro application framework.
基于webpack多入口的多仓库业务模块开发的插件应用框架核心库.
yarn add @micro-app/coreor
npm install -D @micro-app/corenpx micro-app initmodule.exports={name: '@micro-app/demo',description: '',version: '0.0.1',type: '',// type 类型staticPath: '',// String | Arrayentry: {// 入口main: './test/index.js',},// htmls: [ // 输出模版配置// {// template: './test/index.js',// },// ],alias: {// 别名配置api: '',config: {link: '',description: '配置',},service: {link: '',description: '接口',type: 'server',},},strict: true,// 严格强依赖模式micros: ['test'],// 被注册的容器plugins: [// 自定义插件// [{// id: 'test',// description: '这是test',// link: __dirname + '/test/testPlugin',// }, {// a: 1,// }],],};"dependencies": {
"@micro-app/test": "git+ssh://git@github.com/micro-app.git#test"
},constapi=require('@micro-demo/api');plugins: [[// 1{id: 'test',// 插件 iddescription: '这是test',// 插件描述link: __dirname+'/test/testPlugin.js',// 插件地址},{// 注册入的 optsa: 1,}],],文件必须返回一个方法.
module.exports=function(api,opts){console.log(opts);api.onInitDone(item=>{console.log('init Done',item);});api.onInitDone(()=>{console.log('init Done2',api.getState('webpackConfig'));});api.onPluginInitDone(item=>{console.log('onPluginInitDone',item);});};可通过如下命令进行动态查看
npxmicro-appshowmethods以提供的方法如下, System Build-in 为内置方法
╰─➤npxmicro-appshowmethodsPluginMethods:
*onPluginInitDone(SystemBuild-in)*beforeMergeConfig(SystemBuild-in)*afterMergeConfig(SystemBuild-in)*onInitWillDone(SystemBuild-in)*onInitDone(SystemBuild-in)*modifyCommand(SystemBuild-in)*onRunCommand(SystemBuild-in)*modifyCommandHelp(SystemBuild-in)╰─➤npxmicro-apphelp
Usage: micro-app<command>[options]Commands:
*show(showalias&sharedlist,etc.)*check(checkalldependencies.)*version(showversion)*start(runsserverforproduction)*serve(runsserverfordevelopment)*build(buildforproduction)*update(updatepackage.json)*deploy(synccommitstatus.)runmicro-apphelp[command]forusageofaspecificcommand.npxmicro-appshowmicrosnpxmicro-appshowaliasnpxmicro-appshowshared