Skip to content

Commit

Permalink
Merge branch 'template' into release
Browse files Browse the repository at this point in the history
  • Loading branch information
yuntian001 committed Jan 6, 2023
2 parents 925e857 + 342ff32 commit a4d3d32
Show file tree
Hide file tree
Showing 42 changed files with 630 additions and 264 deletions.
7 changes: 6 additions & 1 deletion .eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ module.exports = {
leadingUnderscore: 'allow',
filter: {
// you can expand this regex to add more allowed names
regex: '^((__v_.*)|[0-9]+)$',
regex: '^((__v_.*)|([0-9]+)|(__.*))$',
match: false,
},
},
Expand All @@ -74,6 +74,11 @@ module.exports = {
modifiers: ['const'],
format: ['camelCase', 'UPPER_CASE', 'PascalCase'],
leadingUnderscore: 'allow',
filter: {
// you can expand this regex to add more allowed names
regex: '^__.*$',
match: false,
},
},
{
selector: ['memberLike'],
Expand Down
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ dist-ssr
*.sln
*.sw?
package-lock.json
types/auto-imports.d.ts
types/meIconComments.d.ts
src/store/module.ts
types/directives.d.ts
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
# Me-admin template
## 简介
Me-admin template是一个免费开源的中后台模板,基于vue3、vite3、 pinia、 elment-plus构建,开箱即用,本项目的开源协议为最宽松的MIT协议,使用无任何限制,本项目采用最新技术栈,可以作为项目的启动模版,以帮助你快速搭建企业级中后台,也是一个很好的学习项目。
Me-admin template是一个免费开源的中后台模板,基于vue3、vite4、 pinia、 elment-plus构建,开箱即用,本项目的开源协议为最宽松的MIT协议,使用无任何限制,本项目采用最新技术栈,可以作为项目的启动模版,以帮助你快速搭建企业级中后台,也是一个很好的学习项目。

开源不易,如果能帮到您,麻烦在[Github](https://github.com/meadmin-cn/meadmin-template)中点个star。

**中文** | [English](./README_EN.md)


## 特性
- **基于vue3、vite3、pinia、elment-plus、vue-request@next**
- **基于vue3、vite4、pinia、elment-plus、vue-request@next**
- **基于typescript** 应用级JavaScript 的语言
- **可配置主题** 可配置主题色及主题模式
- **友好的国际化方案** 基于vue-i18n 支持按组件异步加载语言包。
Expand Down
4 changes: 2 additions & 2 deletions README_EN.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# Me-admin template
## Introduction
Me-admin template is a free open source admin template, built on VUE3, VitE3, Pinia, and Elment-Plus, right out of the box.
Me-admin template is a free open source admin template, built on VUE3, Vite4, Pinia, and Elment-Plus, right out of the box.

**English** | [中文](./README.md)


## Feature
- **Base on vue3、vite3、pinia、elment-plus、vue-request@next**
- **Base on vue3、vite4、pinia、elment-plus、vue-request@next**
- **Base on typescript** The language of application-level JavaScript
- **Configurable Themes** Configurable theme color and theme mode
- **Friendly internationalisation scheme** Support for asynchronous loading of language packs by component based on vue-i18n.
Expand Down
65 changes: 45 additions & 20 deletions TEMPLATE-CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,30 @@




## [1.1.7](https://github.com/meadmin-cn/meadmin-template/compare/template-1.1.6...template-1.1.7) (2023-01-06)


### 重构[refactor]

* 将vite plugin 提取到plugins目录中优化目录结构 ([d121f11](https://github.com/meadmin-cn/meadmin-template/commit/d121f119d7e1174230d6801190527dd11f338a5c))
* enums 更换为dict ([58c6f8d](https://github.com/meadmin-cn/meadmin-template/commit/58c6f8dbad246e04a379c7c382fa308a8b26d84c))


### 性能改进[perf]

* 升级vite版本为4 typescript为4.9 ([4174cda](https://github.com/meadmin-cn/meadmin-template/commit/4174cda2dd9623f0132cf8611b6a19e5e1f4f3a0))
* 优化tsc校验 ([ea23ee4](https://github.com/meadmin-cn/meadmin-template/commit/ea23ee428d0e6eb32c3e6846a4ce08e77ff874c0))


### 文档更改[docs]

* vite版本改为4版本 ([f733260](https://github.com/meadmin-cn/meadmin-template/commit/f7332606f0fb929605401a444bbfc4eca566c36c))


### Bug 修复[fix]

* 变量错误修复 ([89f2e91](https://github.com/meadmin-cn/meadmin-template/commit/89f2e91f9e64cb452409104691661529daabfd2b))
* 修复 加载路由组件异常后切换路由loading不关闭bug ([dba02e2](https://github.com/meadmin-cn/meadmin-template/commit/dba02e221a4d314b161b7809bc81362f4ea6d0d5))

## [1.1.6](https://github.com/meadmin-cn/meadmin-template/compare/template-1.1.4...template-1.1.6) (2022-12-20)


Expand All @@ -15,8 +40,8 @@

### 文档更改[docs]

* 特性介绍添加 ([67fd3c4](https://github.com/meadmin-cn/meadmin-template/commit/67fd3c40b0df4693378a138582da8206192f47ec))

* 特性介绍添加 ([67fd3c4](https://github.com/meadmin-cn/meadmin-template/commit/67fd3c40b0df4693378a138582da8206192f47ec))

## [1.1.4](https://github.com/meadmin-cn/meadmin-template/compare/template-1.1.3...template-1.1.4) (2022-12-19)


Expand All @@ -28,8 +53,8 @@

### Bug 修复[fix]

* **router:** 修复 连续跳转两个路由菜单progress进度条不关闭的问题 ([1c25234](https://github.com/meadmin-cn/meadmin-template/commit/1c25234f9477fe700a24fff1b16e661c00f3a079))

* **router:** 修复 连续跳转两个路由菜单progress进度条不关闭的问题 ([1c25234](https://github.com/meadmin-cn/meadmin-template/commit/1c25234f9477fe700a24fff1b16e661c00f3a079))

## [1.1.3](https://github.com/meadmin-cn/meadmin-template/compare/template-1.1.2...template-1.1.3) (2022-12-01)


Expand All @@ -51,8 +76,8 @@

### 其他[chore]

* **package:** element-plus 依赖版本更新 ([ea392e7](https://github.com/meadmin-cn/meadmin-template/commit/ea392e7b76145a558e61e248ab36e6470fc3b83f))

* **package:** element-plus 依赖版本更新 ([ea392e7](https://github.com/meadmin-cn/meadmin-template/commit/ea392e7b76145a558e61e248ab36e6470fc3b83f))

## [1.1.2](https://github.com/meadmin-cn/meadmin-template/compare/template-1.1.1...template-1.1.2) (2022-11-17)


Expand All @@ -69,8 +94,8 @@

### 文档更改[docs]

* **README:** 文档介绍更改 ([c77a402](https://github.com/meadmin-cn/meadmin-template/commit/c77a402486286e8b78198bd4f8518f3623a24368))

* **README:** 文档介绍更改 ([c77a402](https://github.com/meadmin-cn/meadmin-template/commit/c77a402486286e8b78198bd4f8518f3623a24368))

## [1.1.1](https://github.com/meadmin-cn/meadmin-template/compare/template-1.1.0...template-1.1.1) (2022-11-10)


Expand All @@ -82,8 +107,8 @@

### Bug 修复[fix]

* 修复layout及子组件更改时热更新报错问题(将layout layoutPage改为动态引入) ([3a96bb6](https://github.com/meadmin-cn/meadmin-template/commit/3a96bb6fc0bba6419d82f36d889488ae8b374651))

* 修复layout及子组件更改时热更新报错问题(将layout layoutPage改为动态引入) ([3a96bb6](https://github.com/meadmin-cn/meadmin-template/commit/3a96bb6fc0bba6419d82f36d889488ae8b374651))

## [1.1.0](https://github.com/meadmin-cn/meadmin-template/compare/template-1.0.13...template-1.1.0) (2022-11-07)


Expand All @@ -106,15 +131,15 @@

* 加上app create start 表示以便判断是否是热更新引用拿到 ([417d82f](https://github.com/meadmin-cn/meadmin-template/commit/417d82f1e4d5dab5a72eb190ac9389164af7ca62))
* 接口请求公共提示加上国际化支持 ([dfaeb8b](https://github.com/meadmin-cn/meadmin-template/commit/dfaeb8b3f44a3e938924aa248366ec28487ed855))
* 请求示例加上自动请求示例 ([5c01ed5](https://github.com/meadmin-cn/meadmin-template/commit/5c01ed522b0080deac654c5719f8175fc169e8ce))

* 请求示例加上自动请求示例 ([5c01ed5](https://github.com/meadmin-cn/meadmin-template/commit/5c01ed522b0080deac654c5719f8175fc169e8ce))

## [1.0.13](https://github.com/meadmin-cn/meadmin-template/compare/template-1.0.12...template-1.0.13) (2022-10-19)


### Bug 修复[fix]

* 修复optimizeDeps.entries设置错误(应为相对于项目根的相对路径) ([962ae3b](https://github.com/meadmin-cn/meadmin-template/commit/962ae3b9a964289f42e1b48cb94e889527a9e7cd))

* 修复optimizeDeps.entries设置错误(应为相对于项目根的相对路径) ([962ae3b](https://github.com/meadmin-cn/meadmin-template/commit/962ae3b9a964289f42e1b48cb94e889527a9e7cd))

## [1.0.12](https://github.com/meadmin-cn/meadmin-template/compare/template-1.0.11...template-1.0.12) (2022-10-19)


Expand All @@ -132,8 +157,8 @@
### Bug 修复[fix]

* 修复请求loading异常和mock异常问题 ([11afdc4](https://github.com/meadmin-cn/meadmin-template/commit/11afdc4acc2ab614d2e1a2cd768a8aba9174c2d1))
* 已登录情况下访问时loading无法消除问题。 ([b928655](https://github.com/meadmin-cn/meadmin-template/commit/b928655101283ba5a110c5c77321a474c7629044))

* 已登录情况下访问时loading无法消除问题。 ([b928655](https://github.com/meadmin-cn/meadmin-template/commit/b928655101283ba5a110c5c77321a474c7629044))

## [1.0.11](https://github.com/meadmin-cn/meadmin-template/compare/template-1.0.10...template-1.0.11) (2022-10-08)


Expand All @@ -151,8 +176,8 @@

* 包版本变更为正式版本 ([d2df17e](https://github.com/meadmin-cn/meadmin-template/commit/d2df17eb043fea4ce5a96652ad856029858208dc))
* 提交日志和版本还原 ([2e94319](https://github.com/meadmin-cn/meadmin-template/commit/2e9431999603e96fc33195f8bb4cc861e6270ff3))
* template-release v1.0.11 ([547cd8e](https://github.com/meadmin-cn/meadmin-template/commit/547cd8e608c5c7bd755ecb4cf516429c1f6e2be8))

* template-release v1.0.11 ([547cd8e](https://github.com/meadmin-cn/meadmin-template/commit/547cd8e608c5c7bd755ecb4cf516429c1f6e2be8))

## [1.0.10](https://github.com/meadmin-cn/meadmin-template/compare/template-1.0.9...template-1.0.10) (2022-10-02)


Expand Down
3 changes: 3 additions & 0 deletions cli/autoImport.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/usr/bin/env ts-node
import autoImport from '../plugins/autoImport.js';
autoImport().buildStart();
17 changes: 9 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "meadmin-template",
"private": true,
"version": "1.1.6",
"version": "1.1.7",
"type": "module",
"author": {
"name": "meadmin-cn",
Expand All @@ -11,9 +11,9 @@
"scripts": {
"format": "prettier --write --cache .",
"dev": "vite",
"build": "vite build -m prod && npm run type-check",
"build-github": "vite build -m prod --base=/meadmin-template/ && npm run type-check",
"type-check": "vue-tsc --noEmit --skipLibCheck",
"build": "npm run type-check && vite build -m prod ",
"build-github": "npm run type-check && vite build -m prod --base=/meadmin-template/",
"type-check": "node --loader ts-node/esm ./cli/autoImport.ts && vue-tsc --noEmit",
"preview": "vite preview",
"release-main": "release-it -c .release-it-main.json",
"release-template": "release-it",
Expand Down Expand Up @@ -67,7 +67,7 @@
"@types/path-browserify": "^1.0.0",
"@typescript-eslint/eslint-plugin": "^5.33.1",
"@typescript-eslint/parser": "^5.33.1",
"@vitejs/plugin-vue": "^3.0.0",
"@vitejs/plugin-vue": "^4.0.0",
"@vue/eslint-config-typescript": "^11.0.0",
"@yuntian001/vue-setup-extend": "^1.0.0",
"autoprefixer": "^10.4.8",
Expand All @@ -83,15 +83,16 @@
"rollup-plugin-visualizer": "^5.7.1",
"sass": "^1.53.0",
"terser": "^5.14.2",
"typescript": "^4.7.4",
"ts-node": "^10.9.1",
"typescript": "^4.9.4",
"unplugin-auto-import": "^0.11.1",
"unplugin-vue-components": "^0.22.4",
"vite": "^3.0.0",
"vite": "^4.0.4",
"vite-plugin-autogeneration-import-file": "^3.0.0",
"vite-plugin-compression": "^0.5.1",
"vite-svg-loader": "^3.4.0",
"vue-eslint-parser": "^9.0.3",
"vue-tsc": "^1.0.9",
"vue-tsc": "^1.0.20",
"xregexp": "^5.1.1"
},
"repository": {
Expand Down
10 changes: 10 additions & 0 deletions plugins/autoComponents.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { ElementPlusResolver } from 'unplugin-vue-components/resolvers';
import Components from 'unplugin-vue-components/vite';
import { resolver } from './autoImport';
export default () =>
Components({
// 组件自动注册(包括components下的所有.vue组件和ElementPlus组件)
include: [],
dts: false,
resolvers: [ElementPlusResolver({ importStyle: false }), resolver([3], [2])],
});
64 changes: 64 additions & 0 deletions plugins/autoImport.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
import { dirname, resolve } from 'path';
import * as fs from 'fs';
import { createPlugin } from 'vite-plugin-autogeneration-import-file';
import { fileURLToPath } from 'url';
const { autoImport, resolver: resolverFn } = createPlugin();
const __filename = fileURLToPath(import.meta.url);
const __dirname = dirname(__filename);
function pathResolve(dir: string) {
return resolve(__dirname, '../', dir);
}
export default () =>
autoImport([
// 自动生成
{
// svg icon type
pattern: ['*.svg'],
dir: pathResolve('src/icons/svg'),
toFile: pathResolve('types/meIconComments.d.ts'),
name: 'MeIcon_{{name}}',
template: fs.readFileSync(pathResolve('./template/meIconComments.d.ts'), 'utf-8'),
codeTemplates: [{ key: '//code', template: '{{name}}: Icon;\n ' }],
},
{
// pinia module
pattern: ['**/*.{ts,js}', '*.{ts,js}'],
dir: pathResolve('src/store/modules'),
toFile: pathResolve('src/store/module.ts'),
name: 'use_{{name}}_store',
},
{
// auto import directives
pattern: ['*.ts', '**/index.ts'],
dir: pathResolve('src/directives'),
toFile: pathResolve('types/directives.d.ts'),
template: fs.readFileSync(pathResolve('./template/directives.d.ts'), 'utf-8'),
codeTemplates: [
{
key: '//code',
template: '{{name}}: typeof import("{{path}}")["default"];\n ',
},
],
name: 'V_{{name}}',
},
{
// auto import components
pattern: ['*.{vue,ts}', '**/index.{vue,ts}'],
dir: pathResolve('src/components'),
toFile: pathResolve('types/components.d.ts'),
template: fs.readFileSync(pathResolve('./template/components.d.ts'), 'utf-8'),
codeTemplates: [
{
key: '//code',
template: '{{name}}: typeof import("{{path}}")["default"];\n ',
},
{
key: '//typeCode',
template: 'type {{name}}Instance = InstanceType<typeof import("{{path}}")["default"]>;\n ',
},
],
name: '_{{name}}',
},
]);

export const resolver = resolverFn;
14 changes: 14 additions & 0 deletions plugins/autoImportApi.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import AutoImport from 'unplugin-auto-import/vite';
import { resolve } from 'path';
import { ElementPlusResolver } from 'unplugin-vue-components/resolvers';
function pathResolve(dir: string) {
return resolve(__dirname, '../', dir);
}
export default () =>
AutoImport({
// 自动加载API
imports: ['vue', 'vue-router', 'pinia', '@vueuse/core'],
// 可以选择auto-imports.d.ts生成的位置,使用ts建议设置为'src/auto-imports.d.ts'
dts: pathResolve('types/auto-imports.d.ts'),
resolvers: [ElementPlusResolver()],
});
25 changes: 25 additions & 0 deletions plugins/babel.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import { babel } from '@rollup/plugin-babel';
import { createRequire } from 'node:module';
export default () =>
babel({
babelrc: false,
extensions: ['.ts', '.tsx'],
plugins: [['@babel/plugin-transform-runtime', { useESModules: true }]],
presets: [
[
'@babel/preset-env',
{
targets: ['chrome 87', 'safari 13', 'firefox 78', 'edge 88'],
useBuiltIns: 'usage',
bugfixes: true,
loose: false,
modules: false,
corejs: createRequire(import.meta.url)('core-js/package.json').version,
shippedProposals: true,
ignoreBrowserslistConfig: true,
},
],
],
exclude: 'node_modules/**',
babelHelpers: 'runtime',
});
34 changes: 34 additions & 0 deletions plugins/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import { ConfigEnv } from 'vite';
import autoComponents from './autoComponents';
import autoImport from './autoImport';
import autoImportApi from './autoImportApi';
import babel from './babel';
import mock from './mock';
import svgLoader from './svgLoader';
import vueSetUpExtend from './vueSetUpExtend';
import { visualizer } from 'rollup-plugin-visualizer'; //打包大小分析(stats.html)
import vue from '@vitejs/plugin-vue';
// import VueI18nPlugin from '@intlify/unplugin-vue-i18n/vite';
import { splitVendorChunkPlugin } from 'vite';
import viteCompression from 'vite-plugin-compression'; //打包压缩

export default (configEnv: ConfigEnv) => {
return [
vue(),
splitVendorChunkPlugin(), //打包分析,会生成stats.html展示打包情况
// VueI18nPlugin({
// /* options */
// // locale messages resource pre-compile option
// include: ['./src/**/lang/**/*.json', './src/**/lang/*.json'],
// }),
visualizer(),
viteCompression(),
autoComponents(),
autoImport(),
autoImportApi(),
babel(),
mock(configEnv),
svgLoader(),
vueSetUpExtend(),
];
};
Loading

0 comments on commit a4d3d32

Please sign in to comment.