Skip to content

Commit

Permalink
feat: 初始化项目
Browse files Browse the repository at this point in the history
  • Loading branch information
2214962083 committed Sep 9, 2022
0 parents commit 06f39d1
Show file tree
Hide file tree
Showing 35 changed files with 7,310 additions and 0 deletions.
9 changes: 9 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -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
16 changes: 16 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -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
76 changes: 76 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -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
}
})
17 changes: 17 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -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*
5 changes: 5 additions & 0 deletions .husky/commit-msg
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

# 要符合 angular commit 规范才给通过
# npx --no-install commitlint --edit "$1"
5 changes: 5 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

# 校验 git 缓存区的文件代码规范,并美化
npx --no-install lint-staged
5 changes: 5 additions & 0 deletions .husky/prepare-commit-msg
Original file line number Diff line number Diff line change
@@ -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"
2 changes: 2 additions & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
shamefully-hoist=true
strict-peer-dependencies=false
10 changes: 10 additions & 0 deletions .stylelintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
node_modules/
**/*.spec.*
es/
lib/
_site/
dist/
**/node_modules/*
**/segi-ant-theme.less
**/.rollup.cache/*
**/index.html
15 changes: 15 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -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"
]
}
114 changes: 114 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -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"
]
}
100 changes: 100 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
<p align='center'>
<img src='https://user-images.githubusercontent.com/11247099/154486817-f86b8f20-5463-4122-b6e9-930622e757f2.png' alt='Vitesse - Opinionated Vite Starter Template' width='600'/>
</p>

<p align='center'>
快速地<sup><em>Vitesse</em></sup> 创建 Web 应用
<br>
</p>

<br>

<p align='center'>
<a href="https://vitesse.netlify.app/">在线 Demo</a>
</p>

<br>

<br>

## 特性

- ⚡️ [Vue 3](https://github.com/vuejs/core), [Vite 2](https://github.com/vitejs/vite), [pnpm](https://pnpm.io/), [ESBuild](https://github.com/evanw/esbuild) - 就是快!

- 📦 [组件自动化加载](./src/components)

- 🍍 [使用 Pinia 的状态管理](https://pinia.esm.dev/)

- 🎨 [UnoCSS](https://github.com/unocss/unocss) - 高性能且极具灵活性的即时原子化 CSS 引擎

- 😃 [各种图标集为你所用](https://github.com/antfu/unocss/tree/main/packages/preset-icons)

- 🔥 使用 [新的 `<script setup>` 语法](https://github.com/vuejs/rfcs/pull/227)

- 🤙🏻 默认开启 [响应性语法糖](https://vuejs.org/guide/extras/reactivity-transform.html)

- 📥 [API 自动加载](https://github.com/antfu/unplugin-auto-import) - 直接使用 Composition API 无需引入

- 🦔 使用 [critters](https://github.com/GoogleChromeLabs/critters) 的生成关键 CSS

- 🦾 TypeScript, 当然

<br>

## 预配置

### UI 框架

- [UnoCSS](https://github.com/antfu/unocss) - 高性能且极具灵活性的即时原子化 CSS 引擎

### Icons

- [Iconify](https://iconify.design) - 使用任意的图标集,浏览:[🔍Icônes](https://icones.netlify.app/)
- [UnoCSS 的纯 CSS 图标方案](https://github.com/antfu/unocss/tree/main/packages/preset-icons)

### 插件

- [Vue Router](https://github.com/vuejs/vue-router)
- [Pinia](https://pinia.esm.dev) - 直接的, 类型安全的, 使用 Composition api 的轻便灵活的 Vue 状态管理
- [`unplugin-vue-components`](https://github.com/antfu/unplugin-vue-components) - 自动加载组件
- [`unplugin-auto-import`](https://github.com/antfu/unplugin-auto-import) - 直接使用 Composition API 等,无需导入
- [VueUse](https://github.com/antfu/vueuse) - 实用的 Composition API 工具合集
- [`@vueuse/head`](https://github.com/vueuse/head) - 响应式地操作文档头信息

### 编码风格

- 使用 Composition API 地 [`<script setup>` SFC 语法](https://github.com/vuejs/rfcs/pull/227)

### 开发工具

- [TypeScript](https://www.typescriptlang.org/)
- [pnpm](https://pnpm.js.org/) - 快, 节省磁盘空间的包管理器
- [critters](https://github.com/GoogleChromeLabs/critters) - 关键 CSS 生成器
- [VS Code 扩展](./.vscode/extensions.json)
- [Volar](https://marketplace.visualstudio.com/items?itemName=johnsoncodehk.volar) - Vue 3 `<script setup>` IDE 支持
- [Iconify IntelliSense](https://marketplace.visualstudio.com/items?itemName=antfu.iconify) - 图标内联显示和自动补全
- [ESLint](https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint)

## 现在可以试试!

> Vitesse 需要 Node >=14 && pnpm > 7.4
## 使用

### 开发

只需要执行以下命令就可以在 http://localhost:3333 中看到

```bash
pnpm dev
```

### 构建

构建该应用只需要执行以下命令

```bash
pnpm build
```

然后你会看到用于发布的 `dist` 文件夹被生成。
3 changes: 3 additions & 0 deletions commitlint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = {
extends: ['@commitlint/config-conventional']
}
Loading

0 comments on commit 06f39d1

Please sign in to comment.