From 06f39d141004a1d0b1a125ad598298baf15ffee8 Mon Sep 17 00:00:00 2001 From: yangjinming <2214962083@qq.com> Date: Fri, 9 Sep 2022 11:44:00 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=88=9D=E5=A7=8B=E5=8C=96=E9=A1=B9?= =?UTF-8?q?=E7=9B=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .editorconfig | 9 + .eslintignore | 16 + .eslintrc.js | 76 + .gitignore | 17 + .husky/commit-msg | 5 + .husky/pre-commit | 5 + .husky/prepare-commit-msg | 5 + .npmrc | 2 + .stylelintignore | 10 + .vscode/extensions.json | 15 + .vscode/settings.json | 114 + README.md | 100 + commitlint.config.js | 3 + index.html | 30 + lint-staged.config.js | 7 + package.json | 88 + pnpm-lock.yaml | 5691 +++++++++++++++++++++++++++ prettier.config.js | 14 + scripts/utils.js | 29 + scripts/vite-plugin-env/index.ts | 89 + scripts/vite-plugin-env/load-env.ts | 100 + src/App.vue | 33 + src/main.ts | 23 + src/styles/main.css | 36 + src/styles/tailwind-reset.css | 354 ++ src/utils/common.ts | 91 + src/utils/config.ts | 26 + src/utils/device-utils.ts | 54 + stylelint.config.js | 73 + tsconfig.json | 34 + types/global.d.ts | 5 + types/module.d.ts | 30 + types/router.d.ts | 46 + unocss.config.ts | 31 + vite.config.ts | 49 + 35 files changed, 7310 insertions(+) create mode 100644 .editorconfig create mode 100644 .eslintignore create mode 100644 .eslintrc.js create mode 100644 .gitignore create mode 100644 .husky/commit-msg create mode 100644 .husky/pre-commit create mode 100644 .husky/prepare-commit-msg create mode 100644 .npmrc create mode 100644 .stylelintignore create mode 100644 .vscode/extensions.json create mode 100644 .vscode/settings.json create mode 100644 README.md create mode 100644 commitlint.config.js create mode 100644 index.html create mode 100644 lint-staged.config.js create mode 100644 package.json create mode 100644 pnpm-lock.yaml create mode 100644 prettier.config.js create mode 100644 scripts/utils.js create mode 100644 scripts/vite-plugin-env/index.ts create mode 100644 scripts/vite-plugin-env/load-env.ts create mode 100644 src/App.vue create mode 100644 src/main.ts create mode 100644 src/styles/main.css create mode 100644 src/styles/tailwind-reset.css create mode 100644 src/utils/common.ts create mode 100644 src/utils/config.ts create mode 100644 src/utils/device-utils.ts create mode 100644 stylelint.config.js create mode 100644 tsconfig.json create mode 100644 types/global.d.ts create mode 100644 types/module.d.ts create mode 100644 types/router.d.ts create mode 100644 unocss.config.ts create mode 100644 vite.config.ts diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..9d08a1a --- /dev/null +++ b/.editorconfig @@ -0,0 +1,9 @@ +root = true + +[*] +charset = utf-8 +indent_style = space +indent_size = 2 +end_of_line = lf +insert_final_newline = true +trim_trailing_whitespace = true diff --git a/.eslintignore b/.eslintignore new file mode 100644 index 0000000..6411771 --- /dev/null +++ b/.eslintignore @@ -0,0 +1,16 @@ +**/node_modules/ +*.html +es/ +**/lib/ +**/dist/ +**/lib-types/ +_site/ +**/dist/ +CHANGELOG.md +.rollup.cache +tsconfig.tsbuildinfo +!.storybook +!.vuepress +types/components.d.ts +types/auto-imports.d.ts +*.generated.ts diff --git a/.eslintrc.js b/.eslintrc.js new file mode 100644 index 0000000..edb4417 --- /dev/null +++ b/.eslintrc.js @@ -0,0 +1,76 @@ +//@ts-check + +module.exports = /** @type { import('eslint').Linter.Config } */ ({ + root: true, + + env: { + browser: true, + node: true, + es6: true + }, + + parser: 'vue-eslint-parser', + + parserOptions: { + parser: '@typescript-eslint/parser', + ecmaversion: 2022, + sourceType: 'module', + ecmaFeatures: { + jsx: true + } + }, + + extends: [ + 'eslint:recommended', + 'plugin:import/recommended', + 'plugin:import/typescript', + 'plugin:@typescript-eslint/eslint-recommended', + 'plugin:@typescript-eslint/recommended', + 'plugin:vue/recommended', + 'plugin:prettier/recommended', + 'prettier' + ], + + rules: { + 'import/no-unresolved': 'off', + 'no-unused-vars': 'off', + 'no-console': process.env.NODE_ENV === 'production' ? 'error' : 'off', + 'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off', + // vue + 'vue/no-v-html': 'off', + 'vue/singleline-html-element-content-newline': 'off', + 'vue/html-self-closing': 'off', + 'vue/max-attributes-per-line': [ + 'error', + { + singleline: 10, + multiline: 1 + } + ], + 'vue/require-default-prop': 'off', + 'vue/html-closing-bracket-spacing': 'error', + 'vue/no-unused-vars': 'warn', + 'vue/multi-word-component-names': 'off', + 'vue/one-component-per-file': 'off', + 'vue/no-v-model-argument': 'off', + 'vue/comment-directive': [ + 'warn', + { + reportUnusedDisableDirectives: false + } + ], + '@typescript-eslint/ban-types': 'off', + '@typescript-eslint/no-this-alias': 'off', + '@typescript-eslint/triple-slash-reference': 'off', + '@typescript-eslint/no-var-requires': 'off', + '@typescript-eslint/explicit-module-boundary-types': 'off', + '@typescript-eslint/no-non-null-assertion': 'off', + '@typescript-eslint/no-unused-vars': ['warn', {argsIgnorePattern: '^h$', varsIgnorePattern: '^emits$|^props$'}], + 'mdx/no-unused-expressions': 'off', + 'no-undef': 'off' + }, + + globals: { + h: true + } +}) diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..0596a66 --- /dev/null +++ b/.gitignore @@ -0,0 +1,17 @@ +.DS_Store +.vite-ssg-dist +.vite-ssg-temp +*.local +dist +dist-ssr +node_modules +.idea/ +*.log +stats.html +hcs-h5-ts.zip + +# Log files +npm-debug.log* +yarn-debug.log* +yarn-error.log* +.pnpm-debug.log* diff --git a/.husky/commit-msg b/.husky/commit-msg new file mode 100644 index 0000000..01360f5 --- /dev/null +++ b/.husky/commit-msg @@ -0,0 +1,5 @@ +#!/bin/sh +. "$(dirname "$0")/_/husky.sh" + +# 要符合 angular commit 规范才给通过 +# npx --no-install commitlint --edit "$1" diff --git a/.husky/pre-commit b/.husky/pre-commit new file mode 100644 index 0000000..9f1bd06 --- /dev/null +++ b/.husky/pre-commit @@ -0,0 +1,5 @@ +#!/bin/sh +. "$(dirname "$0")/_/husky.sh" + +# 校验 git 缓存区的文件代码规范,并美化 +npx --no-install lint-staged diff --git a/.husky/prepare-commit-msg b/.husky/prepare-commit-msg new file mode 100644 index 0000000..5fdd786 --- /dev/null +++ b/.husky/prepare-commit-msg @@ -0,0 +1,5 @@ +#!/bin/sh +. "$(dirname "$0")/_/husky.sh" + +echo "请不要直接执行 git commit ,改成 npm run commit" +echo "commit 填写规范查看 https://juejin.cn/post/6934292467160514567#heading-3" diff --git a/.npmrc b/.npmrc new file mode 100644 index 0000000..cf04042 --- /dev/null +++ b/.npmrc @@ -0,0 +1,2 @@ +shamefully-hoist=true +strict-peer-dependencies=false diff --git a/.stylelintignore b/.stylelintignore new file mode 100644 index 0000000..db1b980 --- /dev/null +++ b/.stylelintignore @@ -0,0 +1,10 @@ +node_modules/ +**/*.spec.* +es/ +lib/ +_site/ +dist/ +**/node_modules/* +**/segi-ant-theme.less +**/.rollup.cache/* +**/index.html diff --git a/.vscode/extensions.json b/.vscode/extensions.json new file mode 100644 index 0000000..e72abcb --- /dev/null +++ b/.vscode/extensions.json @@ -0,0 +1,15 @@ +{ + "recommendations": [ + "antfu.iconify", + "antfu.unocss", + "antfu.goto-alias", + "csstools.postcss", + "dbaeumer.vscode-eslint", + "esbenp.prettier-vscode", + "mrmlnc.vscode-less", + "mikestead.dotenv", + "stylelint.vscode-stylelint", + "vue.volar", + "streetsidesoftware.code-spell-checker" + ] +} diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..8d4234d --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,114 @@ +{ + // Use PNPM + "npm.packageManager": "pnpm", + // "eslint.packageManager": "pnpm", + "typescript.tsdk": "./node_modules/typescript/lib", + "editor.tabSize": 2, + + "stylelint.enable": true, + "stylelint.validate": ["css", "less", "postcss", "scss", "vue", "sass"], + "prettier.enable": false, + "editor.codeActionsOnSave": { + "source.fixAll.eslint": true, + "source.fixAll.stylelint": true + }, + + "files.associations": { + "*.css": "postcss" + }, + + "typescript.inlayHints.parameterNames.enabled": "all", + // "typescript.inlayHints.variableTypes.enabled": true, + // "typescript.inlayHints.propertyDeclarationTypes.enabled": true, + "typescript.inlayHints.parameterTypes.enabled": true, + // "typescript.inlayHints.functionLikeReturnTypes.enabled": true, + "scss.lint.unknownAtRules": "ignore", + "less.lint.unknownAtRules": "ignore", + "css.lint.unknownAtRules": "ignore", + + "workbench.colorCustomizations": { + "activityBar.background": "#252F38", + "titleBar.activeBackground": "#34414F", + "titleBar.activeForeground": "#F9FAFB" + }, + "cSpell.words": [ + "alais", + "antfu", + "apartuser", + "APPKEY", + "appr", + "Attributify", + "authc", + "axios", + "bonuse", + "busi", + "Cascader", + "Certi", + "commitlint", + "cparagraph", + "csentence", + "cust", + "cword", + "datacachesvr", + "Datetime", + "demi", + "DOWNFILE", + "Dtos", + "ecmaversion", + "editble", + "esno", + "Filterbar", + "globby", + "iconify", + "INDIV", + "innercheckinmember", + "Inspction", + "intlify", + "Jssdk", + "jweixin", + "Lazyload", + "micromessenger", + "mockjs", + "nouce", + "nprogress", + "oper", + "Pagelist", + "pinia", + "pnpm", + "poppable", + "preinstall", + "qrcode", + "redrun", + "restapi", + "Segi", + "semibold", + "Sname", + "stylelint", + "tabbar", + "testop", + "typecheck", + "uhome", + "uhomecp", + "unocss", + "unplugin", + "unref", + "userinfo", + "Vant", + "vconsole", + "Vite", + "vitejs", + "Vitesse", + "vitest", + "vpay", + "vueuse", + "wcpay", + "Wechat", + "Weixin", + "wxappid", + "XFQYGM", + "XFQYXZ", + "zhong", + "ZLZYLX", + "ZZMM" + ] +} diff --git a/README.md b/README.md new file mode 100644 index 0000000..9a420b2 --- /dev/null +++ b/README.md @@ -0,0 +1,100 @@ +
+
+
+快速地Vitesse 创建 Web 应用
+
+
+在线 Demo +
+ +