README
Aviana 前端微应用插件(Vue 版本),基于 axios, vue-router, Element UI, lodash
** 插件说明 **
- 插件使用:
import AvianaPlugin from "aviana-plugin-vue";
Vue.use(AvianaPlugin, {
entry: App,
routes: routes,
store: store,
config: config,
});
const { start, bootstrap, mount, unmount } = AvianaPlugin;
export { bootstrap, mount, unmount };
start();
- 插件提供:
1. 封装微应用的注册逻辑
2. 全局的 $http 对象,通过config中的httpConfig, httpMock注册接口及mock数据
提供设置独立运行时Token及网络状态获取方法 { setIsolatedToken, getHttpInfo }
提供网络调用方法 { domain, fileDomain, get, getBy, post, update, remove, removeBy }
3. 全局的 $iac 对象,提供发布消息,监听消息,获取全局数据等方法
提供应用间通信方法 { name, obtainApp, open, set, get, getOwn, emit, on, once, release, call, callOwn }
4. 全局混入响应式的 userInfo, companyInfo, token
5. 可在 config 配置defaultUser, defaultCompany, mock用于单应用开发调试
6. 全局的 log 方法,可在 template 中直接打印变量值进行调试
** 发布 NPM 包到 Github Packages **
- 在 Github 申请一个 TOKEN, 用来发布和获取 npm 包
- 在本项目的根目录添加 .npmrc 文件,并添加如下配置 registry=https://npm.pkg.github.com //npm.pkg.github.com/:_authToken=TOKEN
- 在 package.json 中更新版本号, npm run build:lib 打包库文件
- npm publish 发布包到 Github
** 其他工程获取 NPM 包 **
- 在 package.json 添加依赖 "@ucloudcastle/aviana-plugin-vue": "^x.x.x"
- 拷贝本项目下的 .npmrc 文件
- npm install
** 发布 NPM 包到 npmjs **
- 到 https://www.npmjs.com/ 注册账户并申请 Token, 用来发布和获取 npm 包
- 在本项目的根目录添加 .npmrc 文件,并添加如下配置 registry=http://registry.npmjs.org //registry.npmjs.org/:_authToken=TOKEN
- 在 package.json 中更新版本号, npm run build:lib 打包库文件
- npm publish 发布包到 npmjs
** 其他工程获取 NPM 包 **
- 在 package.json 添加依赖 "aviana-plugin-vue": "^x.x.x"
- npm install
** 代码打包说明 **
npm run build builds the library to dist, generating three files:
dist/aviana-plugin-vue.cjs.jsA CommonJS bundle, suitable for use in Node.js, thatrequires the external dependency. This corresponds to the"main"field in package.jsondist/dist/aviana-plugin-vue.esm.jsan ES module bundle, suitable for use in other people's libraries and applications, thatimports the external dependency. This corresponds to the"module"field in package.jsondist/dist/aviana-plugin-vue.umd.jsa UMD build, suitable for use in any environment (including the browser, as a<script>tag), that includes the external dependency. This corresponds to the"browser"field in package.json
npm run dev builds the library, then keeps rebuilding it whenever the source files change using rollup-watch.
npm test builds the library, then tests it.