Skip to content

Commit 3993300

Browse files
authored
feat: basic framework by Arco Pro (#2)
1 parent b7d7552 commit 3993300

File tree

126 files changed

+24615
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

126 files changed

+24615
-0
lines changed

.env.development

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
VITE_API_BASE_URL= 'http://localhost:8080'

.env.production

Whitespace-only changes.

.eslintignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
/*.json
2+
/*.js
3+
dist

.eslintrc.js

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
// eslint-disable-next-line @typescript-eslint/no-var-requires
2+
const path = require('path');
3+
4+
module.exports = {
5+
root: true,
6+
parser: 'vue-eslint-parser',
7+
parserOptions: {
8+
// Parser that checks the content of the <script> tag
9+
parser: '@typescript-eslint/parser',
10+
sourceType: 'module',
11+
ecmaVersion: 2020,
12+
ecmaFeatures: {
13+
jsx: true,
14+
},
15+
},
16+
env: {
17+
'browser': true,
18+
'node': true,
19+
'vue/setup-compiler-macros': true,
20+
},
21+
plugins: ['@typescript-eslint'],
22+
extends: [
23+
// Airbnb JavaScript Style Guide https://github.com/airbnb/javascript
24+
'airbnb-base',
25+
'plugin:@typescript-eslint/recommended',
26+
'plugin:import/recommended',
27+
'plugin:import/typescript',
28+
'plugin:vue/vue3-recommended',
29+
'plugin:prettier/recommended',
30+
],
31+
settings: {
32+
'import/resolver': {
33+
typescript: {
34+
project: path.resolve(__dirname, './tsconfig.json'),
35+
},
36+
},
37+
},
38+
rules: {
39+
'prettier/prettier': 1,
40+
// Vue: Recommended rules to be closed or modify
41+
'vue/require-default-prop': 0,
42+
'vue/singleline-html-element-content-newline': 0,
43+
'vue/max-attributes-per-line': 0,
44+
// Vue: Add extra rules
45+
'vue/custom-event-name-casing': [2, 'camelCase'],
46+
'vue/no-v-text': 1,
47+
'vue/padding-line-between-blocks': 1,
48+
'vue/require-direct-export': 1,
49+
'vue/multi-word-component-names': 0,
50+
// Allow @ts-ignore comment
51+
'@typescript-eslint/ban-ts-comment': 0,
52+
'@typescript-eslint/no-unused-vars': 1,
53+
'@typescript-eslint/no-empty-function': 1,
54+
'@typescript-eslint/no-explicit-any': 0,
55+
'import/extensions': [
56+
2,
57+
'ignorePackages',
58+
{
59+
js: 'never',
60+
jsx: 'never',
61+
ts: 'never',
62+
tsx: 'never',
63+
},
64+
],
65+
'no-debugger': process.env.NODE_ENV === 'production' ? 2 : 0,
66+
'no-param-reassign': 0,
67+
'prefer-regex-literals': 0,
68+
'import/no-extraneous-dependencies': 0,
69+
},
70+
};

.gitignore

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
node_modules
2+
.DS_Store
3+
dist
4+
dist-ssr
5+
*.local
6+
node_modules
7+
.DS_Store
8+
dist
9+
dist-ssr
10+
*.local

.husky/commit-msg

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/bin/sh
2+
. "$(dirname "$0")/_/husky.sh"
3+
4+
yarn commitlint --edit $1

.husky/pre-commit

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/bin/sh
2+
. "$(dirname "$0")/_/husky.sh"
3+
4+
npm run lint-staged

.prettierignore

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
/dist/*
2+
.local
3+
.output.js
4+
/node_modules/**
5+
6+
**/*.svg
7+
**/*.sh

.prettierrc.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
module.exports = {
2+
tabWidth: 2,
3+
semi: true,
4+
printWidth: 80,
5+
singleQuote: true,
6+
quoteProps: 'consistent',
7+
htmlWhitespaceSensitivity: 'strict',
8+
vueIndentScriptAndStyle: true,
9+
};

.stylelintrc.js

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
module.exports = {
2+
extends: [
3+
'stylelint-config-standard',
4+
'stylelint-config-rational-order',
5+
'stylelint-config-prettier',
6+
],
7+
defaultSeverity: 'warning',
8+
plugins: ['stylelint-order'],
9+
rules: {
10+
'at-rule-no-unknown': [
11+
true,
12+
{
13+
ignoreAtRules: ['plugin'],
14+
},
15+
],
16+
'rule-empty-line-before': [
17+
'always',
18+
{
19+
except: ['after-single-line-comment', 'first-nested'],
20+
},
21+
],
22+
'selector-pseudo-class-no-unknown': [
23+
true,
24+
{
25+
ignorePseudoClasses: ['deep'],
26+
},
27+
],
28+
},
29+
};

babel.config.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
module.exports = {
2+
plugins: ['@vue/babel-plugin-jsx'],
3+
};

commitlint.config.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
module.exports = {
2+
extends: ['@commitlint/config-conventional'],
3+
};

components.d.ts

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
// generated by unplugin-vue-components
2+
// We suggest you to commit this file into source control
3+
// Read more: https://github.com/vuejs/vue-next/pull/3399
4+
import '@vue/runtime-core';
5+
6+
declare module '@vue/runtime-core' {
7+
export interface GlobalComponents {
8+
AAffix: typeof import('@arco-design/web-vue')['Affix'];
9+
AAlert: typeof import('@arco-design/web-vue')['Alert'];
10+
AAvatar: typeof import('@arco-design/web-vue')['Avatar'];
11+
ABadge: typeof import('@arco-design/web-vue')['Badge'];
12+
ABreadcrumb: typeof import('@arco-design/web-vue')['Breadcrumb'];
13+
ABreadcrumbItem: typeof import('@arco-design/web-vue')['BreadcrumbItem'];
14+
AButton: typeof import('@arco-design/web-vue')['Button'];
15+
ACard: typeof import('@arco-design/web-vue')['Card'];
16+
ACarousel: typeof import('@arco-design/web-vue')['Carousel'];
17+
ACarouselItem: typeof import('@arco-design/web-vue')['CarouselItem'];
18+
ACheckbox: typeof import('@arco-design/web-vue')['Checkbox'];
19+
ACol: typeof import('@arco-design/web-vue')['Col'];
20+
AConfigProvider: typeof import('@arco-design/web-vue')['ConfigProvider'];
21+
ADivider: typeof import('@arco-design/web-vue')['Divider'];
22+
ADoption: typeof import('@arco-design/web-vue')['Doption'];
23+
ADrawer: typeof import('@arco-design/web-vue')['Drawer'];
24+
ADropdown: typeof import('@arco-design/web-vue')['Dropdown'];
25+
AForm: typeof import('@arco-design/web-vue')['Form'];
26+
AFormItem: typeof import('@arco-design/web-vue')['FormItem'];
27+
AGrid: typeof import('@arco-design/web-vue')['Grid'];
28+
AGridItem: typeof import('@arco-design/web-vue')['GridItem'];
29+
AInput: typeof import('@arco-design/web-vue')['Input'];
30+
AInputNumber: typeof import('@arco-design/web-vue')['InputNumber'];
31+
AInputPassword: typeof import('@arco-design/web-vue')['InputPassword'];
32+
ALayout: typeof import('@arco-design/web-vue')['Layout'];
33+
ALayoutContent: typeof import('@arco-design/web-vue')['LayoutContent'];
34+
ALayoutFooter: typeof import('@arco-design/web-vue')['LayoutFooter'];
35+
ALayoutSider: typeof import('@arco-design/web-vue')['LayoutSider'];
36+
ALink: typeof import('@arco-design/web-vue')['Link'];
37+
AList: typeof import('@arco-design/web-vue')['List'];
38+
AListItem: typeof import('@arco-design/web-vue')['ListItem'];
39+
AListItemMeta: typeof import('@arco-design/web-vue')['ListItemMeta'];
40+
AMenu: typeof import('@arco-design/web-vue')['Menu'];
41+
AMenuItem: typeof import('@arco-design/web-vue')['MenuItem'];
42+
APopover: typeof import('@arco-design/web-vue')['Popover'];
43+
ARadio: typeof import('@arco-design/web-vue')['Radio'];
44+
ARadioGroup: typeof import('@arco-design/web-vue')['RadioGroup'];
45+
AResult: typeof import('@arco-design/web-vue')['Result'];
46+
ARow: typeof import('@arco-design/web-vue')['Row'];
47+
ASpace: typeof import('@arco-design/web-vue')['Space'];
48+
ASpin: typeof import('@arco-design/web-vue')['Spin'];
49+
AStatistic: typeof import('@arco-design/web-vue')['Statistic'];
50+
ASubMenu: typeof import('@arco-design/web-vue')['SubMenu'];
51+
ASwitch: typeof import('@arco-design/web-vue')['Switch'];
52+
ATable: typeof import('@arco-design/web-vue')['Table'];
53+
ATableColumn: typeof import('@arco-design/web-vue')['TableColumn'];
54+
ATabPane: typeof import('@arco-design/web-vue')['TabPane'];
55+
ATabs: typeof import('@arco-design/web-vue')['Tabs'];
56+
ATag: typeof import('@arco-design/web-vue')['Tag'];
57+
ATooltip: typeof import('@arco-design/web-vue')['Tooltip'];
58+
ATypographyParagraph: typeof import('@arco-design/web-vue')['TypographyParagraph'];
59+
ATypographyText: typeof import('@arco-design/web-vue')['TypographyText'];
60+
ATypographyTitle: typeof import('@arco-design/web-vue')['TypographyTitle'];
61+
RouterLink: typeof import('vue-router')['RouterLink'];
62+
RouterView: typeof import('vue-router')['RouterView'];
63+
}
64+
}
65+
66+
export {};

config/plugin/arcoResolver.ts

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
/* eslint-disable import/no-unresolved */
2+
/**
3+
* If you use the template method for development, you can use the unplugin-vue-components plugin to enable on-demand loading support.
4+
* 按需引入
5+
* https://github.com/antfu/unplugin-vue-components
6+
* https://arco.design/vue/docs/start
7+
* Although the Pro project is full of imported components, this plugin will be used by default.
8+
* 虽然Pro项目中是全量引入组件,但此插件会默认使用。
9+
*/
10+
import Components from 'unplugin-vue-components/vite';
11+
import { ArcoResolver } from 'unplugin-vue-components/resolvers';
12+
13+
export default function configArcoResolverPlugin() {
14+
const arcoResolverPlugin = Components({
15+
dirs: [], // Avoid parsing src/components. 避免解析到src/components
16+
deep: false,
17+
resolvers: [ArcoResolver()],
18+
});
19+
return arcoResolverPlugin;
20+
}

config/plugin/compress.ts

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
/**
2+
* Used to package and output gzip. Note that this does not work properly in Vite, the specific reason is still being investigated
3+
* gzip压缩
4+
* https://github.com/anncwb/vite-plugin-compression
5+
*/
6+
import type { Plugin } from 'vite';
7+
import compressPlugin from 'vite-plugin-compression';
8+
9+
export default function configCompressPlugin(
10+
compress: 'gzip' | 'brotli',
11+
deleteOriginFile = false
12+
): Plugin | Plugin[] {
13+
const plugins: Plugin[] = [];
14+
15+
if (compress === 'gzip') {
16+
plugins.push(
17+
compressPlugin({
18+
ext: '.gz',
19+
deleteOriginFile,
20+
})
21+
);
22+
}
23+
24+
if (compress === 'brotli') {
25+
plugins.push(
26+
compressPlugin({
27+
ext: '.br',
28+
algorithm: 'brotliCompress',
29+
deleteOriginFile,
30+
})
31+
);
32+
}
33+
return plugins;
34+
}

config/plugin/imagemin.ts

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
/**
2+
* Image resource files used to compress the output of the production environment
3+
* 图片压缩
4+
* https://github.com/anncwb/vite-plugin-imagemin
5+
*/
6+
import viteImagemin from 'vite-plugin-imagemin';
7+
8+
export default function configImageminPlugin() {
9+
const imageminPlugin = viteImagemin({
10+
gifsicle: {
11+
optimizationLevel: 7,
12+
interlaced: false,
13+
},
14+
optipng: {
15+
optimizationLevel: 7,
16+
},
17+
mozjpeg: {
18+
quality: 20,
19+
},
20+
pngquant: {
21+
quality: [0.8, 0.9],
22+
speed: 4,
23+
},
24+
svgo: {
25+
plugins: [
26+
{
27+
name: 'removeViewBox',
28+
},
29+
{
30+
name: 'removeEmptyAttrs',
31+
active: false,
32+
},
33+
],
34+
},
35+
});
36+
return imageminPlugin;
37+
}

0 commit comments

Comments
 (0)