Skip to content

Commit

Permalink
🎉 init
Browse files Browse the repository at this point in the history
  • Loading branch information
Eastboat committed May 10, 2024
0 parents commit a78ad37
Show file tree
Hide file tree
Showing 39 changed files with 6,390 additions and 0 deletions.
15 changes: 15 additions & 0 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/* eslint-env node */
require('@rushstack/eslint-patch/modern-module-resolution')

module.exports = {
root: true,
'extends': [
'plugin:vue/vue3-essential',
'eslint:recommended',
'@vue/eslint-config-typescript',
'@vue/eslint-config-prettier/skip-formatting'
],
parserOptions: {
ecmaVersion: 'latest'
}
}
30 changes: 30 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*

node_modules
.DS_Store
dist
dist-ssr
coverage
*.local

/cypress/videos/
/cypress/screenshots/

# Editor directories and files
.vscode/*
!.vscode/extensions.json
.idea
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?

*.tsbuildinfo
8 changes: 8 additions & 0 deletions .prettierrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"$schema": "https://json.schemastore.org/prettierrc",
"semi": false,
"tabWidth": 2,
"singleQuote": true,
"printWidth": 100,
"trailingComma": "none"
}
7 changes: 7 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"recommendations": [
"Vue.volar",
"dbaeumer.vscode-eslint",
"esbenp.prettier-vscode"
]
}
39 changes: 39 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# zijin-market-ui

This template should help get you started developing with Vue 3 in Vite.

## Recommended IDE Setup

[VSCode](https://code.visualstudio.com/) + [Volar](https://marketplace.visualstudio.com/items?itemName=Vue.volar) (and disable Vetur).

## Type Support for `.vue` Imports in TS

TypeScript cannot handle type information for `.vue` imports by default, so we replace the `tsc` CLI with `vue-tsc` for type checking. In editors, we need [Volar](https://marketplace.visualstudio.com/items?itemName=Vue.volar) to make the TypeScript language service aware of `.vue` types.

## Customize configuration

See [Vite Configuration Reference](https://vitejs.dev/config/).

## Project Setup

```sh
pnpm install
```

### Compile and Hot-Reload for Development

```sh
pnpm dev
```

### Type-Check, Compile and Minify for Production

```sh
pnpm build
```

### Lint with [ESLint](https://eslint.org/)

```sh
pnpm lint
```
42 changes: 42 additions & 0 deletions build/vite/auto-import-plguin.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
/*
* @Description: 自动/按需导入
* @Author: eastboat
* @Date: 2024-05-09 11:28:34
* @LastEditors: eastboat
* @LastEditTime: 2024-05-09 15:51:10
*/
import Components from 'unplugin-vue-components/vite'
import { VantResolver } from '@vant/auto-import-resolver'
import AutoImport from 'unplugin-auto-import/vite'
import { VueRouterAutoImports } from 'unplugin-vue-router'

export const autoImportPlugin = () => {
return [
// https://github.com/antfu/unplugin-vue-components
Components({
extensions: ['vue'], // 组件的有效文件扩展名
resolvers: [VantResolver()], // 自定义组件的解析器
include: [/\.vue$/, /\.vue\?vue/],
dts: 'src/components.d.ts' // 生成 `components.d.ts` 全局声明,
}),
// https://github.com/antfu/unplugin-auto-import
AutoImport({
include: [/\.[tj]sx?$/, /\.vue$/, /\.vue\?vue/],
imports: [
'vue', // 表示将 Vue 中的常用 API(如 ref、reactive 等)自动导入。
'pinia',
// 'vitest',
// '@vueuse/core',
VueRouterAutoImports,
{
'vue-router/auto': ['useLink'] // 从 vue-router/auto 中自动导入 useLink 函数。
// '@/utils/i18n': ['i18n', 'locale'],
// 'vue-i18n': ['useI18n']
}
// unheadVueComposablesImports
],
dts: 'src/auto-imports.d.ts',
dirs: ['src/composables'] // 指定在 src/composables 文件夹中自动导入可复用的组合式 API。
})
]
}
3 changes: 3 additions & 0 deletions build/vite/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export * from './auto-import-plguin'
export * from './router-plugin'
export * from './style-plguin'
8 changes: 8 additions & 0 deletions build/vite/router-plugin.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/*
* @Description: 处理路由相关的差距
* @Author: eastboat
* @Date: 2024-05-09 11:39:13
* @LastEditors: eastboat
* @LastEditTime: 2024-05-09 13:37:17
*/
export const routerPlugin = () => {}
13 changes: 13 additions & 0 deletions build/vite/style-plguin.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
/*
* @Description: 原子化、css等处理插件
* @Author: eastboat
* @Date: 2024-05-09 11:29:40
* @LastEditors: eastboat
* @LastEditTime: 2024-05-09 17:03:58
*/

import UnoCSS from 'unocss/vite'

export const stylePlugin = () => {
return [UnoCSS()]
}
1 change: 1 addition & 0 deletions env.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/// <reference types="vite/client" />
22 changes: 22 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" href="/favicon.ico" />
<meta
name="viewport"
content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, viewport-fit=cover, user-scalable=no"
/>
<!-- 开启顶部安全区适配 -->
<van-nav-bar safe-area-inset-top />

<!-- 开启底部安全区适配 -->
<van-number-keyboard safe-area-inset-bottom />

<title>zijin-market-ui</title>
</head>
<body>
<div id="app"></div>
<script type="module" src="/src/main.ts"></script>
</body>
</html>
57 changes: 57 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
{
"name": "zijin-market-ui",
"version": "0.0.0",
"private": true,
"type": "module",
"scripts": {
"dev": "vite --host",
"build": "run-p type-check \"build-only {@}\" --",
"preview": "vite preview",
"build-only": "vite build",
"type-check": "vue-tsc --build --force",
"lint": "eslint . --ext .vue,.js,.jsx,.cjs,.mjs,.ts,.tsx,.cts,.mts --fix --ignore-path .gitignore",
"format": "prettier --write src/"
},
"dependencies": {
"@unocss/reset": "^0.60.0",
"pinia": "^2.1.7",
"vant": "^4.9.0",
"vue": "^3.4.21",
"vue-router": "^4.3.0"
},
"devDependencies": {
"@iconify-json/ant-design": "^1.1.16",
"@rushstack/eslint-patch": "^1.8.0",
"@tsconfig/node20": "^20.1.4",
"@types/node": "^20.12.5",
"@unocss/preset-icons": "^0.60.0",
"@unocss/preset-mini": "^0.60.0",
"@unocss/preset-rem-to-px": "^0.59.4",
"@vant/auto-import-resolver": "^1.1.0",
"@vitejs/plugin-legacy": "^5.4.0",
"@vitejs/plugin-vue": "^5.0.4",
"@vitejs/plugin-vue-jsx": "^3.1.0",
"@vue/eslint-config-prettier": "^9.0.0",
"@vue/eslint-config-typescript": "^13.0.0",
"@vue/tsconfig": "^0.5.1",
"autoprefixer": "^10.4.19",
"cnjm-postcss-px-to-viewport": "^1.0.1",
"eslint": "^8.57.0",
"eslint-plugin-vue": "^9.23.0",
"normalize.css": "link:@unocss/reset/normalize.css",
"npm-run-all2": "^6.1.2",
"postcss": "^8.4.38",
"postcss-mobile-forever": "^4.1.3",
"prettier": "^3.2.5",
"sass": "^1.77.0",
"ts-node": "^10.9.2",
"typescript": "~5.4.0",
"unocss": "^0.60.0",
"unplugin-auto-import": "^0.17.5",
"unplugin-vue-components": "^0.27.0",
"unplugin-vue-router": "^0.8.6",
"vite": "^5.2.8",
"vite-plugin-vue-devtools": "^7.0.25",
"vue-tsc": "^2.0.11"
}
}
Loading

0 comments on commit a78ad37

Please sign in to comment.