Pre Merge pull request !250 from Baboon/dev

This commit is contained in:
Baboon 2024-12-22 05:04:46 +00:00 committed by Gitee
commit 552bdd233d
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
23 changed files with 2180 additions and 3482 deletions

View File

@ -1,3 +0,0 @@
module.exports = {
extends: ["@commitlint/config-conventional"]
};

7
.editorconfig Normal file
View File

@ -0,0 +1,7 @@
[*.{js,jsx,mjs,cjs,ts,tsx,mts,cts,vue}]
charset = utf-8
indent_size = 2
indent_style = space
insert_final_newline = true
end_of_line = true
trim_trailing_whitespace = true

View File

@ -1,11 +0,0 @@
node_modules/
public/
es/
lib/
dist/
package.json
src/assets/
plop-templates/
handlebars/
website/
build/

View File

@ -1,30 +0,0 @@
module.exports = {
root: true,
parser: 'vue-eslint-parser',
globals: {
postMessage: true
},
parserOptions: {
parser: '@typescript-eslint/parser',
sourceType: 'module',
ecmaFeatures: {
jsx: true,
tsx: true
}
},
env: {
node: true,
// The Follow config only works with eslint-plugin-vue v8.0.0+
'vue/setup-compiler-macros': true
},
extends: ['plugin:vue/vue3-essential', 'eslint:recommended'],
rules: {
'no-console': process.env.NODE_ENV === 'production' ? 'warn' : 'off',
'no-debugger': process.env.NODE_ENV === 'production' ? 'warn' : 'off',
'no-unused-vars': 'off',
'vue/no-unused-vars': 'off',
'vue/multi-word-component-names': 'off',
'vue/valid-template-root': 'off',
'vue/no-mutating-props': 'off'
}
}

2
.gitignore vendored
View File

@ -3,5 +3,5 @@ node_modules
dist
dist-ssr
*.local
.vscode
# .vscode
.idea

View File

@ -1,4 +1 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"
npx --no-install commitlint -e
node scripts/verify-commit.js

1
.husky/pre-commit Normal file
View File

@ -0,0 +1 @@
pnpm exec lint-staged

7
.lintstagedrc.mjs Normal file
View File

@ -0,0 +1,7 @@
export default {
'*.{js,jsx,ts,tsx,mjs,cjs,mts,cts,mtsx,ctsx,vue}': ['eslint --fix'],
'*.{js,jsx,ts,tsx,mjs,cjs,mts,cts,mtsx,ctsx}': ['prettier --write'],
'*.{vue,html}': ['prettier --write'],
'*.{json,md,mdx,yaml}': ['prettier --write'],
'*.{css,less,sass,scss}': ['prettier --write']
}

1
.node-version Normal file
View File

@ -0,0 +1 @@
v22

8
.prettierignore Normal file
View File

@ -0,0 +1,8 @@
auto-imports.d.ts
components.d.ts
pnpm-lock.yaml
dist
/node_modules/*
.workflow
src/packages/components/Charts/Maps/MapBase/mapGeojson/*.json
store-template

7
.vscode/extensions.json vendored Normal file
View File

@ -0,0 +1,7 @@
{
"recommendations": [
"Vue.volar",
"dbaeumer.vscode-eslint",
"esbenp.prettier-vscode"
]
}

10
.vscode/settings.json vendored Normal file
View File

@ -0,0 +1,10 @@
{
"editor.codeActionsOnSave": {
// Wiating Fix all Code to enable
// "source.fixAll": "explicit"
},
// Wiating format all Code to enable
// "editor.formatOnSave": true,
"editor.defaultFormatter": "esbenp.prettier-vscode",
"typescript.tsdk": "node_modules/typescript/lib"
}

65
eslint.config.js Normal file
View File

@ -0,0 +1,65 @@
import pluginVue from 'eslint-plugin-vue'
import vueTsEslintConfig from '@vue/eslint-config-typescript'
import skipFormatting from '@vue/eslint-config-prettier/skip-formatting'
export default [
{
name: 'app/files-to-lint',
files: ['**/*.{ts,mts,tsx,vue}']
},
{
name: 'app/files-to-ignore',
ignores: [
'**/dist/**',
'**/dist-ssr/**',
'**/coverage/**',
'node_modules/',
'public/',
'es/',
'lib/',
'dist/',
'package.json',
'src/assets/',
'plop-templates/',
'handlebars/',
'website/',
'build/'
]
},
...pluginVue.configs['flat/essential'],
...vueTsEslintConfig(),
skipFormatting,
{
languageOptions: {
parserOptions: {
parser: '@typescript-eslint/parser'
}
},
rules: {
'no-console': process.env.NODE_ENV === 'production' ? 'warn' : 'off',
'no-debugger': process.env.NODE_ENV === 'production' ? 'warn' : 'off',
'no-unused-vars': 'off',
'vue/no-unused-vars': 'off',
'vue/multi-word-component-names': 'off',
'vue/valid-template-root': 'off',
'vue/no-mutating-props': 'off',
// TODO: 下面的规则后续放开,然后自动修复
'no-var': 'off',
'prefer-const': 'off',
'vue/no-ref-as-operand': 'off',
'vue/block-lang': 'off',
'vue/no-dupe-keys': 'off',
'@typescript-eslint/no-wrapper-object-types': 'off',
'@typescript-eslint/no-unnecessary-type-constraint': 'off',
'@typescript-eslint/no-empty-object-type': 'off',
'@typescript-eslint/no-unsafe-function-type': 'off',
'@typescript-eslint/no-unused-vars': 'off',
'@typescript-eslint/no-duplicate-enum-values': 'off',
'@typescript-eslint/ban-ts-comment': 'off',
'@typescript-eslint/no-unused-expressions': 'off',
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/consistent-type-imports': 'error'
}
}
]

View File

@ -4,29 +4,33 @@
"engines": {
"node": ">=16.14 <18.0.0"
},
"type": "module",
"packageManager": "pnpm@8.15.9",
"scripts": {
"prepare": "husky",
"dev": "vite --host",
"build": "vue-tsc --noEmit && vite build",
"build": "run-p type-check \"build-only {@}\" --",
"preview": "vite preview",
"new": "plop --plopfile ./plop/plopfile.js",
"postinstall": "husky install",
"lint": "eslint --ext .js,.jsx,.ts,.tsx,.vue src",
"lint:fix": "eslint --ext .js,.jsx,.ts,.tsx,.vue src --fix"
"build-only": "vite build",
"type-check": "vue-tsc --build --force",
"lint": "eslint .",
"lint:fix": "eslint . --fix",
"format": "prettier --write ."
},
"dependencies": {
"@amap/amap-jsapi-loader": "^1.0.1",
"@amap/amap-jsapi-types": "^0.0.8",
"@iconify/json": "^2.2.158",
"@types/color": "^3.0.3",
"@types/crypto-js": "^4.1.1",
"@types/keymaster": "^1.6.30",
"@types/lodash": "^4.14.184",
"@vicons/carbon": "^0.12.0",
"@vicons/ionicons5": "~0.11.0",
"@vueuse/core": "^7.7.1",
"animate.css": "^4.1.1",
"axios": "^1.4.0",
"color": "^4.2.3",
"crypto-js": "^4.1.1",
"dayjs": "^1.11.7",
"dom-helpers": "^5.2.1",
"echarts": "^5.3.2",
"echarts-liquidfill": "^3.1.0",
"echarts-stat": "^1.2.0",
"echarts-wordcloud": "^2.0.0",
@ -35,14 +39,15 @@
"html2canvas": "^1.4.1",
"iconify-icon": "^1.0.8",
"keymaster": "^1.6.2",
"lodash": "~4.17.21",
"mitt": "^3.0.0",
"monaco-editor": "^0.33.0",
"naive-ui": "2.34.3",
"pinia": "^2.0.13",
"screenfull": "^6.0.1",
"three": "^0.145.0",
"vue": "^3.2.31",
"vue-demi": "^0.13.1",
"vue": "3.5.13",
"vue-echarts": "^6.0.2",
"vue-i18n": "9.2.2",
"vue-router": "4.0.12",
"vue3-lazyload": "^0.2.5-beta",
@ -50,40 +55,32 @@
"vuedraggable": "^4.1.0"
},
"devDependencies": {
"@commitlint/cli": "^17.0.2",
"@commitlint/config-conventional": "^17.0.2",
"@types/node": "^16.11.26",
"@tsconfig/node22": "22.0.0",
"@types/color": "^3.0.3",
"@types/crypto-js": "^4.1.1",
"@types/keymaster": "^1.6.30",
"@types/lodash": "^4.14.184",
"@types/node": "22.9.0",
"@types/three": "^0.144.0",
"@typescript-eslint/eslint-plugin": "^5.18.0",
"@typescript-eslint/parser": "^5.18.0",
"@vicons/carbon": "^0.12.0",
"@vicons/ionicons5": "~0.11.0",
"@vitejs/plugin-vue": "^4.2.3",
"@vitejs/plugin-vue-jsx": "^3.0.1",
"@vue/compiler-sfc": "^3.2.31",
"@vueuse/core": "^7.7.1",
"commitlint": "^17.0.2",
"default-passive-events": "^2.0.0",
"echarts": "^5.3.2",
"eslint": "^8.12.0",
"eslint-config-prettier": "^8.5.0",
"eslint-plugin-import": "^2.26.0",
"eslint-plugin-prettier": "^4.0.0",
"eslint-plugin-vue": "^8.5.0",
"husky": "^8.0.1",
"lodash": "~4.17.21",
"mockjs": "^1.1.0",
"plop": "^3.0.5",
"prettier": "^2.6.2",
"sass": "^1.49.11",
"sass-loader": "^12.6.0",
"typescript": "4.6.3",
"vite": "4.3.6",
"vite-plugin-compression": "^0.5.1",
"vite-plugin-importer": "^0.2.5",
"vite-plugin-mock": "^2.9.6",
"@vitejs/plugin-vue": "5.2.0",
"@vitejs/plugin-vue-jsx": "4.1.0",
"@vue/eslint-config-prettier": "10.1.0",
"@vue/eslint-config-typescript": "14.1.3",
"@vue/tsconfig": "0.6.0",
"eslint": "9.15.0",
"eslint-plugin-vue": "9.31.0",
"husky": "9.1.7",
"lint-staged": "15.2.10",
"npm-run-all2": "7.0.1",
"picocolors": "1.1.1",
"plop": "4.0.1",
"prettier": "3.3.3",
"sass-embedded": "1.81.0",
"typescript": "5.6.3",
"vite": "5.4.11",
"vite-plugin-compression2": "1.3.1",
"vite-plugin-mock": "3.0.2",
"vite-plugin-monaco-editor": "^1.1.0",
"vue-echarts": "^6.0.2",
"vue-tsc": "^0.28.10"
"vue-tsc": "2.1.10"
}
}

View File

@ -1,5 +1,6 @@
const storeGenerator = require('./store-template/prompt')
// @ts-check
import storeGenerator from './store-template/prompt.js'
module.exports = (plop) => {
export default plop => {
plop.setGenerator('store', storeGenerator)
}

View File

@ -1,4 +1,4 @@
module.exports = {
export default {
description: 'create a store',
prompts: [
{

5289
pnpm-lock.yaml generated

File diff suppressed because it is too large Load Diff

View File

@ -1,12 +1,12 @@
module.exports = {
export default {
printWidth: 120,
tabWidth: 2,
useTabs: false,
singleQuote: true,
semi: false,
trailingComma: "none",
trailingComma: 'none',
bracketSpacing: true,
jsxSingleQuote: true,
jsxBracketSameLine: false,
arrowParens: "avoid"
}
arrowParens: 'avoid'
}

22
scripts/verify-commit.js Normal file
View File

@ -0,0 +1,22 @@
// @ts-check
import pico from 'picocolors'
import { readFileSync } from 'node:fs'
import path from 'node:path'
const msgPath = path.resolve('.git/COMMIT_EDITMSG')
const msg = readFileSync(msgPath, 'utf-8').trim()
const commitRE =
/^(revert: )?(feat|fix|docs|dx|style|refactor|perf|test|workflow|build|ci|chore|types|wip|release)(\(.+\))?: .{1,50}/
if (!commitRE.test(msg)) {
console.log()
console.error(
` ${pico.white(pico.bgRed(' ERROR '))} ${pico.red(`invalid commit message format.`)}\n\n` +
pico.red(` Proper commit message format is required for automated changelog generation. Examples:\n\n`) +
` ${pico.green(`feat(compiler): add 'comments' option`)}\n` +
` ${pico.green(`fix(v-model): handle events on blur (close #28)`)}\n\n` +
pico.red(` See .github/commit-convention.md for more details.\n`)
)
process.exit(1)
}

16
tsconfig.app.json Normal file
View File

@ -0,0 +1,16 @@
{
"extends": "@vue/tsconfig/tsconfig.dom.json",
"include": ["env.d.ts", "src/**/*", "src/**/*.vue", "types/**/*"],
"exclude": ["src/**/__tests__/*"],
"compilerOptions": {
"composite": true,
"tsBuildInfoFile": "./node_modules/.tmp/tsconfig.app.tsbuildinfo",
"baseUrl": ".",
"paths": {
"@/*": ["./src/*"]
},
// TODO: waiting fix @typescript-eslint/consistent-type-imports
"verbatimModuleSyntax": false
}
}

View File

@ -1,25 +1,11 @@
{
"compilerOptions": {
"target": "esnext",
"module": "esnext",
"moduleResolution": "node",
"strict": true,
"jsx": "preserve",
"baseUrl": ".",
"sourceMap": true,
"resolveJsonModule": true,
"esModuleInterop": true,
"skipLibCheck": true,
"lib": ["es6", "ESNext", "dom"],
"types": ["vite/client"],
"paths": {
"@/*": ["src/*"],
"/#/*": ["types/*"]
"files": [],
"references": [
{
"path": "./tsconfig.node.json"
},
"noImplicitAny": true, //使any
// "strictNullChecks": true, //使null
"noImplicitThis": true //this
},
"include": ["src/**/*.ts", "src/**/*.d.ts", "src/**/*.tsx", "src/**/*.vue", "types/**/*"],
"exclude": ["node_modules", "dist", "**/*.js"]
{
"path": "./tsconfig.app.json"
}
]
}

13
tsconfig.node.json Normal file
View File

@ -0,0 +1,13 @@
{
"extends": "@tsconfig/node22/tsconfig.json",
"include": ["vite.config.*", "vitest.config.*", "cypress.config.*", "nightwatch.conf.*", "playwright.config.*"],
"compilerOptions": {
"composite": true,
"noEmit": true,
"tsBuildInfoFile": "./node_modules/.tmp/tsconfig.node.tsbuildinfo",
"module": "ESNext",
"moduleResolution": "Bundler",
"types": ["node"]
}
}

View File

@ -2,33 +2,22 @@ import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import { resolve } from 'path'
import { OUTPUT_DIR, brotliSize, chunkSizeWarningLimit, terserOptions, rollupOptions } from './build/constant'
import viteCompression from 'vite-plugin-compression'
import { compression } from 'vite-plugin-compression2'
import { viteMockServe } from 'vite-plugin-mock'
import monacoEditorPlugin from 'vite-plugin-monaco-editor'
import { fileURLToPath } from 'url'
function pathResolve(dir: string) {
return resolve(process.cwd(), '.', dir)
}
export default defineConfig({
base: '/',
base: process.env.NODE_ENV === 'production' ? './' : '/',
// 路径重定向
resolve: {
alias: [
{
find: /\/#\//,
replacement: pathResolve('types')
},
{
find: '@',
replacement: pathResolve('src')
},
{
find: 'vue-i18n',
replacement: 'vue-i18n/dist/vue-i18n.cjs.js' //解决i8n警告
}
],
dedupe: ['vue']
alias: {
'@': fileURLToPath(new URL('./src', import.meta.url))
}
},
// 全局 css 注册
css: {
@ -48,7 +37,9 @@ export default defineConfig({
}
}
}),
monacoEditorPlugin({
// monacoEditorPlugin Not is ES Module
// @ts-expect-error
monacoEditorPlugin.default({
languageWorkers: ['editorWorkerService', 'typescript', 'json', 'html']
}),
viteMockServe({
@ -63,13 +54,7 @@ export default defineConfig({
watchFiles: true
}),
// 压缩
viteCompression({
verbose: true,
disable: false,
threshold: 10240,
algorithm: 'gzip',
ext: '.gz'
})
compression({})
],
build: {
target: 'es2015',