@maxelms/create-plugin-cli 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.en.md +36 -0
- package/README.md +12 -0
- package/bin/build.js +29 -0
- package/bin/compress.js +35 -0
- package/bin/copy.js +39 -0
- package/bin/index.js +53 -0
- package/configuration-schema.json +829 -0
- package/lib/index.d.ts +21 -0
- package/lib/index.js +242 -0
- package/lib/utils.d.ts +18 -0
- package/lib/utils.js +114 -0
- package/package.json +50 -0
- package/templates/jQuery-micro-app/package.json.tpl +19 -0
- package/templates/jQuery-micro-app/src/README.md +5 -0
- package/templates/jQuery-micro-app/src/configuration.json +30 -0
- package/templates/jQuery-micro-app/src/index.html +17 -0
- package/templates/jQuery-micro-app/src/main.js.tpl +31 -0
- package/templates/jQuery-micro-app/src/manifest.json.tpl +9 -0
- package/templates/jQuery-micro-app/src/style.css +11 -0
- package/templates/maxelms-navigation/.babelrc +7 -0
- package/templates/maxelms-navigation/.gitignore.tpl +23 -0
- package/templates/maxelms-navigation/README.md +15 -0
- package/templates/maxelms-navigation/global.d.ts +2 -0
- package/templates/maxelms-navigation/index.html +16 -0
- package/templates/maxelms-navigation/package.json +65 -0
- package/templates/maxelms-navigation/patches/live2d-widget@3.1.4.patch +4534 -0
- package/templates/maxelms-navigation/pnpm-lock.yaml +7993 -0
- package/templates/maxelms-navigation/src/App.tsx +47 -0
- package/templates/maxelms-navigation/src/components/Actions/ColorPicker.tsx +86 -0
- package/templates/maxelms-navigation/src/components/Actions/SwitchApps.tsx +83 -0
- package/templates/maxelms-navigation/src/components/Actions/index.tsx +95 -0
- package/templates/maxelms-navigation/src/components/Cutie.tsx +24 -0
- package/templates/maxelms-navigation/src/components/Enterprises.tsx +46 -0
- package/templates/maxelms-navigation/src/components/Logo.tsx +29 -0
- package/templates/maxelms-navigation/src/components/Menus/MenuPanel.tsx +55 -0
- package/templates/maxelms-navigation/src/components/Menus/index.tsx +50 -0
- package/templates/maxelms-navigation/src/components/Search.tsx +77 -0
- package/templates/maxelms-navigation/src/imgs/corp-admin.svg +1 -0
- package/templates/maxelms-navigation/src/imgs/saas-admin.svg +1 -0
- package/templates/maxelms-navigation/src/imgs/skin.svg +1 -0
- package/templates/maxelms-navigation/src/imgs/tenant-admin.svg +1 -0
- package/templates/maxelms-navigation/src/imgs/user-center.svg +1 -0
- package/templates/maxelms-navigation/src/index.tsx +14 -0
- package/templates/maxelms-navigation/src/interface.ts +27 -0
- package/templates/maxelms-navigation/src/style.less.tpl +278 -0
- package/templates/maxelms-navigation/src/utils.ts.tpl +40 -0
- package/templates/maxelms-navigation/tsconfig.json +111 -0
- package/templates/maxelms-navigation/webpack.config.js +119 -0
- package/templates/maxelms-script/.babelrc +5 -0
- package/templates/maxelms-script/.gitignore.tpl +23 -0
- package/templates/maxelms-script/README.md +0 -0
- package/templates/maxelms-script/global.d.ts +2 -0
- package/templates/maxelms-script/index.html +10 -0
- package/templates/maxelms-script/package.json.tpl +55 -0
- package/templates/maxelms-script/pnpm-lock.yaml +7699 -0
- package/templates/maxelms-script/src/App.tsx +15 -0
- package/templates/maxelms-script/src/index.tsx +15 -0
- package/templates/maxelms-script/src/style.less.tpl +8 -0
- package/templates/maxelms-script/src/utils.ts.tpl +2 -0
- package/templates/maxelms-script/tsconfig.json +111 -0
- package/templates/maxelms-script/webpack.config.js +92 -0
- package/templates/maxelms-style/.gitignore.tpl +38 -0
- package/templates/maxelms-style/README.md +0 -0
- package/templates/maxelms-style/index.css +3 -0
- package/templates/maxelms-style/index.less +4 -0
- package/templates/maxelms-style/package.json.tpl +17 -0
- package/templates/playground/dist/main.css +2 -0
- package/templates/playground/dist/main.js +2 -0
- package/templates/playground/dist/main.js.LICENSE.txt +52 -0
- package/templates/playground/dist/playground.html +1 -0
- package/templates/playground/dist/react-dom.production.min.js +2 -0
- package/templates/playground/dist/react-dom.production.min.js.LICENSE.txt +8 -0
- package/templates/playground/dist/react.production.min.js +2 -0
- package/templates/playground/dist/react.production.min.js.LICENSE.txt +8 -0
- package/templates/playground/dist/zone.umd.min.js +2 -0
- package/templates/playground/dist/zone.umd.min.js.LICENSE.txt +29 -0
- package/templates/project/package.json +17 -0
- package/templates/react-micro-app/.babelrc +6 -0
- package/templates/react-micro-app/.gitignore.tpl +23 -0
- package/templates/react-micro-app/README.md +5 -0
- package/templates/react-micro-app/manifest.json.tpl +21 -0
- package/templates/react-micro-app/package.json.tpl +53 -0
- package/templates/react-micro-app/public/configuration.json +30 -0
- package/templates/react-micro-app/public/index.html +10 -0
- package/templates/react-micro-app/src/components/NoMatch.tsx +15 -0
- package/templates/react-micro-app/src/context/masterContext.ts +11 -0
- package/templates/react-micro-app/src/index.tsx +52 -0
- package/templates/react-micro-app/src/layouts/BasicLayout.less +16 -0
- package/templates/react-micro-app/src/layouts/BasicLayout.tsx +21 -0
- package/templates/react-micro-app/src/pages/Home/index.less +15 -0
- package/templates/react-micro-app/src/pages/Home/index.tsx +33 -0
- package/templates/react-micro-app/src/pages/List/index.less +12 -0
- package/templates/react-micro-app/src/pages/List/index.tsx +12 -0
- package/templates/react-micro-app/src/pages/New/index.less +12 -0
- package/templates/react-micro-app/src/pages/New/index.tsx +12 -0
- package/templates/react-micro-app/src/pages/View/index.less +12 -0
- package/templates/react-micro-app/src/pages/View/index.tsx +12 -0
- package/templates/react-micro-app/src/public-path.js +4 -0
- package/templates/react-micro-app/src/router.tsx +44 -0
- package/templates/react-micro-app/tsconfig.json +102 -0
- package/templates/react-micro-app/typings.d.ts +11 -0
- package/templates/react-micro-app/webpack.config.js.tpl +178 -0
- package/templates/react-micro-app-umi/.editorconfig +16 -0
- package/templates/react-micro-app-umi/.env +1 -0
- package/templates/react-micro-app-umi/.gitignore.tpl +23 -0
- package/templates/react-micro-app-umi/.prettierignore +8 -0
- package/templates/react-micro-app-umi/.prettierrc +11 -0
- package/templates/react-micro-app-umi/.umirc.ts.tpl +31 -0
- package/templates/react-micro-app-umi/README.md +5 -0
- package/templates/react-micro-app-umi/manifest.json.tpl +21 -0
- package/templates/react-micro-app-umi/package.json.tpl +42 -0
- package/templates/react-micro-app-umi/public/basicConfiguration.json +30 -0
- package/templates/react-micro-app-umi/public/configuration.json +30 -0
- package/templates/react-micro-app-umi/src/layout/BasicLayout.tsx +16 -0
- package/templates/react-micro-app-umi/src/pages/about.tsx +11 -0
- package/templates/react-micro-app-umi/src/pages/home.tsx +19 -0
- package/templates/react-micro-app-umi/tsconfig.json +36 -0
- package/templates/react-micro-app-umi/typings.d.ts +8 -0
- package/templates/react-micro-button/.gitignore.tpl +23 -0
- package/templates/react-micro-button/README.md +5 -0
- package/templates/react-micro-button/configuration/Configuration.tsx +113 -0
- package/templates/react-micro-button/configuration/index.css +8 -0
- package/templates/react-micro-button/configuration/index.tsx +6 -0
- package/templates/react-micro-button/manifest.json.tpl +3 -0
- package/templates/react-micro-button/package.json.tpl +49 -0
- package/templates/react-micro-button/postcss.config.js +5 -0
- package/templates/react-micro-button/public/basicConfiguration.json +30 -0
- package/templates/react-micro-button/public/configuration.html +10 -0
- package/templates/react-micro-button/public/configuration.json +30 -0
- package/templates/react-micro-button/public/index.html +10 -0
- package/templates/react-micro-button/src/App.tsx +41 -0
- package/templates/react-micro-button/src/app.less +0 -0
- package/templates/react-micro-button/src/index.less +0 -0
- package/templates/react-micro-button/src/index.tsx +30 -0
- package/templates/react-micro-button/tsconfig.json +11 -0
- package/templates/react-micro-button/webpack.config.js.tpl +150 -0
- package/templates/react-micro-field/.babelrc +5 -0
- package/templates/react-micro-field/.gitignore.tpl +23 -0
- package/templates/react-micro-field/README.md +5 -0
- package/templates/react-micro-field/configuration/Configuration.tsx +113 -0
- package/templates/react-micro-field/configuration/index.css +8 -0
- package/templates/react-micro-field/configuration/index.tsx +6 -0
- package/templates/react-micro-field/manifest.json.tpl +7 -0
- package/templates/react-micro-field/package.json.tpl +50 -0
- package/templates/react-micro-field/postcss.config.js +5 -0
- package/templates/react-micro-field/public/basicConfiguration.json +30 -0
- package/templates/react-micro-field/public/configuration.html +10 -0
- package/templates/react-micro-field/public/configuration.json +30 -0
- package/templates/react-micro-field/public/index.html +10 -0
- package/templates/react-micro-field/src/App.tsx.tpl +51 -0
- package/templates/react-micro-field/src/index.tsx +29 -0
- package/templates/react-micro-field/src/style.less.tpl +12 -0
- package/templates/react-micro-field/tsconfig.json +11 -0
- package/templates/react-micro-field/webpack.config.js.tpl +157 -0
- package/templates/react-micro-field-umi/.editorconfig +16 -0
- package/templates/react-micro-field-umi/.gitignore.tpl +24 -0
- package/templates/react-micro-field-umi/.prettierignore +8 -0
- package/templates/react-micro-field-umi/.prettierrc +11 -0
- package/templates/react-micro-field-umi/README.md +5 -0
- package/templates/react-micro-field-umi/config/config.ts.tpl +41 -0
- package/templates/react-micro-field-umi/config/plugin.ts +18 -0
- package/templates/react-micro-field-umi/manifest.json.tpl +7 -0
- package/templates/react-micro-field-umi/package.json.tpl +48 -0
- package/templates/react-micro-field-umi/public/basicConfiguration.json +30 -0
- package/templates/react-micro-field-umi/public/configuration.json +30 -0
- package/templates/react-micro-field-umi/src/app.tsx +46 -0
- package/templates/react-micro-field-umi/src/global.tsx +0 -0
- package/templates/react-micro-field-umi/src/hooks/masterProps.ts +33 -0
- package/templates/react-micro-field-umi/src/layouts/BasicLayout.tsx +17 -0
- package/templates/react-micro-field-umi/src/pages/configuration/index.tsx +90 -0
- package/templates/react-micro-field-umi/src/pages/index.tsx.tpl +54 -0
- package/templates/react-micro-field-umi/src/pages/interface.ts +12 -0
- package/templates/react-micro-field-umi/src/pages/style.less.tpl +15 -0
- package/templates/react-micro-field-umi/src/public-path.js +5 -0
- package/templates/react-micro-field-umi/tsconfig.json +37 -0
- package/templates/react-micro-field-umi/typings.d.ts +10 -0
- package/templates/react-micro-plugin/.babelrc +5 -0
- package/templates/react-micro-plugin/.gitignore.tpl +23 -0
- package/templates/react-micro-plugin/README.md +5 -0
- package/templates/react-micro-plugin/configuration/Configuration.tsx +114 -0
- package/templates/react-micro-plugin/configuration/index.css +8 -0
- package/templates/react-micro-plugin/configuration/index.tsx +6 -0
- package/templates/react-micro-plugin/manifest.json.tpl +3 -0
- package/templates/react-micro-plugin/package.json.tpl +50 -0
- package/templates/react-micro-plugin/postcss.config.js +5 -0
- package/templates/react-micro-plugin/public/configuration.html +10 -0
- package/templates/react-micro-plugin/public/configuration.json +30 -0
- package/templates/react-micro-plugin/public/index.html +10 -0
- package/templates/react-micro-plugin/src/App.tsx.tpl +32 -0
- package/templates/react-micro-plugin/src/index.tsx +29 -0
- package/templates/react-micro-plugin/src/style.less.tpl +12 -0
- package/templates/react-micro-plugin/tsconfig.json +11 -0
- package/templates/react-micro-plugin/webpack.config.js.tpl +156 -0
- package/templates/react-micro-plugin-umi/.editorconfig +16 -0
- package/templates/react-micro-plugin-umi/.gitignore.tpl +24 -0
- package/templates/react-micro-plugin-umi/.prettierignore +8 -0
- package/templates/react-micro-plugin-umi/.prettierrc +11 -0
- package/templates/react-micro-plugin-umi/README.md +5 -0
- package/templates/react-micro-plugin-umi/config/config.ts +29 -0
- package/templates/react-micro-plugin-umi/config/plugin.ts +18 -0
- package/templates/react-micro-plugin-umi/manifest.json.tpl +3 -0
- package/templates/react-micro-plugin-umi/package.json.tpl +48 -0
- package/templates/react-micro-plugin-umi/public/configuration.json +30 -0
- package/templates/react-micro-plugin-umi/src/app.tsx +46 -0
- package/templates/react-micro-plugin-umi/src/global.tsx +0 -0
- package/templates/react-micro-plugin-umi/src/hooks/masterProps.ts +34 -0
- package/templates/react-micro-plugin-umi/src/layouts/BasicLayout.tsx +17 -0
- package/templates/react-micro-plugin-umi/src/pages/configuration/index.tsx +113 -0
- package/templates/react-micro-plugin-umi/src/pages/index.tsx +21 -0
- package/templates/react-micro-plugin-umi/src/public-path.js +5 -0
- package/templates/react-micro-plugin-umi/tsconfig.json +37 -0
- package/templates/react-micro-plugin-umi/typings.d.ts +10 -0
- package/templates/vue-micro-app/.gitignore.tpl +23 -0
- package/templates/vue-micro-app/README.md +5 -0
- package/templates/vue-micro-app/babel.config.js +15 -0
- package/templates/vue-micro-app/manifest.json.tpl +21 -0
- package/templates/vue-micro-app/package.json.tpl +54 -0
- package/templates/vue-micro-app/public/configuration.json +30 -0
- package/templates/vue-micro-app/public/favicon.ico +0 -0
- package/templates/vue-micro-app/public/index.html +10 -0
- package/templates/vue-micro-app/src/App.vue +35 -0
- package/templates/vue-micro-app/src/assets/logo.png +0 -0
- package/templates/vue-micro-app/src/components/HelloWorld.vue +32 -0
- package/templates/vue-micro-app/src/main.js +80 -0
- package/templates/vue-micro-app/src/public-path.js +5 -0
- package/templates/vue-micro-app/src/routes.js +19 -0
- package/templates/vue-micro-app/src/views/About.vue +13 -0
- package/templates/vue-micro-app/src/views/Home.vue +21 -0
- package/templates/vue-micro-app/vue.config.js.tpl +35 -0
- package/templates/vue-micro-button/.gitignore.tpl +23 -0
- package/templates/vue-micro-button/README.md +5 -0
- package/templates/vue-micro-button/babel.config.js +8 -0
- package/templates/vue-micro-button/configuration/App.vue +78 -0
- package/templates/vue-micro-button/configuration/main.js +11 -0
- package/templates/vue-micro-button/manifest.json.tpl +3 -0
- package/templates/vue-micro-button/package.json.tpl +51 -0
- package/templates/vue-micro-button/public/basicConfiguration.json +30 -0
- package/templates/vue-micro-button/public/configuration.html +10 -0
- package/templates/vue-micro-button/public/configuration.json +30 -0
- package/templates/vue-micro-button/public/index.html +12 -0
- package/templates/vue-micro-button/src/App.vue +46 -0
- package/templates/vue-micro-button/src/main.js +44 -0
- package/templates/vue-micro-button/vue.config.js.tpl +51 -0
- package/templates/vue-micro-field/.gitignore.tpl +23 -0
- package/templates/vue-micro-field/README.md +5 -0
- package/templates/vue-micro-field/babel.config.js +8 -0
- package/templates/vue-micro-field/configuration/App.vue +78 -0
- package/templates/vue-micro-field/configuration/main.js +11 -0
- package/templates/vue-micro-field/manifest.json.tpl +7 -0
- package/templates/vue-micro-field/package.json.tpl +53 -0
- package/templates/vue-micro-field/public/basicConfiguration.json +30 -0
- package/templates/vue-micro-field/public/configuration.html +10 -0
- package/templates/vue-micro-field/public/configuration.json +30 -0
- package/templates/vue-micro-field/public/index.html +10 -0
- package/templates/vue-micro-field/scripts/compress.js +32 -0
- package/templates/vue-micro-field/src/App.vue.tpl +55 -0
- package/templates/vue-micro-field/src/main.js +38 -0
- package/templates/vue-micro-field/src/style.less.tpl +16 -0
- package/templates/vue-micro-field/vue.config.js.tpl +51 -0
- package/templates/vue-micro-plugin/.gitignore.tpl +23 -0
- package/templates/vue-micro-plugin/README.md +24 -0
- package/templates/vue-micro-plugin/babel.config.js +8 -0
- package/templates/vue-micro-plugin/configuration/App.vue +100 -0
- package/templates/vue-micro-plugin/configuration/main.js +11 -0
- package/templates/vue-micro-plugin/manifest.json.tpl +3 -0
- package/templates/vue-micro-plugin/package.json.tpl +56 -0
- package/templates/vue-micro-plugin/public/configuration.html +10 -0
- package/templates/vue-micro-plugin/public/configuration.json +30 -0
- package/templates/vue-micro-plugin/public/index.html +10 -0
- package/templates/vue-micro-plugin/scripts/compress.js +32 -0
- package/templates/vue-micro-plugin/src/App.vue.tpl +42 -0
- package/templates/vue-micro-plugin/src/main.js +38 -0
- package/templates/vue-micro-plugin/src/style.less.tpl +16 -0
- package/templates/vue-micro-plugin/vue.config.js.tpl +53 -0
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "<%= pluginName %>",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"private": true,
|
|
5
|
+
"scripts": {
|
|
6
|
+
"serve": "vue-cli-service serve",
|
|
7
|
+
"build": "vue-cli-service build && maxelms-plugin-cli -c",
|
|
8
|
+
"start": "npm run serve",
|
|
9
|
+
"lint": "vue-cli-service lint"
|
|
10
|
+
},
|
|
11
|
+
"dependencies": {
|
|
12
|
+
"core-js": "3.6.5",
|
|
13
|
+
"vue": "2.6.11",
|
|
14
|
+
"vue-router": "3.5.3",
|
|
15
|
+
"vuex": "3.6.2"
|
|
16
|
+
},
|
|
17
|
+
"devDependencies": {
|
|
18
|
+
"@maxelms/create-plugin-cli": "<%= cliVersion %>",
|
|
19
|
+
"@vue/cli-plugin-babel": "4.5.0",
|
|
20
|
+
"@vue/cli-plugin-eslint": "4.5.0",
|
|
21
|
+
"@vue/cli-service": "4.5.0",
|
|
22
|
+
"archiver": "5.3.1",
|
|
23
|
+
"babel-eslint": "10.1.0",
|
|
24
|
+
"babel-plugin-component": "1.1.1",
|
|
25
|
+
"copy-webpack-plugin": "5.1.1",
|
|
26
|
+
"eslint": "6.7.2",
|
|
27
|
+
"eslint-plugin-vue": "6.2.2",
|
|
28
|
+
"less": "4.1.3",
|
|
29
|
+
"less-loader": "5.0.0",
|
|
30
|
+
"sass": "1.47.0",
|
|
31
|
+
"sass-loader": "8.0.2",
|
|
32
|
+
"url-loader": "2.2.0",
|
|
33
|
+
"vue-template-compiler": "2.6.11"
|
|
34
|
+
},
|
|
35
|
+
"eslintConfig": {
|
|
36
|
+
"root": true,
|
|
37
|
+
"env": {
|
|
38
|
+
"node": true
|
|
39
|
+
},
|
|
40
|
+
"extends": [
|
|
41
|
+
"plugin:vue/essential",
|
|
42
|
+
"eslint:recommended"
|
|
43
|
+
],
|
|
44
|
+
"parserOptions": {
|
|
45
|
+
"parser": "babel-eslint"
|
|
46
|
+
},
|
|
47
|
+
"rules": {}
|
|
48
|
+
},
|
|
49
|
+
"browserslist": [
|
|
50
|
+
"> 1%",
|
|
51
|
+
"last 2 versions",
|
|
52
|
+
"not dead"
|
|
53
|
+
]
|
|
54
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
{
|
|
2
|
+
"propName1": {
|
|
3
|
+
"label": "配置项一",
|
|
4
|
+
"type": "string",
|
|
5
|
+
"defaultValue": "配置项内容"
|
|
6
|
+
},
|
|
7
|
+
"propName2": {
|
|
8
|
+
"label": "配置项二",
|
|
9
|
+
"type": "number",
|
|
10
|
+
"defaultValue": 350
|
|
11
|
+
},
|
|
12
|
+
"propName3": {
|
|
13
|
+
"label": "配置项三",
|
|
14
|
+
"type": "select",
|
|
15
|
+
"options": [
|
|
16
|
+
{
|
|
17
|
+
"label": "选项1",
|
|
18
|
+
"value": "option1"
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
"label": "选项2",
|
|
22
|
+
"value": "option2"
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
"label": "选项3",
|
|
26
|
+
"value": "option3"
|
|
27
|
+
}
|
|
28
|
+
]
|
|
29
|
+
}
|
|
30
|
+
}
|
|
Binary file
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div id="app">
|
|
3
|
+
<div id="nav">
|
|
4
|
+
<router-link :to="{name: 'home'}">Home</router-link>
|
|
5
|
+
|
|
|
6
|
+
<router-link :to="{name: 'about'}">About</router-link>
|
|
7
|
+
</div>
|
|
8
|
+
<router-view></router-view>
|
|
9
|
+
</div>
|
|
10
|
+
</template>
|
|
11
|
+
<script>
|
|
12
|
+
export default {
|
|
13
|
+
|
|
14
|
+
}
|
|
15
|
+
</script>
|
|
16
|
+
<style>
|
|
17
|
+
#app {
|
|
18
|
+
text-align: center;
|
|
19
|
+
color: #2c3e50;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
#nav {
|
|
23
|
+
padding-bottom: 20px;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
#nav a {
|
|
27
|
+
font-weight: bold;
|
|
28
|
+
color: #2c3e50;
|
|
29
|
+
text-decoration: none;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
#nav a.router-link-exact-active {
|
|
33
|
+
color: #42b983;
|
|
34
|
+
}
|
|
35
|
+
</style>
|
|
Binary file
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="hello"></div>
|
|
3
|
+
</template>
|
|
4
|
+
|
|
5
|
+
<script>
|
|
6
|
+
export default {
|
|
7
|
+
name: 'HelloWorld',
|
|
8
|
+
data() {
|
|
9
|
+
return {
|
|
10
|
+
|
|
11
|
+
}
|
|
12
|
+
},
|
|
13
|
+
methods: {
|
|
14
|
+
|
|
15
|
+
},
|
|
16
|
+
computed: {
|
|
17
|
+
|
|
18
|
+
},
|
|
19
|
+
watch: {
|
|
20
|
+
|
|
21
|
+
},
|
|
22
|
+
created() {
|
|
23
|
+
},
|
|
24
|
+
props: {
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
</script>
|
|
28
|
+
|
|
29
|
+
<!-- Add "scoped" attribute to limit CSS to this component only -->
|
|
30
|
+
<style scoped>
|
|
31
|
+
|
|
32
|
+
</style>
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import Vue from 'vue'
|
|
2
|
+
import VueRouter from 'vue-router'
|
|
3
|
+
import App from './App.vue'
|
|
4
|
+
import routes from './routes'
|
|
5
|
+
import './public-path'
|
|
6
|
+
|
|
7
|
+
Vue.use(VueRouter)
|
|
8
|
+
|
|
9
|
+
Vue.config.productionTip = false
|
|
10
|
+
|
|
11
|
+
const rootId = 'micro-app'
|
|
12
|
+
|
|
13
|
+
/** 为 hash 路由添加路由前缀 */
|
|
14
|
+
const addRoutesBase = (base, routes) => {
|
|
15
|
+
if (!base) return routes
|
|
16
|
+
if (!Array.isArray(routes)) return []
|
|
17
|
+
return routes.map(item => {
|
|
18
|
+
const { path, children } = item
|
|
19
|
+
const prefix = base?.endsWith('/') ? base.slice(0, base.length-1): base
|
|
20
|
+
return {
|
|
21
|
+
...item,
|
|
22
|
+
path: `${prefix}${path}`,
|
|
23
|
+
children: addRoutesBase(base, children)
|
|
24
|
+
}
|
|
25
|
+
})
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/** vue 实例 */
|
|
29
|
+
let vm = null
|
|
30
|
+
/** 路由实例 */
|
|
31
|
+
let router = null
|
|
32
|
+
const render = (props = {}) => {
|
|
33
|
+
const { container, base } = props;
|
|
34
|
+
const root = container ? container.querySelector(`#${rootId}`) : document.getElementById(rootId)
|
|
35
|
+
router = new VueRouter({
|
|
36
|
+
routes: addRoutesBase(base, routes),
|
|
37
|
+
})
|
|
38
|
+
|
|
39
|
+
vm = new Vue({
|
|
40
|
+
data: {
|
|
41
|
+
masterProps: props,
|
|
42
|
+
},
|
|
43
|
+
router,
|
|
44
|
+
render: h => h(App),
|
|
45
|
+
}).$mount(root)
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/** 独立开发环境 */
|
|
49
|
+
if (!window.__POWERED_BY_QIANKUN__) {
|
|
50
|
+
render()
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* 以下生命周期将会在 apaas 基座环境中被调用
|
|
55
|
+
* 是基座应用与微应用通信的桥梁
|
|
56
|
+
* 开发者可以根据业务需求在不同的生命周期中编写业务代码
|
|
57
|
+
*/
|
|
58
|
+
|
|
59
|
+
/** 初始化周期 */
|
|
60
|
+
export async function bootstrap() {
|
|
61
|
+
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/** 挂载周期 */
|
|
65
|
+
export async function mount(props) {
|
|
66
|
+
render(props)
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/** 状态更新周期 */
|
|
70
|
+
export async function update(props) {
|
|
71
|
+
vm.masterProps = props
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/** 卸载周期 */
|
|
75
|
+
export async function unmount() {
|
|
76
|
+
vm.$destroy();
|
|
77
|
+
vm.$el.innerHTML = '';
|
|
78
|
+
vm = null
|
|
79
|
+
router = null;
|
|
80
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import Home from './views/Home.vue';
|
|
2
|
+
import About from './views/About.vue';
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
const routes = [
|
|
6
|
+
{
|
|
7
|
+
path: '/',
|
|
8
|
+
name: 'home',
|
|
9
|
+
component: Home,
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
path: '/about',
|
|
13
|
+
name: 'about',
|
|
14
|
+
component: About,
|
|
15
|
+
},
|
|
16
|
+
];
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
export default routes
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div>
|
|
3
|
+
home
|
|
4
|
+
<HelloWorld></HelloWorld>
|
|
5
|
+
</div>
|
|
6
|
+
|
|
7
|
+
</template>
|
|
8
|
+
|
|
9
|
+
<script>
|
|
10
|
+
import HelloWorld from '../components/HelloWorld.vue'
|
|
11
|
+
export default {
|
|
12
|
+
components: {
|
|
13
|
+
HelloWorld,
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
}
|
|
17
|
+
</script>
|
|
18
|
+
|
|
19
|
+
<style>
|
|
20
|
+
|
|
21
|
+
</style>
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
const CopyWebpackPlugin = require('copy-webpack-plugin')
|
|
2
|
+
|
|
3
|
+
module.exports = {
|
|
4
|
+
devServer: {
|
|
5
|
+
open: true,
|
|
6
|
+
port: 9000,
|
|
7
|
+
host: 'localhost',
|
|
8
|
+
headers: {
|
|
9
|
+
'Access-Control-Allow-Origin': '*',
|
|
10
|
+
},
|
|
11
|
+
},
|
|
12
|
+
publicPath: "./",
|
|
13
|
+
productionSourceMap: false,
|
|
14
|
+
configureWebpack: {
|
|
15
|
+
output: {
|
|
16
|
+
library: "<%= pluginName %>-<%= uniqueIdentifier %>",
|
|
17
|
+
libraryTarget: 'umd',
|
|
18
|
+
},
|
|
19
|
+
plugins: [
|
|
20
|
+
new CopyWebpackPlugin([
|
|
21
|
+
{ from: 'README.md' },
|
|
22
|
+
{ from: 'manifest.json' },
|
|
23
|
+
]),
|
|
24
|
+
]
|
|
25
|
+
},
|
|
26
|
+
chainWebpack: (config) => {
|
|
27
|
+
config.module
|
|
28
|
+
.rule('fonts')
|
|
29
|
+
.test(/.(ttf|otf|eot|woff|woff2)$/)
|
|
30
|
+
.use('url-loader')
|
|
31
|
+
.loader('url-loader')
|
|
32
|
+
.tap(() => ({ name: '/fonts/[name].[hash:8].[ext]' }))
|
|
33
|
+
.end()
|
|
34
|
+
},
|
|
35
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
|
|
2
|
+
|
|
3
|
+
# dependencies
|
|
4
|
+
/node_modules
|
|
5
|
+
/npm-debug.log*
|
|
6
|
+
/yarn-error.log
|
|
7
|
+
/yarn.lock
|
|
8
|
+
/package-lock.json
|
|
9
|
+
|
|
10
|
+
# production
|
|
11
|
+
/dist
|
|
12
|
+
|
|
13
|
+
# misc
|
|
14
|
+
.DS_Store
|
|
15
|
+
|
|
16
|
+
# umi
|
|
17
|
+
/src/.umi
|
|
18
|
+
/src/.umi-production
|
|
19
|
+
/src/.umi-test
|
|
20
|
+
/.env.local
|
|
21
|
+
/dist.maxplugin
|
|
22
|
+
/dist.zip
|
|
23
|
+
/.vscode
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<el-form label-position="top" :model="form">
|
|
3
|
+
<el-form-item label="是否禁用">
|
|
4
|
+
<el-switch v-model="form.disabled"></el-switch>
|
|
5
|
+
</el-form-item>
|
|
6
|
+
<el-form-item label="最大长度">
|
|
7
|
+
<el-input-number v-model="form.maxLength"></el-input-number>
|
|
8
|
+
</el-form-item>
|
|
9
|
+
<el-form-item label="控件大小">
|
|
10
|
+
<el-select v-model="form.size">
|
|
11
|
+
<el-option label="small" value="small"></el-option>
|
|
12
|
+
<el-option label="default" value="default"></el-option>
|
|
13
|
+
<el-option label="large" value="large"></el-option>
|
|
14
|
+
</el-select>
|
|
15
|
+
</el-form-item>
|
|
16
|
+
<el-form-item label="占位符">
|
|
17
|
+
<el-input v-model="form.placeholder"></el-input>
|
|
18
|
+
</el-form-item>
|
|
19
|
+
<el-form-item label="label">
|
|
20
|
+
<el-input v-model="form.label"></el-input>
|
|
21
|
+
</el-form-item>
|
|
22
|
+
</el-form>
|
|
23
|
+
</template>
|
|
24
|
+
|
|
25
|
+
<script>
|
|
26
|
+
import { PluginChannel } from '@max-kit/max-api'
|
|
27
|
+
|
|
28
|
+
export default {
|
|
29
|
+
name: 'App',
|
|
30
|
+
data() {
|
|
31
|
+
return {
|
|
32
|
+
form: {
|
|
33
|
+
size: 'default',
|
|
34
|
+
disabled: false,
|
|
35
|
+
placeholder: '',
|
|
36
|
+
maxLength: 1,
|
|
37
|
+
label: '',
|
|
38
|
+
},
|
|
39
|
+
pluginChannel: null
|
|
40
|
+
};
|
|
41
|
+
},
|
|
42
|
+
mounted() {
|
|
43
|
+
this.pluginChannel = new PluginChannel({
|
|
44
|
+
init: this.initConfigs
|
|
45
|
+
})
|
|
46
|
+
},
|
|
47
|
+
beforeDestroy() {
|
|
48
|
+
this.pluginChannel && this.pluginChannel.destroy()
|
|
49
|
+
},
|
|
50
|
+
methods: {
|
|
51
|
+
initConfigs (configs) {
|
|
52
|
+
if (!configs || typeof configs !== 'object') return
|
|
53
|
+
this.form = {
|
|
54
|
+
...this.form,
|
|
55
|
+
...configs
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
},
|
|
59
|
+
watch: {
|
|
60
|
+
// 表单变化是,提交配置信息
|
|
61
|
+
form: {
|
|
62
|
+
handler() {
|
|
63
|
+
const config = { ...this.form };
|
|
64
|
+
this.pluginChannel.update(config);
|
|
65
|
+
},
|
|
66
|
+
deep: true,
|
|
67
|
+
},
|
|
68
|
+
},
|
|
69
|
+
}
|
|
70
|
+
</script>
|
|
71
|
+
|
|
72
|
+
<style lang="scss">
|
|
73
|
+
#app {
|
|
74
|
+
font-family: Avenir, Helvetica, Arial, sans-serif;
|
|
75
|
+
-webkit-font-smoothing: antialiased;
|
|
76
|
+
-moz-osx-font-smoothing: grayscale;
|
|
77
|
+
}
|
|
78
|
+
</style>
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "<%= pluginName %>",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"private": true,
|
|
5
|
+
"scripts": {
|
|
6
|
+
"serve": "vue-cli-service serve",
|
|
7
|
+
"start": "vue-cli-service serve",
|
|
8
|
+
"build": "vue-cli-service build && maxelms-plugin-cli -c",
|
|
9
|
+
"lint": "vue-cli-service lint"
|
|
10
|
+
},
|
|
11
|
+
"dependencies": {
|
|
12
|
+
"@max-kit/max-api": "1.0.1",
|
|
13
|
+
"core-js": "3.6.5",
|
|
14
|
+
"element-ui": "2.15.6",
|
|
15
|
+
"vue": "2.6.11"
|
|
16
|
+
},
|
|
17
|
+
"devDependencies": {
|
|
18
|
+
"@maxelms/create-plugin-cli": "<%= cliVersion %>",
|
|
19
|
+
"@vue/cli-plugin-babel": "4.5.0",
|
|
20
|
+
"@vue/cli-plugin-eslint": "4.5.0",
|
|
21
|
+
"@vue/cli-service": "4.5.0",
|
|
22
|
+
"archiver": "5.3.1",
|
|
23
|
+
"babel-eslint": "10.1.0",
|
|
24
|
+
"copy-webpack-plugin": "5.1.1",
|
|
25
|
+
"eslint": "6.7.2",
|
|
26
|
+
"eslint-plugin-vue": "6.2.2",
|
|
27
|
+
"sass": "1.47.0",
|
|
28
|
+
"sass-loader": "8.0.2",
|
|
29
|
+
"url-loader": "2.2.0",
|
|
30
|
+
"vue-template-compiler": "2.6.11"
|
|
31
|
+
},
|
|
32
|
+
"eslintConfig": {
|
|
33
|
+
"root": true,
|
|
34
|
+
"env": {
|
|
35
|
+
"node": true
|
|
36
|
+
},
|
|
37
|
+
"extends": [
|
|
38
|
+
"plugin:vue/essential",
|
|
39
|
+
"eslint:recommended"
|
|
40
|
+
],
|
|
41
|
+
"parserOptions": {
|
|
42
|
+
"parser": "babel-eslint"
|
|
43
|
+
},
|
|
44
|
+
"rules": {}
|
|
45
|
+
},
|
|
46
|
+
"browserslist": [
|
|
47
|
+
"> 1%",
|
|
48
|
+
"last 2 versions",
|
|
49
|
+
"not dead"
|
|
50
|
+
]
|
|
51
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
{
|
|
2
|
+
"propName1": {
|
|
3
|
+
"label": "配置项一",
|
|
4
|
+
"type": "string",
|
|
5
|
+
"defaultValue": "配置项内容"
|
|
6
|
+
},
|
|
7
|
+
"propName2": {
|
|
8
|
+
"label": "配置项二",
|
|
9
|
+
"type": "number",
|
|
10
|
+
"defaultValue": 350
|
|
11
|
+
},
|
|
12
|
+
"propName3": {
|
|
13
|
+
"label": "配置项三",
|
|
14
|
+
"type": "select",
|
|
15
|
+
"options": [
|
|
16
|
+
{
|
|
17
|
+
"label": "选项1",
|
|
18
|
+
"value": "option1"
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
"label": "选项2",
|
|
22
|
+
"value": "option2"
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
"label": "选项3",
|
|
26
|
+
"value": "option3"
|
|
27
|
+
}
|
|
28
|
+
]
|
|
29
|
+
}
|
|
30
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
{
|
|
2
|
+
"propName1": {
|
|
3
|
+
"label": "配置项一",
|
|
4
|
+
"type": "string",
|
|
5
|
+
"defaultValue": "配置项内容"
|
|
6
|
+
},
|
|
7
|
+
"propName2": {
|
|
8
|
+
"label": "配置项二",
|
|
9
|
+
"type": "number",
|
|
10
|
+
"defaultValue": 350
|
|
11
|
+
},
|
|
12
|
+
"propName3": {
|
|
13
|
+
"label": "配置项三",
|
|
14
|
+
"type": "select",
|
|
15
|
+
"options": [
|
|
16
|
+
{
|
|
17
|
+
"label": "选项1",
|
|
18
|
+
"value": "option1"
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
"label": "选项2",
|
|
22
|
+
"value": "option2"
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
"label": "选项3",
|
|
26
|
+
"value": "option3"
|
|
27
|
+
}
|
|
28
|
+
]
|
|
29
|
+
}
|
|
30
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8">
|
|
5
|
+
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
|
6
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
7
|
+
<title>Document</title>
|
|
8
|
+
</head>
|
|
9
|
+
<body>
|
|
10
|
+
<div id="micro-button-root"></div>
|
|
11
|
+
</body>
|
|
12
|
+
</html>
|