diff --git a/packages/fes-preset-built-in/package.json b/packages/fes-preset-built-in/package.json index a08f6b0e..f9b392fe 100644 --- a/packages/fes-preset-built-in/package.json +++ b/packages/fes-preset-built-in/package.json @@ -27,12 +27,11 @@ "dependencies": { "@fesjs/compiler": "^2.0.5", "@fesjs/utils": "^2.0.4", - "body-parser": "^1.19.0", "cookie": "^0.4.2", - "cookie-parser": "^1.4.5", "envinfo": "^7.7.3", "mime": "^3.0.0", - "mockjs": "^1.1.0" + "mockjs": "^1.1.0", + "express": "^4.17.3" }, "peerDependencies": { "@vue/compiler-sfc": "^3.0.5" diff --git a/packages/fes-preset-built-in/src/plugins/features/mock.js b/packages/fes-preset-built-in/src/plugins/features/mock.js index 23025e98..180cbd31 100644 --- a/packages/fes-preset-built-in/src/plugins/features/mock.js +++ b/packages/fes-preset-built-in/src/plugins/features/mock.js @@ -1,13 +1,9 @@ import { existsSync, readFileSync } from 'fs'; import { resolve } from 'path'; import { chokidar, lodash, parseRequireDeps } from '@fesjs/utils'; -import bodyParser from 'body-parser'; -import cookieParser from 'cookie-parser'; -import cookie from 'cookie'; -import mockjs from 'mockjs'; -import mime from 'mime'; function getContentType(type) { + const mime = require('mime'); return type.indexOf('/') === -1 ? mime.getType(type) : type; } @@ -22,7 +18,7 @@ function setCookie(res, name, value, opts = {}) { if (opts.path == null) { opts.path = '/'; } - + const cookie = require('cookie'); res.setHeader('Set-Cookie', cookie.serialize(name, String(val), opts)); } @@ -146,12 +142,16 @@ export default (api) => { api.logger.info('mock.js should export Function'); return; } + const mockjs = require('mockjs'); initFunction({ cgiMock, mockjs, utils }); } catch (err) { api.logger.error('mock.js run fail!'); } - return (req, res, next) => { + const express = require('express'); + const app = express(); + + app.use((req, res, next) => { // 如果请求不是以 cgiMock.prefix 开头,直接 next if (!req.url.startsWith(mockPrefix)) { return next(); @@ -194,14 +194,10 @@ export default (api) => { } }; - bodyParser.json({ strict: false })(req, res, () => { - bodyParser.urlencoded({ extended: true })(req, res, () => { - cookieParser()(req, res, () => { - sendData(); - }); - }); - }); - }; + sendData(); + }); + + return app; }; api.onStart(() => { diff --git a/packages/fes-template-vite1/.env b/packages/fes-template-vite/.env similarity index 100% rename from packages/fes-template-vite1/.env rename to packages/fes-template-vite/.env diff --git a/packages/fes-template-vite1/.env.prod b/packages/fes-template-vite/.env.prod similarity index 100% rename from packages/fes-template-vite1/.env.prod rename to packages/fes-template-vite/.env.prod diff --git a/packages/fes-template-vite1/.eslintrc.js b/packages/fes-template-vite/.eslintrc.js similarity index 100% rename from packages/fes-template-vite1/.eslintrc.js rename to packages/fes-template-vite/.eslintrc.js diff --git a/packages/fes-template-vite/.fes.js b/packages/fes-template-vite/.fes.js index d9320a8b..07aa82f0 100644 --- a/packages/fes-template-vite/.fes.js +++ b/packages/fes-template-vite/.fes.js @@ -1,16 +1,90 @@ -// fes.config.js 只负责管理 cli 相关的配置 -import pxtoviewport from '@ttou/postcss-px-to-viewport'; -import { defineBuildConfig } from '@fesjs/fes'; +// .fes.js 只负责管理编译时配置,只能使用plain Object -export default defineBuildConfig({ - proxy: { - '/v2': { - 'target': 'https://api.douban.com/', - 'changeOrigin': true, +export default { + // exportStatic: {}, + define: { + __DEV__: false + }, + title: '海贼王', + router: { + mode: 'hash' + }, + access: { + roles: { + admin: ['*'], + menuTest: ['/', '/menuTest'] } }, request: { dataField: 'result' }, -}); - + mock: { + prefix: '/v2' + }, + proxy: { + '/v2': { + target: 'https://api.douban.com/', + changeOrigin: true + } + }, + layout: { + title: 'Fes.js', + footer: 'Created by MumbleFE', + multiTabs: false, + navigation: 'side', + theme: 'dark', + menus: [ + { + name: 'index', + icon: '/wine-outline.svg', + match: ['/route/*'] + }, + { + name: 'store' + }, + { + name: 'editor', + icon: '/wine-outline.svg' + }, + { + title: '$externalLink', + icon: 'UserOutlined', + path: 'https://www.baidu.com' + }, + { + name: 'mock' + }, + { + title: '菜单权限测试', + children: [ + { + title: '子菜单', + path: '/menuTest' + }, + ] + }, + { + name: 'cssModule' + }, + { + name: 'pinia' + } + ] + }, + locale: { + legacy: true + }, + enums: { + status: [ + ['0', '无效的'], + ['1', '有效的'] + ] + }, + vuex: { + strict: true + }, + dynamicImport: true, + monacoEditor: { + languages: ['javascript', 'typescript', 'html', 'json'] + } +}; diff --git a/packages/fes-template-vite1/.fes.local.js b/packages/fes-template-vite/.fes.local.js similarity index 100% rename from packages/fes-template-vite1/.fes.local.js rename to packages/fes-template-vite/.fes.local.js diff --git a/packages/fes-template-vite/.fes.prod.js b/packages/fes-template-vite/.fes.prod.js index 0f64aa6a..153393d8 100644 --- a/packages/fes-template-vite/.fes.prod.js +++ b/packages/fes-template-vite/.fes.prod.js @@ -2,7 +2,5 @@ export default { - request: { - base: '/api' - } + publicPath: 'https://gw.alipayobjects.com/' }; diff --git a/packages/fes-template-vite/.gitignore b/packages/fes-template-vite/.gitignore index 15fc6484..df903b98 100644 --- a/packages/fes-template-vite/.gitignore +++ b/packages/fes-template-vite/.gitignore @@ -2,7 +2,7 @@ # dependencies /node_modules - +/coverage # fes /src/.fes diff --git a/packages/fes-template-vite/README.md b/packages/fes-template-vite/README.md index 6fa4ffc4..538aac0b 100644 --- a/packages/fes-template-vite/README.md +++ b/packages/fes-template-vite/README.md @@ -1,3 +1,12 @@ -# fes h5 模版 +# fes 模版 内部测试用,不对外发布 + + +## 环境变量 + +* 业务代码使用的全局变量,使用 webpack define 定义 +* 针对不同的环境构建的变量 + * 开发环境 .evn.local + * .env 定义环境变量 + * .env.xxx 定义特定的环境变 \ No newline at end of file diff --git a/packages/fes-template-vite1/__tests__/add.js b/packages/fes-template-vite/__tests__/add.js similarity index 100% rename from packages/fes-template-vite1/__tests__/add.js rename to packages/fes-template-vite/__tests__/add.js diff --git a/packages/fes-template-vite/index.html b/packages/fes-template-vite/index.html index e90f0a40..02276de9 100644 --- a/packages/fes-template-vite/index.html +++ b/packages/fes-template-vite/index.html @@ -2,21 +2,19 @@ - - - - - - - - - <%= title %> - + + + + <%= title %> + + - -
+ +
+ \ No newline at end of file diff --git a/packages/fes-template-vite1/mock.js b/packages/fes-template-vite/mock.js similarity index 100% rename from packages/fes-template-vite1/mock.js rename to packages/fes-template-vite/mock.js diff --git a/packages/fes-template-vite/package.json b/packages/fes-template-vite/package.json index 00a6bb25..72e53db6 100644 --- a/packages/fes-template-vite/package.json +++ b/packages/fes-template-vite/package.json @@ -1,11 +1,13 @@ { "name": "@fesjs/template-vite", "version": "2.0.0", - "description": "fes vite 构建模版", + "description": "fes项目模版", "scripts": { + "build": "fes build", "prod": "FES_ENV=prod fes build", + "analyze": "ANALYZE=1 fes build", "dev": "fes dev", - "analyze": "ANALYZE=1 fes build" + "test": "fes test" }, "keywords": [ "管理端", @@ -29,9 +31,9 @@ "repository": { "type": "git", "url": "git+https://github.com/WeBankFinTech/fes.js.git", - "directory": "packages/fes-template-vite" + "directory": "packages/fes-template" }, - "author": "qlin", + "author": "harrywan", "license": "MIT", "bugs": { "url": "https://github.com/WeBankFinTech/fes.js/issues" @@ -40,18 +42,26 @@ "publishConfig": { "access": "public" }, - "devDependencies": { - "@ttou/postcss-px-to-viewport": "1.1.4", - "@vue/compiler-sfc": "^3.2.2" - }, "dependencies": { - "@fesjs/build-vite": "^1.0.0", "@fesjs/fes": "^2.0.0", + "@fesjs/plugin-access": "^2.0.0", + "@fesjs/plugin-layout": "^4.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-icon": "^2.0.0", "@fesjs/plugin-request": "^2.0.0", - "@fesjs/plugin-windicss": "^2.0.8", - "core-js": "^3.21.1", - "vue": "^3.2.2" + "@fesjs/plugin-sass": "^2.0.0", + "@fesjs/plugin-monaco-editor": "^2.0.0-beta.0", + "@fesjs/plugin-windicss": "^2.0.0", + "@fesjs/plugin-pinia": "^2.0.0", + "@fesjs/fes-design": "^0.3.3", + "@fesjs/build-vite": "^1.0.0", + "vue": "^3.0.5", + "vuex": "^4.0.0", + "pinia": "^2.0.11" }, "private": true -} +} \ No newline at end of file diff --git a/packages/fes-template-vite1/public/wine-outline.svg b/packages/fes-template-vite/public/wine-outline.svg similarity index 100% rename from packages/fes-template-vite1/public/wine-outline.svg rename to packages/fes-template-vite/public/wine-outline.svg diff --git a/packages/fes-template-vite/src/app.js b/packages/fes-template-vite/src/app.js deleted file mode 100644 index 1182f5e1..00000000 --- a/packages/fes-template-vite/src/app.js +++ /dev/null @@ -1,20 +0,0 @@ -import { defineRuntimeConfig } from '@fesjs/fes'; - -export default defineRuntimeConfig({ - request: { - errorHandler: { - 111() { - console.log('root:111'); - }, - 500() { - console.log('500 error'); - }, - default(error) { - console.log(error); - }, - }, - }, - patchRoutes: () => { - console.log('patchRoutes'); - }, -}); diff --git a/packages/fes-template-vite1/src/app.jsx b/packages/fes-template-vite/src/app.jsx similarity index 100% rename from packages/fes-template-vite1/src/app.jsx rename to packages/fes-template-vite/src/app.jsx diff --git a/packages/fes-template-vite/src/common/service.js b/packages/fes-template-vite/src/common/service.js index e69de29b..1b66499d 100644 --- a/packages/fes-template-vite/src/common/service.js +++ b/packages/fes-template-vite/src/common/service.js @@ -0,0 +1,19 @@ +import { requestWrap } from '@fesjs/fes'; + +// TODO +// 响应体控制 +// formData 控制 +// 错误控制 +// 跳错误页面 || 或者重新登录 +// 段时间内不能重复发送的请求 + +// or +export default requestWrap({ + login: { + url: '', + throttle: 300, + options: { + method: 'get' + } + } +}); diff --git a/packages/fes-template-vite/src/common/utils.js b/packages/fes-template-vite/src/common/utils.js deleted file mode 100644 index c768364b..00000000 --- a/packages/fes-template-vite/src/common/utils.js +++ /dev/null @@ -1,63 +0,0 @@ -// 时间格式化 -// js 数字精度计算 -// 手机号、身份证号 等的校验 -// 数字分割 - -export function resetContainerHeight(dom) { - const originalHeight = document.body.clientHeight || document.documentElement.clientHeight; - - window.onresize = function () { - const resizeHeight = document.documentElement.clientHeight || document.body.clientHeight; - if (resizeHeight < originalHeight) { - // 恢复内容区域高度 - const container = document.querySelector(dom); - container.style.height = originalHeight; - } - }; -} - -export function resetInputBlur() { - const isWechat = window.navigator.userAgent.match(/MicroMessenger\/([\d.]+)/i); - if (!isWechat) return; - const wechatVersion = isWechat[1]; - const version = navigator.appVersion.match(/OS (\d+)_(\d+)_?(\d+)?/); - - // 如果设备类型为iOS 12+ 和wechat 6.7.4+,恢复成原来的视口 - if (+wechatVersion.replace(/\./g, '') >= 674 && +version[1] >= 12) { - window.scrollTo(0, Math.max(document.body.clientHeight, document.documentElement.clientHeight)); - } -} - -export function getQueryString(name) { - const reg = new RegExp(`(^|&)${name}=([^&]*)(&|$)`, 'i'); - const r = window.location.search.substr(1).match(reg); - if (r != null) { - return decodeURIComponent(r[2]); - } - return null; -} - -export function simpleRequest(options) { - const xhr = new XMLHttpRequest(); - xhr.timeout = 3000; - if (options.type === 'GET') { - xhr.open(options.type, options.url, options.async || true); - xhr.send(null); - } else if (options.type === 'POST') { - xhr.open(options.type, options.url, options.async || true); - xhr.setRequestHeader('Content-Type', 'application/json'); - xhr.send(JSON.stringify(options.data || {})); - } - xhr.onreadystatechange = function () { - if (xhr.readyState === 4) { - if (xhr.status >= 200 && xhr.status < 300) { - options.successed(xhr.responseText); - } else { - options.failed && options.failed(xhr); - } - } - }; - xhr.ontimeout = function () { - options.failed && options.failed(xhr); - }; -} diff --git a/packages/fes-template-vite1/src/components/PageLoading.vue b/packages/fes-template-vite/src/components/PageLoading.vue similarity index 100% rename from packages/fes-template-vite1/src/components/PageLoading.vue rename to packages/fes-template-vite/src/components/PageLoading.vue diff --git a/packages/fes-template-vite1/src/components/UserCenter.vue b/packages/fes-template-vite/src/components/UserCenter.vue similarity index 100% rename from packages/fes-template-vite1/src/components/UserCenter.vue rename to packages/fes-template-vite/src/components/UserCenter.vue diff --git a/packages/fes-template-vite/src/components/helloWorld.vue b/packages/fes-template-vite/src/components/helloWorld.vue deleted file mode 100644 index 7de50a9a..00000000 --- a/packages/fes-template-vite/src/components/helloWorld.vue +++ /dev/null @@ -1,14 +0,0 @@ - - - diff --git a/packages/fes-template-vite1/src/global.css b/packages/fes-template-vite/src/global.css similarity index 100% rename from packages/fes-template-vite1/src/global.css rename to packages/fes-template-vite/src/global.css diff --git a/packages/fes-template-vite1/src/global.scss b/packages/fes-template-vite/src/global.scss similarity index 100% rename from packages/fes-template-vite1/src/global.scss rename to packages/fes-template-vite/src/global.scss diff --git a/packages/fes-template-vite1/src/images/icon.png b/packages/fes-template-vite/src/images/icon.png similarity index 100% rename from packages/fes-template-vite1/src/images/icon.png rename to packages/fes-template-vite/src/images/icon.png diff --git a/packages/fes-template-vite/src/images/male.png b/packages/fes-template-vite/src/images/male.png deleted file mode 100644 index 6b275499..00000000 Binary files a/packages/fes-template-vite/src/images/male.png and /dev/null differ diff --git a/packages/fes-template-vite1/src/locales/en-US.js b/packages/fes-template-vite/src/locales/en-US.js similarity index 100% rename from packages/fes-template-vite1/src/locales/en-US.js rename to packages/fes-template-vite/src/locales/en-US.js diff --git a/packages/fes-template-vite1/src/locales/zh-CN.js b/packages/fes-template-vite/src/locales/zh-CN.js similarity index 100% rename from packages/fes-template-vite1/src/locales/zh-CN.js rename to packages/fes-template-vite/src/locales/zh-CN.js diff --git a/packages/fes-template-vite/src/models/user.js b/packages/fes-template-vite/src/models/user.js index e69de29b..3d8575f8 100644 --- a/packages/fes-template-vite/src/models/user.js +++ b/packages/fes-template-vite/src/models/user.js @@ -0,0 +1,8 @@ +import { ref } from 'vue'; + +export default function user() { + const count = ref(1); + return { + count + }; +} diff --git a/packages/fes-template-vite/src/pages/abc/test.jsx b/packages/fes-template-vite/src/pages/abc/test.jsx deleted file mode 100644 index 0607885d..00000000 --- a/packages/fes-template-vite/src/pages/abc/test.jsx +++ /dev/null @@ -1,7 +0,0 @@ -import { defineComponent } from 'vue'; - -export default defineComponent({ - setup() { - return () =>
hello jsx
; - }, -}); diff --git a/packages/fes-template-vite1/src/pages/cssModule.vue b/packages/fes-template-vite/src/pages/cssModule.vue similarity index 100% rename from packages/fes-template-vite1/src/pages/cssModule.vue rename to packages/fes-template-vite/src/pages/cssModule.vue diff --git a/packages/fes-template-vite1/src/pages/editor.vue b/packages/fes-template-vite/src/pages/editor.vue similarity index 100% rename from packages/fes-template-vite1/src/pages/editor.vue rename to packages/fes-template-vite/src/pages/editor.vue diff --git a/packages/fes-template-vite/src/pages/index.vue b/packages/fes-template-vite/src/pages/index.vue index 81824790..298cc045 100644 --- a/packages/fes-template-vite/src/pages/index.vue +++ b/packages/fes-template-vite/src/pages/index.vue @@ -1,54 +1,33 @@ - - + + +{ + "name": "index", + "title": "$home" +} + diff --git a/packages/fes-template-vite1/src/pages/menuTest/@id.vue b/packages/fes-template-vite/src/pages/menuTest/@id.vue similarity index 100% rename from packages/fes-template-vite1/src/pages/menuTest/@id.vue rename to packages/fes-template-vite/src/pages/menuTest/@id.vue diff --git a/packages/fes-template-vite1/src/pages/menuTest/index.vue b/packages/fes-template-vite/src/pages/menuTest/index.vue similarity index 100% rename from packages/fes-template-vite1/src/pages/menuTest/index.vue rename to packages/fes-template-vite/src/pages/menuTest/index.vue diff --git a/packages/fes-template-vite1/src/pages/menuTest/layout.vue b/packages/fes-template-vite/src/pages/menuTest/layout.vue similarity index 100% rename from packages/fes-template-vite1/src/pages/menuTest/layout.vue rename to packages/fes-template-vite/src/pages/menuTest/layout.vue diff --git a/packages/fes-template-vite1/src/pages/mock.vue b/packages/fes-template-vite/src/pages/mock.vue similarity index 100% rename from packages/fes-template-vite1/src/pages/mock.vue rename to packages/fes-template-vite/src/pages/mock.vue diff --git a/packages/fes-template-vite/src/pages/onepiece.vue b/packages/fes-template-vite/src/pages/onepiece.vue deleted file mode 100644 index e98bdd9c..00000000 --- a/packages/fes-template-vite/src/pages/onepiece.vue +++ /dev/null @@ -1,23 +0,0 @@ - - -{ - "title": "onepiece", - "layout": true -} - - diff --git a/packages/fes-template-vite1/src/pages/pinia.vue b/packages/fes-template-vite/src/pages/pinia.vue similarity index 100% rename from packages/fes-template-vite1/src/pages/pinia.vue rename to packages/fes-template-vite/src/pages/pinia.vue diff --git a/packages/fes-template-vite1/src/pages/route/@id.vue b/packages/fes-template-vite/src/pages/route/@id.vue similarity index 100% rename from packages/fes-template-vite1/src/pages/route/@id.vue rename to packages/fes-template-vite/src/pages/route/@id.vue diff --git a/packages/fes-template-vite1/src/pages/store.vue b/packages/fes-template-vite/src/pages/store.vue similarity index 100% rename from packages/fes-template-vite1/src/pages/store.vue rename to packages/fes-template-vite/src/pages/store.vue diff --git a/packages/fes-template-vite/src/pages/test.jsx b/packages/fes-template-vite/src/pages/test.jsx deleted file mode 100644 index ac70ed23..00000000 --- a/packages/fes-template-vite/src/pages/test.jsx +++ /dev/null @@ -1,15 +0,0 @@ -import { defineRouteMeta, useRoute } from '@fesjs/fes'; -import { defineComponent } from 'vue'; - -defineRouteMeta({ - title: 'test', - name: 'test', -}); - -export default defineComponent({ - setup() { - const route = useRoute(); - console.log(route); - return () =>
hello tsx
; - }, -}); diff --git a/packages/fes-template-vite1/src/store/main.js b/packages/fes-template-vite/src/store/main.js similarity index 100% rename from packages/fes-template-vite1/src/store/main.js rename to packages/fes-template-vite/src/store/main.js diff --git a/packages/fes-template-vite1/src/stores/counter.js b/packages/fes-template-vite/src/stores/counter.js similarity index 100% rename from packages/fes-template-vite1/src/stores/counter.js rename to packages/fes-template-vite/src/stores/counter.js diff --git a/packages/fes-template-vite1/src/stores/foo/bar.js b/packages/fes-template-vite/src/stores/foo/bar.js similarity index 100% rename from packages/fes-template-vite1/src/stores/foo/bar.js rename to packages/fes-template-vite/src/stores/foo/bar.js diff --git a/packages/fes-template-vite1/src/stores/plugin-loger.js b/packages/fes-template-vite/src/stores/plugin-loger.js similarity index 100% rename from packages/fes-template-vite1/src/stores/plugin-loger.js rename to packages/fes-template-vite/src/stores/plugin-loger.js diff --git a/packages/fes-template-vite1/src/stores/user.js b/packages/fes-template-vite/src/stores/user.js similarity index 100% rename from packages/fes-template-vite1/src/stores/user.js rename to packages/fes-template-vite/src/stores/user.js diff --git a/packages/fes-template-vite/src/styles/common.less b/packages/fes-template-vite/src/styles/common.less deleted file mode 100644 index 8d2bd816..00000000 --- a/packages/fes-template-vite/src/styles/common.less +++ /dev/null @@ -1,45 +0,0 @@ -a, -img { - -webkit-touch-callout: none; -} - -html { - touch-action: manipulation; // 处理 IOS10+,click点击 300ms 问题 -} -body { - background-color: #f7f7f7; -} - -input { - line-height: normal; - border: none; -} - -a { - color: #0af; - text-decoration: none; -} - -* { - -webkit-tap-highlight-color: rgba(0, 0, 0, 0); -} - -/* 适配 iPhone X 顶部填充*/ -@supports (top: env(safe-area-inset-top)){ - body, - .alien-screen-header { - padding-top: constant(safe-area-inset-top, 40px); - padding-top: env(safe-area-inset-top, 40px); - padding-top: var(safe-area-inset-top, 40px); - } -} - -/* 判断iPhoneX 将 footer 的 padding-bottom 填充到最底部 */ -@supports (bottom: env(safe-area-inset-bottom)){ - body, - .alien-screen-footer { - padding-bottom: constant(safe-area-inset-bottom, 20px); - padding-bottom: env(safe-area-inset-bottom, 20px); - padding-top: var(safe-area-inset-bottom, 20px); - } -} diff --git a/packages/fes-template-vite/src/styles/mixins/hairline.less b/packages/fes-template-vite/src/styles/mixins/hairline.less deleted file mode 100644 index c95c6f3d..00000000 --- a/packages/fes-template-vite/src/styles/mixins/hairline.less +++ /dev/null @@ -1,173 +0,0 @@ -@import "../theme"; - -.scale-hairline-common(@color, @top, @right, @bottom, @left) { - content: ''; - position: absolute; - background-color: @color; - display: block; - z-index: 1; - top: @top; - right: @right; - bottom: @bottom; - left: @left; -} - -.hairline(@direction, @color: @border-color-base) when (@direction ='top') { - border-top: 1PX solid @color; - - html:not([data-scale]) & { - @media (min-resolution: 2dppx) { - border-top: none; - position: relative; - - &::before { - .scale-hairline-common(@color, 0, auto, auto, 0); - width: 100%; - height: 1PX; - transform-origin: 50% 50%; - transform: scaleY(0.5); - - @media (min-resolution: 3dppx) { - transform: scaleY(0.33); - } - } - } - } -} - -.hairline(@direction, @color: @border-color-base) when (@direction ='right') { - border-right: 1PX solid @color; - - html:not([data-scale]) & { - @media (min-resolution: 2dppx) { - border-right: none; - position: relative; - - &::after { - .scale-hairline-common(@color, 0, 0, auto, auto); - width: 1PX; - height: 100%; - background: @color; - transform-origin: 100% 50%; - transform: scaleX(0.5); - - @media (min-resolution: 3dppx) { - transform: scaleX(0.33); - } - } - } - } -} - -.hairline(@direction, @color: @border-color-base) when (@direction ='bottom') { - border-bottom: 1PX solid @color; - - html:not([data-scale]) & { - @media (min-resolution: 2dppx) { - border-bottom: none; - position: relative; - - &::after { - .scale-hairline-common(@color, auto, auto, 0, 0); - width: 100%; - height: 1PX; - transform-origin: 50% 100%; - transform: scaleY(0.5); - - @media (min-resolution: 3dppx) { - transform: scaleY(0.33); - } - } - } - } -} - -.hairline(@direction, @color: @border-color-base) when (@direction ='left') { - border-left: 1PX solid @color; - - html:not([data-scale]) & { - @media (min-resolution: 2dppx) { - border-left: none; - position: relative; - - &::before { - .scale-hairline-common(@color, 0, auto, auto, 0); - width: 1PX; - height: 100%; - transform-origin: 100% 50%; - transform: scaleX(0.5); - - @media (min-resolution: 3dppx) { - transform: scaleX(0.33); - } - } - } - } -} - -.hairline(@direction, @color: @border-color-base, @radius: 0) when (@direction ='all') { - border: 1PX solid @color; - border-radius: @radius; - - html:not([data-scale]) & { - @media (min-resolution: 2dppx) { - position: relative; - border: none; - - &::before { - content: ''; - position: absolute; - left: 0; - top: 0; - width: 200%; - height: 200%; - border: 1PX solid @color; - border-radius: @radius * 2; - transform-origin: 0 0; - transform: scale(0.5); - box-sizing: border-box; - pointer-events: none; - } - } - } -} - -.hairline-remove(@position) when (@position ='left') { - border-left: 0; - - &:before { - display: none !important; - } -} - -.hairline-remove(@position) when (@position ='right') { - border-right: 0; - - &:after { - display: none !important; - } -} - -.hairline-remove(@position) when (@position ='top') { - border-top: 0; - - &:before { - display: none !important; - } -} - -.hairline-remove(@position) when (@position ='bottom') { - border-bottom: 0; - - &:after { - display: none !important; - } -} - -.hairline-remove(@position) when (@position ='all') { - border: 0; - - &:before { - display: none !important; - } -} diff --git a/packages/fes-template-vite/src/styles/mixins/hover.less b/packages/fes-template-vite/src/styles/mixins/hover.less deleted file mode 100644 index 79b33664..00000000 --- a/packages/fes-template-vite/src/styles/mixins/hover.less +++ /dev/null @@ -1,6 +0,0 @@ - -.hover() { - &:active { - box-shadow: inset 0 0 1000px rgba(0, 0, 0, .5); - } -} \ No newline at end of file diff --git a/packages/fes-template-vite/src/styles/mixins/scroll.less b/packages/fes-template-vite/src/styles/mixins/scroll.less deleted file mode 100644 index 7fa92c44..00000000 --- a/packages/fes-template-vite/src/styles/mixins/scroll.less +++ /dev/null @@ -1,4 +0,0 @@ -.scroll() { - -webkit-overflow-scrolling: touch; - overflow-y: auto; -} \ No newline at end of file diff --git a/packages/fes-template-vite/src/styles/reset.less b/packages/fes-template-vite/src/styles/reset.less deleted file mode 100644 index a02d2861..00000000 --- a/packages/fes-template-vite/src/styles/reset.less +++ /dev/null @@ -1,142 +0,0 @@ -@charset "UTF-8"; - -// 所有元素为border-box -* { - box-sizing: border-box; -} - -html { - -webkit-text-size-adjust: 100%; - -ms-text-size-adjust: 100%; -} - -body, -h1, -h2, -h3, -h4, -h5, -h6, -ul, -ol, -li, -dl, -dd, -p, -form, -th, -td, -fieldset, -legend, -blockquote, -button, -input, -select, -textarea { - margin: 0; - padding: 0; -} - -body, -button, -input, -select, -textarea { - font: 14*@PX/1.5 tahoma, arial, "Hiragino Sans GB", "Microsoft YaHei"; -} - - -body { - color: @txt-color; - background-color: @bg-color; - font-size: 14px; - word-wrap: break-word; -} - -h1, -h2, -h3, -h4, -h5, -h6 { - font-size: 100%; - font-weight: normal; -} - -ol, -ul { - list-style: none; -} - -img { - border: 0; - vertical-align: middle; -} - -address, -cite, -dfn, -em, -i, -var { - font-style: normal; -} - -a { - text-decoration: none; - cursor: pointer; -} - -a:hover { - text-decoration: none; -} - -a:focus { - outline: none; -} - -table { - border-spacing: 0; - word-wrap: break-word; - border-collapse: separate; -} - -input, -select, -button { - outline: none; - vertical-align: middle; -} - -input[type='search']::-webkit-search-decoration, -input[type='search']::-webkit-search-cancel-button, -input[type='search']::-webkit-search-results-button, -input[type='search']::-webkit-search-results-decoration { - display: none; -} - -input::-ms-clear { - display: none; -} - -select::-ms-expand { - display: none; -} - -button, -input, -select, -textarea { - margin: 0; - font-size: 100%; - font-family: inherit; - outline-offset: 0; - outline-style: none; - outline-width: 0; - background-image: none; -} - -input[readonly], -textarea[readonly] { - background-color: #F1F1F1; -} diff --git a/packages/fes-template-vite/src/styles/theme.less b/packages/fes-template-vite/src/styles/theme.less deleted file mode 100644 index 3591eb88..00000000 --- a/packages/fes-template-vite/src/styles/theme.less +++ /dev/null @@ -1,20 +0,0 @@ -@charset "UTF-8"; - -@PX: 1px; -@rem: 0.01rem; -@a-hover: #eeeeee; - -//大背景色 -//----------------------------------------------------- -@bg-color: #ffffff; - -// 边框色 -@border-color-base: #ddd; - - -//文字颜色 -//----------------------------------------------------- -@txt-color: #666666; - -// icon 颜色 -@icon-color: inherit; \ No newline at end of file diff --git a/packages/fes-template-vite1/src/utils/sum.js b/packages/fes-template-vite/src/utils/sum.js similarity index 100% rename from packages/fes-template-vite1/src/utils/sum.js rename to packages/fes-template-vite/src/utils/sum.js diff --git a/packages/fes-template-vite/tsconfig.json b/packages/fes-template-vite/tsconfig.json index f8e8cc7a..b7fce5b7 100644 --- a/packages/fes-template-vite/tsconfig.json +++ b/packages/fes-template-vite/tsconfig.json @@ -3,10 +3,7 @@ "outDir": "build/dist", "module": "esnext", "target": "esnext", - "lib": [ - "esnext", - "dom" - ], + "lib": ["esnext", "dom"], "sourceMap": true, "baseUrl": ".", "jsx": "preserve", @@ -17,31 +14,25 @@ "suppressImplicitAnyIndexErrors": true, "noUnusedLocals": true, "allowJs": true, + "skipLibCheck": true, "experimentalDecorators": true, "strict": true, "paths": { - "@/*": [ - "./src/*" - ], - "@@/*": [ - "./src/.fes/*" - ] + "@/*": ["./src/*"], + "@@/*": ["./src/.fes/*"] } }, "include": [ - "*.js", - ".fes.js", "src/**/*", + "tests/**/*", + "test/**/*", + "__test__/**/*", "typings/**/*", "config/**/*", + ".eslintrc.js", + ".stylelintrc.js", + ".prettierrc.js", "src/.fes/configType.d.ts" ], - "exclude": [ - "build", - "dist", - "scripts", - "webpack", - "jest", - "node_modules" - ] -} \ No newline at end of file + "exclude": ["node_modules", "build", "dist", "scripts", "src/.fes/*", "webpack", "jest"] +} diff --git a/packages/fes-template-vite1/.fes.js b/packages/fes-template-vite1/.fes.js deleted file mode 100644 index 07aa82f0..00000000 --- a/packages/fes-template-vite1/.fes.js +++ /dev/null @@ -1,90 +0,0 @@ -// .fes.js 只负责管理编译时配置,只能使用plain Object - -export default { - // exportStatic: {}, - define: { - __DEV__: false - }, - title: '海贼王', - router: { - mode: 'hash' - }, - access: { - roles: { - admin: ['*'], - menuTest: ['/', '/menuTest'] - } - }, - request: { - dataField: 'result' - }, - mock: { - prefix: '/v2' - }, - proxy: { - '/v2': { - target: 'https://api.douban.com/', - changeOrigin: true - } - }, - layout: { - title: 'Fes.js', - footer: 'Created by MumbleFE', - multiTabs: false, - navigation: 'side', - theme: 'dark', - menus: [ - { - name: 'index', - icon: '/wine-outline.svg', - match: ['/route/*'] - }, - { - name: 'store' - }, - { - name: 'editor', - icon: '/wine-outline.svg' - }, - { - title: '$externalLink', - icon: 'UserOutlined', - path: 'https://www.baidu.com' - }, - { - name: 'mock' - }, - { - title: '菜单权限测试', - children: [ - { - title: '子菜单', - path: '/menuTest' - }, - ] - }, - { - name: 'cssModule' - }, - { - name: 'pinia' - } - ] - }, - locale: { - legacy: true - }, - enums: { - status: [ - ['0', '无效的'], - ['1', '有效的'] - ] - }, - vuex: { - strict: true - }, - dynamicImport: true, - monacoEditor: { - languages: ['javascript', 'typescript', 'html', 'json'] - } -}; diff --git a/packages/fes-template-vite1/.fes.prod.js b/packages/fes-template-vite1/.fes.prod.js deleted file mode 100644 index 153393d8..00000000 --- a/packages/fes-template-vite1/.fes.prod.js +++ /dev/null @@ -1,6 +0,0 @@ -// .fes.js 只负责管理编译时配置,只能使用plain Object - - -export default { - publicPath: 'https://gw.alipayobjects.com/' -}; diff --git a/packages/fes-template-vite1/.gitignore b/packages/fes-template-vite1/.gitignore deleted file mode 100644 index df903b98..00000000 --- a/packages/fes-template-vite1/.gitignore +++ /dev/null @@ -1,11 +0,0 @@ -.DS_Store - -# dependencies -/node_modules -/coverage - -# fes -/src/.fes -/src/.fes-production -/src/.fes-test -/.env.local diff --git a/packages/fes-template-vite1/LICENSE b/packages/fes-template-vite1/LICENSE deleted file mode 100644 index 0978fbf7..00000000 --- a/packages/fes-template-vite1/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -MIT License - -Copyright (c) 2020-present webank - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. \ No newline at end of file diff --git a/packages/fes-template-vite1/README.md b/packages/fes-template-vite1/README.md deleted file mode 100644 index 538aac0b..00000000 --- a/packages/fes-template-vite1/README.md +++ /dev/null @@ -1,12 +0,0 @@ -# fes 模版 - -内部测试用,不对外发布 - - -## 环境变量 - -* 业务代码使用的全局变量,使用 webpack define 定义 -* 针对不同的环境构建的变量 - * 开发环境 .evn.local - * .env 定义环境变量 - * .env.xxx 定义特定的环境变 \ No newline at end of file diff --git a/packages/fes-template-vite1/index.html b/packages/fes-template-vite1/index.html deleted file mode 100644 index 02276de9..00000000 --- a/packages/fes-template-vite1/index.html +++ /dev/null @@ -1,20 +0,0 @@ - - - - - - - - <%= title %> - - - - - -
- - - - \ No newline at end of file diff --git a/packages/fes-template-vite1/package.json b/packages/fes-template-vite1/package.json deleted file mode 100644 index a7d18750..00000000 --- a/packages/fes-template-vite1/package.json +++ /dev/null @@ -1,66 +0,0 @@ -{ - "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" - }, - "dependencies": { - "@fesjs/fes": "^2.0.0", - "@fesjs/plugin-access": "^2.0.0", - "@fesjs/plugin-layout": "^4.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-sass": "^2.0.0", - "@fesjs/plugin-monaco-editor": "^2.0.0-beta.0", - "@fesjs/plugin-windicss": "^2.0.0", - "@fesjs/plugin-pinia": "^2.0.0", - "@fesjs/fes-design": "^0.3.3", - "@fesjs/build-vite": "^1.0.0", - "vue": "^3.0.5", - "vuex": "^4.0.0", - "pinia": "^2.0.11" - }, - "private": true -} \ No newline at end of file diff --git a/packages/fes-template-vite1/public/logo.png b/packages/fes-template-vite1/public/logo.png deleted file mode 100644 index 4958e971..00000000 Binary files a/packages/fes-template-vite1/public/logo.png and /dev/null differ diff --git a/packages/fes-template-vite1/src/common/service.js b/packages/fes-template-vite1/src/common/service.js deleted file mode 100644 index 1b66499d..00000000 --- a/packages/fes-template-vite1/src/common/service.js +++ /dev/null @@ -1,19 +0,0 @@ -import { requestWrap } from '@fesjs/fes'; - -// TODO -// 响应体控制 -// formData 控制 -// 错误控制 -// 跳错误页面 || 或者重新登录 -// 段时间内不能重复发送的请求 - -// or -export default requestWrap({ - login: { - url: '', - throttle: 300, - options: { - method: 'get' - } - } -}); diff --git a/packages/fes-template-vite1/src/models/user.js b/packages/fes-template-vite1/src/models/user.js deleted file mode 100644 index 3d8575f8..00000000 --- a/packages/fes-template-vite1/src/models/user.js +++ /dev/null @@ -1,8 +0,0 @@ -import { ref } from 'vue'; - -export default function user() { - const count = ref(1); - return { - count - }; -} diff --git a/packages/fes-template-vite1/src/pages/index.vue b/packages/fes-template-vite1/src/pages/index.vue deleted file mode 100644 index b78e7fa2..00000000 --- a/packages/fes-template-vite1/src/pages/index.vue +++ /dev/null @@ -1,32 +0,0 @@ - - - - - - - -{ - "name": "index", - "title": "$home" -} - diff --git a/packages/fes-template-vite1/tsconfig.json b/packages/fes-template-vite1/tsconfig.json deleted file mode 100644 index b7fce5b7..00000000 --- a/packages/fes-template-vite1/tsconfig.json +++ /dev/null @@ -1,38 +0,0 @@ -{ - "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", - "src/.fes/configType.d.ts" - ], - "exclude": ["node_modules", "build", "dist", "scripts", "src/.fes/*", "webpack", "jest"] -} diff --git a/yarn.lock b/yarn.lock index 225a8556..2f7a760e 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4176,7 +4176,7 @@ core-js-compat@^3.20.2, core-js-compat@^3.21.0: browserslist "^4.19.1" semver "7.0.0" -core-js@^3.19.2, core-js@^3.21.1, core-js@^3.6.1: +core-js@^3.19.2, core-js@^3.6.1: version "3.21.1" resolved "https://registry.npmmirror.com/core-js/-/core-js-3.21.1.tgz#f2e0ddc1fc43da6f904706e8e955bc19d06a0d94" integrity sha512-FRq5b/VMrWlrmCzwRrpDYNxyHP9BcAZC+xHJaqTgIE5091ZV1NTmyh0sGOg5XqpnHvR0svdy0sv1gWA1zmhxig==