Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3,917 changes: 3,215 additions & 702 deletions pnpm-lock.yaml

Large diffs are not rendered by default.

3 changes: 0 additions & 3 deletions template/tinyvue/.eslintignore

This file was deleted.

85 changes: 0 additions & 85 deletions template/tinyvue/.eslintrc.cjs

This file was deleted.

7 changes: 0 additions & 7 deletions template/tinyvue/.prettierignore

This file was deleted.

10 changes: 0 additions & 10 deletions template/tinyvue/.prettierrc.js

This file was deleted.

2 changes: 1 addition & 1 deletion template/tinyvue/.stylelintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,4 @@ module.exports = {
},
],
},
};
}
99 changes: 99 additions & 0 deletions template/tinyvue/.vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
{
// Disable the default formatter, use eslint instead
"prettier.enable": false,
"editor.formatOnSave": false,

// Auto fix
"editor.codeActionsOnSave": {
"source.fixAll.eslint": "explicit",
"source.organizeImports": "never"
},

// Silent the stylistic rules in your IDE, but still auto fix them
"eslint.rules.customizations": [
{ "rule": "style/*", "severity": "off", "fixable": true },
{ "rule": "format/*", "severity": "off", "fixable": true },
{ "rule": "*-indent", "severity": "off", "fixable": true },
{ "rule": "*-spacing", "severity": "off", "fixable": true },
{ "rule": "*-spaces", "severity": "off", "fixable": true },
{ "rule": "*-order", "severity": "off", "fixable": true },
{ "rule": "*-dangle", "severity": "off", "fixable": true },
{ "rule": "*-newline", "severity": "off", "fixable": true },
{ "rule": "*quotes", "severity": "off", "fixable": true },
{ "rule": "*semi", "severity": "off", "fixable": true }
],

// Enable eslint for all supported languages
"eslint.validate": [
"javascript",
"javascriptreact",
"typescript",
"typescriptreact",
"vue",
"html",
"markdown",
"json",
"jsonc",
"yaml",
"toml",
"xml",
"gql",
"graphql",
"astro",
"svelte",
"css",
"less",
"scss",
"pcss",
"postcss"
],
// Disable the default formatter, use eslint instead
"prettier.enable": false,
"editor.formatOnSave": false,

// Auto fix
"editor.codeActionsOnSave": {
"source.fixAll.eslint": "explicit",
"source.organizeImports": "never"
},

// Silent the stylistic rules in your IDE, but still auto fix them
"eslint.rules.customizations": [
{ "rule": "style/*", "severity": "off", "fixable": true },
{ "rule": "format/*", "severity": "off", "fixable": true },
{ "rule": "*-indent", "severity": "off", "fixable": true },
{ "rule": "*-spacing", "severity": "off", "fixable": true },
{ "rule": "*-spaces", "severity": "off", "fixable": true },
{ "rule": "*-order", "severity": "off", "fixable": true },
{ "rule": "*-dangle", "severity": "off", "fixable": true },
{ "rule": "*-newline", "severity": "off", "fixable": true },
{ "rule": "*quotes", "severity": "off", "fixable": true },
{ "rule": "*semi", "severity": "off", "fixable": true }
],

// Enable eslint for all supported languages
"eslint.validate": [
"javascript",
"javascriptreact",
"typescript",
"typescriptreact",
"vue",
"html",
"markdown",
"json",
"json5",
"jsonc",
"yaml",
"toml",
"xml",
"gql",
"graphql",
"astro",
"svelte",
"css",
"less",
"scss",
"pcss",
"postcss"
]
}
9 changes: 5 additions & 4 deletions template/tinyvue/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,26 +10,27 @@

请选择任何一个你喜欢的包管理工具进行安装, 这里使用的`npm`

```
```bash
npm i
```

### 启动开发环境

```
```bash
npm run dev
```

### 启动mock服务

部分场景使用了mock数据, 所以请确保您启动了mock服务

```
```bash
npm run mock
```

## 目录结构

```
```bash
config # 打包工具配置文件
public
src
Expand Down
4 changes: 2 additions & 2 deletions template/tinyvue/babel.config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module.exports = {
plugins: [
'@vue/babel-plugin-jsx',
]
};
],
}
2 changes: 1 addition & 1 deletion template/tinyvue/commitlint.config.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module.exports = {
extends: ['@commitlint/config-conventional'],
};
}
18 changes: 9 additions & 9 deletions template/tinyvue/config/plugin/compress.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,22 @@
* gzip压缩
* https://github.com/anncwb/vite-plugin-compression
*/
import type { Plugin } from 'vite';
import compressPlugin from 'vite-plugin-compression';
import type { Plugin } from 'vite'
import compressPlugin from 'vite-plugin-compression'

export default function configCompressPlugin(
compress: 'gzip' | 'brotli',
deleteOriginFile = false
deleteOriginFile = false,
): Plugin | Plugin[] {
const plugins: Plugin[] = [];
const plugins: Plugin[] = []

if (compress === 'gzip') {
plugins.push(
compressPlugin({
ext: '.gz',
deleteOriginFile,
})
);
}),
)
}

if (compress === 'brotli') {
Expand All @@ -27,8 +27,8 @@ export default function configCompressPlugin(
ext: '.br',
algorithm: 'brotliCompress',
deleteOriginFile,
})
);
}),
)
}
return plugins;
return plugins
}
6 changes: 3 additions & 3 deletions template/tinyvue/config/plugin/imagemin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* 图片压缩
* https://github.com/anncwb/vite-plugin-imagemin
*/
import viteImagemin from 'vite-plugin-imagemin';
import viteImagemin from 'vite-plugin-imagemin'

export default function configImageminPlugin() {
const imageminPlugin = viteImagemin({
Expand Down Expand Up @@ -32,6 +32,6 @@ export default function configImageminPlugin() {
},
],
},
});
return imageminPlugin;
})
return imageminPlugin
}
8 changes: 4 additions & 4 deletions template/tinyvue/config/plugin/visualizer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
* Generation packaging analysis
* 生成打包分析
*/
import visualizer from 'rollup-plugin-visualizer';
import { isReportMode } from '../utils';
import visualizer from 'rollup-plugin-visualizer'
import { isReportMode } from '../utils'

export default function configVisualizerPlugin() {
if (isReportMode()) {
Expand All @@ -12,7 +12,7 @@ export default function configVisualizerPlugin() {
open: true,
gzipSize: true,
brotliSize: true,
});
})
}
return [];
return []
}
5 changes: 3 additions & 2 deletions template/tinyvue/config/utils/index.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import process from 'node:process'
/**
* Whether to generate package preview
* 是否生成打包报告
*/
export default {};
export default {}

export function isReportMode(): boolean {
return process.env.REPORT === 'true';
return process.env.REPORT === 'true'
}
21 changes: 10 additions & 11 deletions template/tinyvue/config/vite.config.base.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
import { resolve } from 'path';
import { defineConfig, loadEnv } from 'vite';
import vue from '@vitejs/plugin-vue';
import vueJsx from '@vitejs/plugin-vue-jsx';
import svgLoader from 'vite-svg-loader';
import eslint from 'vite-plugin-eslint';
import UnoCSS from 'unocss/vite';
import { resolve } from 'node:path'
import process from 'node:process'
import vue from '@vitejs/plugin-vue'
import vueJsx from '@vitejs/plugin-vue-jsx'
import UnoCSS from 'unocss/vite'
import { defineConfig, loadEnv } from 'vite'
import svgLoader from 'vite-svg-loader'

const config = {
plugins: [
vue(),
vueJsx(),
svgLoader({ svgoConfig: {} }),
eslint({ cache: false }), // 禁用缓存‌
UnoCSS(),
],
build: {
Expand Down Expand Up @@ -51,7 +50,7 @@ const config = {
preserveSymlinks: false,
},
define: {
'BUILD_TOOLS': "'VITE'",
BUILD_TOOLS: '\'VITE\'',
},
optimizeDeps: {
esbuildOptions: {
Expand All @@ -70,5 +69,5 @@ const config = {
},
},
},
};
export default defineConfig(config);
}
export default defineConfig(config)
Loading
Loading