init: npx @fesjs/create-fes-app myapp

This commit is contained in:
Nex Zhu 2021-12-26 17:14:46 +08:00
commit bc6bc455d8
No known key found for this signature in database
GPG Key ID: 15C6254AD19362B4
20 changed files with 28447 additions and 0 deletions

16
.editorconfig Normal file
View File

@ -0,0 +1,16 @@
# http://editorconfig.org
root = true
lib
[*]
charset = utf-8
indent_style = space
indent_size = 4
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
[*.md]
insert_final_newline = false
trim_trailing_whitespace = false

14
.eslintrc.js Normal file
View File

@ -0,0 +1,14 @@
module.exports = {
extends: ['@webank/eslint-config-webank/vue.js'],
overrides: [
{
files: [
'**/__tests__/*.{j,t}s?(x)',
'**/tests/unit/**/*.spec.{j,t}s?(x)'
]
}
],
env: {
jest: true
}
};

26
.fes.js Normal file
View File

@ -0,0 +1,26 @@
// .fes.js 只负责管理编译时配置只能使用plain Object
export default {
publicPath: './',
access: {
roles: {
admin: ["*"],
manager: ["/"]
}
},
layout: {
title: "Fes.js",
footer: 'Created by MumbleFe',
multiTabs: false,
menus: [{
name: 'index'
}]
},
devServer: {
port: 8000
},
enums: {
status: [['0', '无效的'], ['1', '有效的']]
}
};

6
.fes.prod.js Normal file
View File

@ -0,0 +1,6 @@
// .fes.js 只负责管理编译时配置只能使用plain Object
export default {
publicPath: ''
};

139
.gitignore vendored Normal file
View File

@ -0,0 +1,139 @@
# Created by https://www.toptal.com/developers/gitignore/api/node
# Edit at https://www.toptal.com/developers/gitignore?templates=node
### Custom ###
src/.fes
### Node ###
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*
.pnpm-debug.log*
# Diagnostic reports (https://nodejs.org/api/report.html)
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
# Runtime data
pids
*.pid
*.seed
*.pid.lock
# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov
# Coverage directory used by tools like istanbul
coverage
*.lcov
# nyc test coverage
.nyc_output
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
.grunt
# Bower dependency directory (https://bower.io/)
bower_components
# node-waf configuration
.lock-wscript
# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release
# Dependency directories
node_modules/
jspm_packages/
# Snowpack dependency directory (https://snowpack.dev/)
web_modules/
# TypeScript cache
*.tsbuildinfo
# Optional npm cache directory
.npm
# Optional eslint cache
.eslintcache
# Microbundle cache
.rpt2_cache/
.rts2_cache_cjs/
.rts2_cache_es/
.rts2_cache_umd/
# Optional REPL history
.node_repl_history
# Output of 'npm pack'
*.tgz
# Yarn Integrity file
.yarn-integrity
# dotenv environment variables file
.env
.env.test
.env.production
# parcel-bundler cache (https://parceljs.org/)
.cache
.parcel-cache
# Next.js build output
.next
out
# Nuxt.js build / generate output
.nuxt
dist
# Gatsby files
.cache/
# Comment in the public line in if your project uses Gatsby and not Next.js
# https://nextjs.org/blog/next-9-1#public-directory-support
# public
# vuepress build output
.vuepress/dist
# Serverless directories
.serverless/
# FuseBox cache
.fusebox/
# DynamoDB Local files
.dynamodb/
# TernJS port file
.tern-port
# Stores VSCode versions used for testing VSCode extensions
.vscode-test
# yarn v2
.yarn/cache
.yarn/unplugged
.yarn/build-state.yml
.yarn/install-state.gz
.pnp.*
### Node Patch ###
# Serverless Webpack directories
.webpack/
# Optional stylelint cache
.stylelintcache
# SvelteKit build / generate output
.svelte-kit
# End of https://www.toptal.com/developers/gitignore/api/node

4
.prettierrc Normal file
View File

@ -0,0 +1,4 @@
{
"singleQuote": true,
"trailingComma": "none"
}

3
README.md Normal file
View File

@ -0,0 +1,3 @@
# fes-template
Template for [fes.js](https://github.com/WeBankFinTech/fes.js).

28013
package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

59
package.json Normal file
View File

@ -0,0 +1,59 @@
{
"name": "@fesjs/template",
"version": "2.0.0",
"description": "fes项目模版",
"scripts": {
"build": "fes build",
"prod": "FES_ENV=prod fes build",
"analyze": "ANALYZE=1 fes build",
"dev": "fes dev",
"test:unit": "fes test:unit"
},
"keywords": [
"管理端",
"fes",
"fast",
"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"
},
"author": "harrywan",
"license": "MIT",
"bugs": {
"url": "https://github.com/WeBankFinTech/fes.js/issues"
},
"homepage": "https://github.com/WeBankFinTech/fes.js#readme",
"publishConfig": {
"access": "public"
},
"devDependencies": {
"@vue/compiler-sfc": "^3.2.6",
"@webank/eslint-config-webank": "0.4.2"
},
"dependencies": {
"@fesjs/fes": "^2.0.0",
"@fesjs/plugin-access": "^2.0.0",
"@fesjs/plugin-enums": "^2.0.0",
"@fesjs/plugin-layout": "^2.0.0",
"@fesjs/plugin-model": "^2.0.0",
"ant-design-vue": "^2.2.0",
"vue": "^3.2.6"
},
"private": true
}

12
public/index.html Normal file
View File

@ -0,0 +1,12 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>fes.js</title>
<link rel="shortcut icon" type="image/x-icon" href="./logo.png">
</head>
<body>
<div id="app"></div>
</body>
</html>

BIN
public/logo.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 50 KiB

25
src/app.js Normal file
View File

@ -0,0 +1,25 @@
import { access } from '@fesjs/fes';
import PageLoading from '@/components/PageLoading';
import UserCenter from '@/components/UserCenter';
export const beforeRender = {
loading: <PageLoading />,
action() {
const { setRole } = access;
return new Promise((resolve) => {
setTimeout(() => {
setRole('admin');
// 初始化应用的全局状态,可以通过 useModel('@@initialState') 获取,具体用法看@/components/UserCenter 文件
resolve({
userName: 'harrywan'
});
}, 1000);
});
}
};
export const layout = {
customHeader: <UserCenter />
};

1
src/common/service.js Normal file
View File

@ -0,0 +1 @@
// 服务端接口管理

1
src/common/utils.js Normal file
View File

@ -0,0 +1 @@
// 放工具函数

View File

@ -0,0 +1,27 @@
<template>
<div class="page-loading">
<Spin size="large" />
</div>
</template>
<script>
import Spin from 'ant-design-vue/lib/spin';
import 'ant-design-vue/lib/spin/style/css';
export default {
components: {
Spin
}
};
</script>
<style>
.page-loading{
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
display: flex;
align-items: center;
justify-content: center;
}
</style>

View File

@ -0,0 +1,21 @@
<template>
<div class="right">{{initialState.userName}}</div>
</template>
<script>
import { useModel } from '@fesjs/fes';
export default {
setup() {
const initialState = useModel('@@initialState');
return {
initialState
};
}
};
</script>
<style scope>
.right {
text-align: right;
padding: 0 20px;
}
</style>

BIN
src/images/icon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.5 KiB

0
src/models/user.js Normal file
View File

43
src/pages/index.vue Normal file
View File

@ -0,0 +1,43 @@
<template>
<div style="padding: 32px;">
<h3>fes & 拉夫德鲁 </h3>
<h4>数据字典</h4>
<div v-for="item in enumsGet('status')" :key="item.key">{{item.value}}{{item.key}}</div>
<section>
计数器
<button @click="increment">click me{{count}}</button>
</section>
</div>
</template>
<script>
import { ref } from 'vue';
import {
enums
} from '@fesjs/fes';
export default {
setup() {
const fes = ref('fes upgrade to vue3');
const count = ref(0);
const increment = () => {
count.value++;
};
return {
fes,
increment,
count,
enumsGet: enums.get
};
}
};
</script>
<config>
{
"name": "index",
"title": "首页"
}
</config>

37
tsconfig.json Normal file
View File

@ -0,0 +1,37 @@
{
"compilerOptions": {
"outDir": "build/dist",
"module": "esnext",
"target": "esnext",
"lib": ["esnext", "dom"],
"sourceMap": true,
"baseUrl": ".",
"jsx": "preserve",
"allowSyntheticDefaultImports": true,
"moduleResolution": "node",
"forceConsistentCasingInFileNames": true,
"noImplicitReturns": true,
"suppressImplicitAnyIndexErrors": true,
"noUnusedLocals": true,
"allowJs": true,
"skipLibCheck": true,
"experimentalDecorators": true,
"strict": true,
"paths": {
"@/*": ["./src/*"],
"@@/*": ["./src/.fes/*"]
}
},
"include": [
"src/**/*",
"tests/**/*",
"test/**/*",
"__test__/**/*",
"typings/**/*",
"config/**/*",
".eslintrc.js",
".stylelintrc.js",
".prettierrc.js"
],
"exclude": ["node_modules", "build", "dist", "scripts", "src/.fes/*", "webpack", "jest"]
}