From 557ded5ad24a7416e1c920084aa1fc1d4f778db6 Mon Sep 17 00:00:00 2001 From: winixt Date: Fri, 1 Jul 2022 16:16:01 +0800 Subject: [PATCH 1/4] chore: update dependencies --- docs/guide/directory-structure.md | 143 ++++++++++-------- .../templates/app/pc/package.json | 2 +- packages/fes-plugin-layout/package.json | 2 +- packages/fes-plugin-locale/package.json | 2 +- .../examples/app1/package.json | 2 +- .../examples/main/package.json | 2 +- packages/fes-plugin-qiankun/package.json | 2 +- packages/fes-template/package.json | 2 +- 8 files changed, 83 insertions(+), 74 deletions(-) diff --git a/docs/guide/directory-structure.md b/docs/guide/directory-structure.md index 17954475..5a1bb6e3 100644 --- a/docs/guide/directory-structure.md +++ b/docs/guide/directory-structure.md @@ -1,6 +1,7 @@ # 目录结构 在[快速上手](./getting-started.html)中,大家对框架应该有初步的印象,接下来我们了解下目录结构。Fes.js 遵循 `约定优于配置` 的原则,一个基础的 Fes.js 项目大致是这样的: + ``` fes-template ├── package.json @@ -19,113 +20,119 @@ fes-template ``` ### package.json + ```json { - "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": "fes test" - }, - "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": { - "@webank/eslint-config-webank": "0.3.1" - }, - "dependencies": { - "@fesjs/fes": "^2.0.0", - "@fesjs/plugin-access": "^2.0.0", - "@fesjs/plugin-layout": "^3.0.0", - "@fesjs/plugin-locale": "^3.0.0", - "@fesjs/plugin-model": "^2.0.0", - "@fesjs/plugin-enums": "^2.0.0", - "@fesjs/plugin-jest": "^2.0.0", - "@fesjs/plugin-vuex": "^2.0.0", - "@fesjs/plugin-request": "^2.0.0", - "@fesjs/plugin-qiankun": "^2.0.0", - "@fesjs/plugin-sass": "^2.0.0", - "@fesjs/plugin-monaco-editor": "^2.0.0-beta.0", - "@fesjs/plugin-windicss": "^2.0.0", - "@fesjs/fes-design": "^0.4.0", - "vue": "^3.0.5", - "vuex": "^4.0.0" - }, - "private": true + "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": "fes test" + }, + "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": { + "@webank/eslint-config-webank": "0.3.1" + }, + "dependencies": { + "@fesjs/fes": "^2.0.0", + "@fesjs/plugin-access": "^2.0.0", + "@fesjs/plugin-layout": "^3.0.0", + "@fesjs/plugin-locale": "^3.0.0", + "@fesjs/plugin-model": "^2.0.0", + "@fesjs/plugin-enums": "^2.0.0", + "@fesjs/plugin-jest": "^2.0.0", + "@fesjs/plugin-vuex": "^2.0.0", + "@fesjs/plugin-request": "^2.0.0", + "@fesjs/plugin-qiankun": "^2.0.0", + "@fesjs/plugin-sass": "^2.0.0", + "@fesjs/plugin-monaco-editor": "^2.0.0-beta.0", + "@fesjs/plugin-windicss": "^2.0.0", + "@fesjs/fes-design": "^0.5.0", + "vue": "^3.0.5", + "vuex": "^4.0.0" + }, + "private": true } ``` + 其中`@fesjs/fes`是 Fes.js 核心依赖,另外以 `@fesjs/preset-`、`@fesjs/plugin-`、`@webank/fes-preset-`、`@webank/fes-plugin-`、`fes-preset-` 和 `fes-plugin-` 开头的依赖会被自动注册为插件或插件集。 ### tsconfig.json + 解决 `@fesjs/fes` 和使用 `@` 的 API 提示 ### .fes.js + 配置文件,包含 Fes.js 内置功能和安装的其他插件配置。 ### mock.js + `mock` 数据的配置文件。 ### .env + 定义环境变量。 比如 `.env` 文件内容如下: + ``` PORT=8888 FES_ENV=prod ``` + 等同于 node 端运行时,设置如下: + ``` process.env.PORT = '8888'; process.env.FES_ENV = 'prod'; ``` - ### dist 目录 + 执行 `fes build` 后,产物默认会存放在这里。 ## public 目录 + 此目录下所有文件为静态资源,会被复制到输出路径。 ### index.html + 默认的 `html` 模板文件,如果删除此 `html` 则会使用内置的 `html` 模板文件。 ## src 目录 ### .fes 目录 + 临时文件目录,比如入口文件、路由等,都会被临时生成到这里。 :::warning @@ -133,7 +140,9 @@ process.env.FES_ENV = 'prod'; ::: ### pages 目录 + 所有路由组件文件存放在这里。 ### app.js -运行时配置文件,可以在这里扩展运行时的能力,比如修改路由等。 \ No newline at end of file + +运行时配置文件,可以在这里扩展运行时的能力,比如修改路由等。 diff --git a/packages/create-fes-app/templates/app/pc/package.json b/packages/create-fes-app/templates/app/pc/package.json index de977410..d6ac34c2 100644 --- a/packages/create-fes-app/templates/app/pc/package.json +++ b/packages/create-fes-app/templates/app/pc/package.json @@ -52,7 +52,7 @@ "@fesjs/plugin-layout": "^4.0.0", "@fesjs/plugin-model": "^2.0.0", "@fesjs/plugin-enums": "^2.0.0", - "@fesjs/fes-design": "^0.4.0", + "@fesjs/fes-design": "^0.5.0", "vue": "^3.2.6", "core-js": "^3.8.3" }, diff --git a/packages/fes-plugin-layout/package.json b/packages/fes-plugin-layout/package.json index 6f148f12..b4bb3cee 100644 --- a/packages/fes-plugin-layout/package.json +++ b/packages/fes-plugin-layout/package.json @@ -31,7 +31,7 @@ }, "peerDependencies": { "@fesjs/fes": "^2.0.0", - "@fesjs/fes-design": "^0.4.0", + "@fesjs/fes-design": "^0.5.0", "vue": "^3.0.5" } } diff --git a/packages/fes-plugin-locale/package.json b/packages/fes-plugin-locale/package.json index fbd961d2..eb167c73 100644 --- a/packages/fes-plugin-locale/package.json +++ b/packages/fes-plugin-locale/package.json @@ -32,7 +32,7 @@ }, "peerDependencies": { "@fesjs/fes": "^2.0.0", - "@fesjs/fes-design": "^0.4.0", + "@fesjs/fes-design": "^0.5.0", "vue": "^3.0.5" } } diff --git a/packages/fes-plugin-qiankun/examples/app1/package.json b/packages/fes-plugin-qiankun/examples/app1/package.json index c5d35742..96ac1d06 100644 --- a/packages/fes-plugin-qiankun/examples/app1/package.json +++ b/packages/fes-plugin-qiankun/examples/app1/package.json @@ -48,7 +48,7 @@ "dependencies": { "@fesjs/fes": "^2.0.0", "vue": "^3.0.5", - "@fesjs/fes-design": "^0.4.0" + "@fesjs/fes-design": "^0.5.0" }, "private": true } diff --git a/packages/fes-plugin-qiankun/examples/main/package.json b/packages/fes-plugin-qiankun/examples/main/package.json index f2b70d74..37639bd5 100644 --- a/packages/fes-plugin-qiankun/examples/main/package.json +++ b/packages/fes-plugin-qiankun/examples/main/package.json @@ -48,7 +48,7 @@ "dependencies": { "@fesjs/fes": "^2.0.0", "vue": "^3.0.5", - "@fesjs/fes-design": "^0.4.0" + "@fesjs/fes-design": "^0.5.0" }, "private": true } diff --git a/packages/fes-plugin-qiankun/package.json b/packages/fes-plugin-qiankun/package.json index 6659b032..f3c97073 100644 --- a/packages/fes-plugin-qiankun/package.json +++ b/packages/fes-plugin-qiankun/package.json @@ -39,7 +39,7 @@ }, "peerDependencies": { "@fesjs/fes": "^2.0.0", - "@fesjs/fes-design": "^0.4.0", + "@fesjs/fes-design": "^0.5.0", "vue": "^3.0.5" } } diff --git a/packages/fes-template/package.json b/packages/fes-template/package.json index a7505981..dadf80a9 100644 --- a/packages/fes-template/package.json +++ b/packages/fes-template/package.json @@ -61,7 +61,7 @@ "@fesjs/plugin-windicss": "^2.0.0", "@fesjs/plugin-pinia": "^2.0.0", "@fesjs/plugin-watermark": "^2.0.0", - "@fesjs/fes-design": "^0.4.0", + "@fesjs/fes-design": "^0.5.0", "vue": "^3.0.5", "vuex": "^4.0.0", "pinia": "^2.0.11" From ce867e522d83cca13c737719cd7c8aa8dc4faebc Mon Sep 17 00:00:00 2001 From: winixt Date: Fri, 1 Jul 2022 16:21:38 +0800 Subject: [PATCH 2/4] chore(release): publish - @fesjs/create-fes-app@2.2.1 - @fesjs/plugin-layout@4.2.2 - @fesjs/plugin-locale@3.0.6 - @fesjs/plugin-qiankun@2.1.2 --- packages/create-fes-app/package.json | 2 +- packages/fes-plugin-layout/package.json | 2 +- packages/fes-plugin-locale/package.json | 2 +- packages/fes-plugin-qiankun/package.json | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/create-fes-app/package.json b/packages/create-fes-app/package.json index fb7f9cc3..39f1dcaa 100644 --- a/packages/create-fes-app/package.json +++ b/packages/create-fes-app/package.json @@ -1,6 +1,6 @@ { "name": "@fesjs/create-fes-app", - "version": "2.2.0", + "version": "2.2.1", "description": "create a app base on fes.js", "main": "lib/index.js", "files": [ diff --git a/packages/fes-plugin-layout/package.json b/packages/fes-plugin-layout/package.json index b4bb3cee..0349f71a 100644 --- a/packages/fes-plugin-layout/package.json +++ b/packages/fes-plugin-layout/package.json @@ -1,6 +1,6 @@ { "name": "@fesjs/plugin-layout", - "version": "4.2.1", + "version": "4.2.2", "description": "@fesjs/plugin-layout", "main": "lib/index.js", "files": [ diff --git a/packages/fes-plugin-locale/package.json b/packages/fes-plugin-locale/package.json index eb167c73..5f3f85c9 100644 --- a/packages/fes-plugin-locale/package.json +++ b/packages/fes-plugin-locale/package.json @@ -1,6 +1,6 @@ { "name": "@fesjs/plugin-locale", - "version": "3.0.5", + "version": "3.0.6", "description": "@fesjs/plugin-locale", "main": "lib/index.js", "files": [ diff --git a/packages/fes-plugin-qiankun/package.json b/packages/fes-plugin-qiankun/package.json index f3c97073..64da97ef 100644 --- a/packages/fes-plugin-qiankun/package.json +++ b/packages/fes-plugin-qiankun/package.json @@ -1,6 +1,6 @@ { "name": "@fesjs/plugin-qiankun", - "version": "2.1.1", + "version": "2.1.2", "description": "@fesjs/plugin-qiankun", "main": "lib/index.js", "files": [ From 9b3b7e5d0c52e2c4c27046968d228f407b76cd7e Mon Sep 17 00:00:00 2001 From: harrywan <445436867@qq.com> Date: Fri, 8 Jul 2022 10:19:56 +0800 Subject: [PATCH 3/4] =?UTF-8?q?feat:=20=E6=96=87=E4=BB=B6=E7=9B=AE?= =?UTF-8?q?=E5=BD=95=E5=90=8D=E5=B8=A6@=E8=BD=AC=E5=8C=96=E6=88=90?= =?UTF-8?q?=E5=8A=A8=E6=80=81=E8=B7=AF=E7=94=B1=20(#137)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/plugins/misc/route/index.js | 23 ++++++++----------- packages/fes-template/src/pages/@id/add.vue | 0 2 files changed, 9 insertions(+), 14 deletions(-) create mode 100644 packages/fes-template/src/pages/@id/add.vue diff --git a/packages/fes-preset-built-in/src/plugins/misc/route/index.js b/packages/fes-preset-built-in/src/plugins/misc/route/index.js index f963cb00..a47eacb7 100644 --- a/packages/fes-preset-built-in/src/plugins/misc/route/index.js +++ b/packages/fes-preset-built-in/src/plugins/misc/route/index.js @@ -50,14 +50,9 @@ const getRouteName = function (parentRoutePath, fileName) { .replace(/\*/g, 'FUZZYMATCH'); }; -const getComponentPath = function (parentRoutePath, fileName, config) { - const pagesName = config.singular ? 'page' : 'pages'; - return posix.join(`@/${pagesName}/`, parentRoutePath, fileName); -}; - -const getRoutePath = function (parentRoutePath, fileName) { +const getRoutePath = function (parentRoutePath, fileName, isFile = true) { // /index.vue -> / - if (fileName === 'index') { + if (isFile && fileName === 'index') { fileName = ''; } // /@id.vue -> /:id @@ -87,7 +82,7 @@ function getRouteMeta(content) { let cacheGenRoutes = {}; // TODO 约定 layout 目录作为布局文件夹, -const genRoutes = function (parentRoutes, path, parentRoutePath, config) { +const genRoutes = function (parentRoutes, path, parentRoutePath) { const dirList = readdirSync(path); const hasLayout = checkHasLayout(path); const layoutRoute = { @@ -113,7 +108,7 @@ const genRoutes = function (parentRoutes, path, parentRoutePath, config) { // 路由名称 const routeName = getRouteName(parentRoutePath, fileName); - const componentPath = getComponentPath(parentRoutePath, fileName, config); + const componentPath = posix.join(path, item); let content = readFileSync(component, 'utf-8'); let routeMeta = {}; @@ -153,12 +148,12 @@ const genRoutes = function (parentRoutes, path, parentRoutePath, config) { dirList.forEach((item) => { if (isProcessDirectory(path, item)) { // 文件或者目录的绝对路径 - const component = join(path, item); - const nextParentRouteUrl = posix.join(parentRoutePath, item); + const nextPath = join(path, item); + const nextParentRouteUrl = getRoutePath(parentRoutePath, item, false); if (hasLayout) { - genRoutes(layoutRoute.children, component, nextParentRouteUrl, config); + genRoutes(layoutRoute.children, nextPath, nextParentRouteUrl); } else { - genRoutes(parentRoutes, component, nextParentRouteUrl, config); + genRoutes(parentRoutes, nextPath, nextParentRouteUrl); } } }); @@ -210,7 +205,7 @@ const getRoutes = function ({ config, absPagesPath }) { const routes = []; cacheGenRoutes = {}; - genRoutes(routes, absPagesPath, '/', config); + genRoutes(routes, absPagesPath, '/'); rank(routes); return routes; }; diff --git a/packages/fes-template/src/pages/@id/add.vue b/packages/fes-template/src/pages/@id/add.vue new file mode 100644 index 00000000..e69de29b From 9e936067ad22642819792367274b22239b8bd928 Mon Sep 17 00:00:00 2001 From: wanchun <445436867@qq.com> Date: Fri, 8 Jul 2022 11:01:19 +0800 Subject: [PATCH 4/4] chore(release): publish - @fesjs/preset-built-in@2.1.2 - @fesjs/fes@2.1.2 --- packages/fes-preset-built-in/package.json | 2 +- packages/fes/package.json | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/fes-preset-built-in/package.json b/packages/fes-preset-built-in/package.json index 96dfcf6b..0d9414ae 100644 --- a/packages/fes-preset-built-in/package.json +++ b/packages/fes-preset-built-in/package.json @@ -1,6 +1,6 @@ { "name": "@fesjs/preset-built-in", - "version": "2.1.1", + "version": "2.1.2", "description": "@fesjs/preset-built-in", "main": "lib/index.js", "types": "lib/index.d.ts", diff --git a/packages/fes/package.json b/packages/fes/package.json index 7149b866..0cbecb17 100644 --- a/packages/fes/package.json +++ b/packages/fes/package.json @@ -1,6 +1,6 @@ { "name": "@fesjs/fes", - "version": "2.1.1", + "version": "2.1.2", "description": "一个好用的前端管理台快速开发框架", "preferGlobal": true, "scripts": { @@ -39,7 +39,7 @@ ], "dependencies": { "@fesjs/compiler": "^2.0.5", - "@fesjs/preset-built-in": "^2.1.1", + "@fesjs/preset-built-in": "^2.1.2", "@fesjs/runtime": "^2.0.2", "@fesjs/utils": "^2.0.4", "resolve-cwd": "^3.0.0"