diff --git a/packages/create-fes-app/templates/app/h5/package.json b/packages/create-fes-app/templates/app/h5/package.json index deabbfcd..e1903a71 100644 --- a/packages/create-fes-app/templates/app/h5/package.json +++ b/packages/create-fes-app/templates/app/h5/package.json @@ -13,19 +13,34 @@ "easy", "strong" ], + "files": [ + ".eslintrc.js", + ".gitignore", + ".fes.js", + ".fes.prod.js", + "mock.js", + "package.json", + "README.md", + "tsconfig.json", + "/src", + "/config" + ], "repository": { "type": "git", "url": "git+https://github.com/WeBankFinTech/fes.js.git", "directory": "packages/fes-template-h5" }, - "author": "harrywan qlin", + "author": "qlin", "license": "MIT", "bugs": { "url": "https://github.com/WeBankFinTech/fes.js/issues" }, "homepage": "https://github.com/WeBankFinTech/fes.js#readme", + "publishConfig": { + "access": "public" + }, "devDependencies": { - "@webank/eslint-config-webank": "0.2.7", + "@webank/eslint-config-webank": "^0.2.10", "postcss-px-to-viewport": "1.1.1" }, "dependencies": { @@ -33,5 +48,6 @@ "@webank/fes-plugin-icon": "^2.0.0-alpha.0", "@webank/fes-plugin-request": "^2.0.0-alpha.0", "vue": "3.0.5" - } + }, + "private": true } diff --git a/packages/create-fes-app/templates/app/h5/public/index.html b/packages/create-fes-app/templates/app/h5/public/index.html index 7959977e..750a5c09 100644 --- a/packages/create-fes-app/templates/app/h5/public/index.html +++ b/packages/create-fes-app/templates/app/h5/public/index.html @@ -9,6 +9,7 @@ <%= htmlWebpackPlugin.options.title %> +
diff --git a/packages/create-fes-app/templates/app/h5/public/logo.png b/packages/create-fes-app/templates/app/h5/public/logo.png new file mode 100644 index 00000000..4958e971 Binary files /dev/null and b/packages/create-fes-app/templates/app/h5/public/logo.png differ diff --git a/packages/create-fes-app/templates/app/pc/.eslintrc.js b/packages/create-fes-app/templates/app/pc/.eslintrc.js index 74c6bf29..6300816f 100644 --- a/packages/create-fes-app/templates/app/pc/.eslintrc.js +++ b/packages/create-fes-app/templates/app/pc/.eslintrc.js @@ -1,19 +1,14 @@ - module.exports = { - extends: [ - '@webank/eslint-config-webank/vue.js' + extends: ['@webank/eslint-config-webank/vue.js'], + overrides: [ + { + files: [ + '**/__tests__/*.{j,t}s?(x)', + '**/tests/unit/**/*.spec.{j,t}s?(x)' + ] + } ], - globals: { - // 这里填入你的项目需要的全局变量 - // 这里值为 false 表示这个全局变量不允许被重新赋值,比如: - // - // Vue: false - __DEV__: false - }, - rules: { - 'vue/comment-directive': 'off', - 'global-require': 'off', - 'import/no-unresolved': 'off', - 'no-restricted-syntax': 'off' + env: { + jest: true } }; diff --git a/packages/create-fes-app/templates/app/pc/.fes.js b/packages/create-fes-app/templates/app/pc/.fes.js index 05a57ed4..db77aa6f 100644 --- a/packages/create-fes-app/templates/app/pc/.fes.js +++ b/packages/create-fes-app/templates/app/pc/.fes.js @@ -14,7 +14,7 @@ export default { }, layout: { title: "Fes.js", - logo: 'https://gw.alipayobjects.com/zos/rmsportal/KDpgvguMpGfqaHPjicRK.svg', + footer: 'Created by MumbelFe', multiTabs: false, menus: [{ name: 'index' @@ -27,5 +27,8 @@ export default { }, devServer: { port: 8080 + }, + enums: { + status: [['0', '无效的'], ['1', '有效的']] } }; diff --git a/packages/create-fes-app/templates/app/pc/.gitignore b/packages/create-fes-app/templates/app/pc/.gitignore index 15fc6484..df903b98 100644 --- a/packages/create-fes-app/templates/app/pc/.gitignore +++ b/packages/create-fes-app/templates/app/pc/.gitignore @@ -2,7 +2,7 @@ # dependencies /node_modules - +/coverage # fes /src/.fes diff --git a/packages/create-fes-app/templates/app/pc/__tests__/add.js b/packages/create-fes-app/templates/app/pc/__tests__/add.js new file mode 100644 index 00000000..5eaa2245 --- /dev/null +++ b/packages/create-fes-app/templates/app/pc/__tests__/add.js @@ -0,0 +1,5 @@ +import sum from "@/utils/sum" + +test('adds 1 + 2 to equal 3', () => { + expect(sum(1, 2)).toBe(3); +}); diff --git a/packages/create-fes-app/templates/app/pc/package.json b/packages/create-fes-app/templates/app/pc/package.json index 9afc4f9d..d5e5c1de 100644 --- a/packages/create-fes-app/templates/app/pc/package.json +++ b/packages/create-fes-app/templates/app/pc/package.json @@ -6,7 +6,8 @@ "build": "fes build", "prod": "FES_ENV=prod fes build", "analyze": "ANALYZE=1 fes build", - "dev": "fes dev" + "dev": "fes dev", + "test:unit": "fes test:unit" }, "keywords": [ "管理端", @@ -15,6 +16,18 @@ "easy", "strong" ], + "files": [ + ".eslintrc.js", + ".gitignore", + ".fes.js", + ".fes.prod.js", + "mock.js", + "package.json", + "README.md", + "tsconfig.json", + "/src", + "/config" + ], "repository": { "type": "git", "url": "git+https://github.com/WeBankFinTech/fes.js.git", @@ -26,8 +39,11 @@ "url": "https://github.com/WeBankFinTech/fes.js/issues" }, "homepage": "https://github.com/WeBankFinTech/fes.js#readme", + "publishConfig": { + "access": "public" + }, "devDependencies": { - "@webank/eslint-config-webank": "0.2.7" + "@webank/eslint-config-webank": "^0.2.10" }, "dependencies": { "@webank/fes": "^2.0.0-alpha.0", @@ -35,8 +51,13 @@ "@webank/fes-plugin-layout": "^2.0.0-alpha.0", "@webank/fes-plugin-locale": "^2.0.0-alpha.0", "@webank/fes-plugin-model": "^2.0.0-alpha.0", + "@webank/fes-plugin-enums": "^2.0.0-alpha.0", + "@webank/fes-plugin-jest": "^2.0.0-alpha.0", + "@webank/fes-plugin-vuex": "^2.0.0-alpha.0", "ant-design-vue": "2.0.0-rc.3", - "vue": "3.0.5" - } + "vue": "3.0.5", + "vuex": "^4.0.0-rc.2" + }, + "private": true } \ No newline at end of file diff --git a/packages/create-fes-app/templates/app/pc/public/index.html b/packages/create-fes-app/templates/app/pc/public/index.html index 2a306e03..8520c0ec 100644 --- a/packages/create-fes-app/templates/app/pc/public/index.html +++ b/packages/create-fes-app/templates/app/pc/public/index.html @@ -3,7 +3,8 @@ - fes Vue3 + fes.js +
diff --git a/packages/create-fes-app/templates/app/pc/public/logo.png b/packages/create-fes-app/templates/app/pc/public/logo.png new file mode 100644 index 00000000..4958e971 Binary files /dev/null and b/packages/create-fes-app/templates/app/pc/public/logo.png differ diff --git a/packages/create-fes-app/templates/app/pc/src/pages/index.vue b/packages/create-fes-app/templates/app/pc/src/pages/index.vue index 186149c9..3a304634 100644 --- a/packages/create-fes-app/templates/app/pc/src/pages/index.vue +++ b/packages/create-fes-app/templates/app/pc/src/pages/index.vue @@ -5,6 +5,11 @@ accessOnepicess1
accessOnepicess2
+

数据字典

+
{{item.value}}:{{item.key}}
+
{{item.name}}:{{item.disabled}}
+
{{enumsGet('roles', '2', { dir: 'eName' })}}
+

Vuex

@@ -14,9 +19,10 @@ } diff --git a/packages/create-fes-app/templates/app/pc/src/stores/counter.js b/packages/create-fes-app/templates/app/pc/src/stores/counter.js new file mode 100644 index 00000000..78070ba3 --- /dev/null +++ b/packages/create-fes-app/templates/app/pc/src/stores/counter.js @@ -0,0 +1,23 @@ +export default { + namespaced: true, + state: () => ({ + count: 0 + }), + mutations: { + increment(state) { + state.count++; + } + }, + getters: { + doubleCount(state) { + return state.count * 2; + } + }, + actions: { + asyncIncrement({ commit }) { + setTimeout(() => { + commit('increment'); + }, 2000); + } + } +}; diff --git a/packages/create-fes-app/templates/app/pc/src/stores/plugin-loger.js b/packages/create-fes-app/templates/app/pc/src/stores/plugin-loger.js new file mode 100644 index 00000000..6b8a9826 --- /dev/null +++ b/packages/create-fes-app/templates/app/pc/src/stores/plugin-loger.js @@ -0,0 +1,3 @@ +import { createLogger } from 'vuex'; + +export default createLogger(); diff --git a/packages/create-fes-app/templates/app/pc/src/stores/user.js b/packages/create-fes-app/templates/app/pc/src/stores/user.js new file mode 100644 index 00000000..e6ffcceb --- /dev/null +++ b/packages/create-fes-app/templates/app/pc/src/stores/user.js @@ -0,0 +1,25 @@ +export default { + namespaced: true, + state: () => ({ + name: 'aring', + age: 20, + count: 0 + }), + mutations: { + increment(state) { + state.count++; + } + }, + getters: { + doubleCount(state) { + return state.count * 2; + } + }, + actions: { + asyncIncrement({ commit }) { + setTimeout(() => { + commit('increment'); + }, 2000); + } + } +}; diff --git a/packages/create-fes-app/templates/app/pc/src/utils/sum.js b/packages/create-fes-app/templates/app/pc/src/utils/sum.js new file mode 100644 index 00000000..54b28e5a --- /dev/null +++ b/packages/create-fes-app/templates/app/pc/src/utils/sum.js @@ -0,0 +1,3 @@ +export default function sum(a, b) { + return a + b; +}