forked from xiangshu233/vue3-vant4-mobile
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f70d451
commit 5ab8472
Showing
134 changed files
with
12,509 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
# 官网是这么介绍 EditorConfig 的: | ||
# EditorConfig帮助开发人员在不同的编辑器和IDE之间定义和维护一致的编码样式。 | ||
# EditorConfig 项目由用于定义编码样式的文件格式和一组文本编辑器插件组成,这些插件使编辑器能够读取文件格式并遵循定义的样式。 | ||
# EditorConfig 文件易于阅读,并且与版本控制系统配合使用。 | ||
# 不同的开发人员,不同的编辑器,有不同的编码风格,而 EditorConfig 就是用来协同团队开发人员之间的代码的风格及样式规范化的一个工具, | ||
# 而.editorconfig正是它的默认配置文件 | ||
|
||
#EditorConfig 的匹配规则是从上往下,即先定义的规则优先级比后定义的优先级要高。 | ||
|
||
# 告诉 EditorConfig 插件,这是根文件,不用继续往上查找 | ||
root = true | ||
|
||
# 匹配全部文件 | ||
[*] | ||
|
||
# 设置字符集 | ||
charset=utf-8 | ||
|
||
# 结尾换行符,可选"lf"、"cr"、"crlf" | ||
end_of_line=LF | ||
|
||
# 在文件结尾插入新行 | ||
insert_final_newline=true | ||
|
||
# 缩进风格,可选"space"、"tab" | ||
indent_style=space | ||
|
||
# 缩进的空格数 | ||
indent_size=2 | ||
|
||
max_line_length = 100 | ||
|
||
# 匹配 yml 和 yaml、json 结尾的文件 | ||
[*.{yml,yaml,json}] | ||
indent_style = space | ||
indent_size = 2 | ||
|
||
[*.md] | ||
# 删除一行中的前后空格 | ||
trim_trailing_whitespace = false | ||
|
||
[Makefile] | ||
indent_style = tab |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# port | ||
VITE_PORT = 8000 | ||
|
||
# spa-title | ||
VITE_GLOB_APP_TITLE = Vue3VantMobile | ||
|
||
# 系统中文名称 | ||
VITE_GLOB_APP_TITLE_CN = vue3-vant-mobile | ||
|
||
# spa shortname 不可出现空格等特殊字符 | ||
VITE_GLOB_APP_SHORT_NAME = VantMobile | ||
|
||
# 生产环境 开启mock | ||
VITE_GLOB_PROD_MOCK = true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
# 只在开发模式中被载入 | ||
VITE_PORT = 9999 | ||
|
||
# 网站根目录 | ||
VITE_PUBLIC_PATH = / | ||
|
||
# 是否开启mock | ||
VITE_USE_MOCK = true | ||
|
||
# 是否删除console | ||
VITE_DROP_CONSOLE = true | ||
|
||
# 跨域代理,可以配置多个,请注意不要换行 | ||
# VITE_PROXY = [["/appApi","http://localhost:8001"],["/upload","http://localhost:8001/upload"]] | ||
# VITE_PROXY=[["/api","https://naive-ui-admin"]] | ||
|
||
# API 接口地址 | ||
# 如果没有跨域问题,直接在这里配置即可 | ||
VITE_GLOB_API_URL = | ||
|
||
# 图片上传地址 | ||
VITE_GLOB_UPLOAD_URL = | ||
|
||
# 图片前缀地址 | ||
VITE_GLOB_IMG_URL = | ||
|
||
# 接口前缀 | ||
VITE_GLOB_API_URL_PREFIX = /api | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# 是否开启mock | ||
VITE_USE_MOCK = true | ||
|
||
# 网站根目录 | ||
VITE_PUBLIC_PATH = / | ||
|
||
# 是否删除console | ||
VITE_DROP_CONSOLE = true | ||
|
||
# API | ||
VITE_GLOB_API_URL = | ||
|
||
# 图片上传地址 | ||
VITE_GLOB_UPLOAD_URL = | ||
|
||
# 图片前缀地址 | ||
VITE_GLOB_IMG_URL = | ||
|
||
# 接口 (api) 前缀 | ||
VITE_GLOB_API_URL_PREFIX = /api | ||
|
||
# 是否启用gzip压缩或brotli压缩 | ||
# 可选: gzip | brotli | none | ||
# 如果你需要多种形式,你可以用','来分隔 | ||
VITE_BUILD_COMPRESS = 'none' | ||
|
||
# 使用压缩时是否删除原始文件,默认为false | ||
VITE_BUILD_COMPRESS_DELETE_ORIGIN_FILE = false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
*.sh | ||
node_modules | ||
*.md | ||
*.woff | ||
*.ttf | ||
.vscode | ||
.idea | ||
dist | ||
/public | ||
/docs | ||
.husky | ||
.local | ||
/bin | ||
Dockerfile | ||
components.d.ts | ||
components.d.ts |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
// @ts-check | ||
const { defineConfig } = require('eslint-define-config'); | ||
module.exports = defineConfig({ | ||
root: true, | ||
env: { | ||
browser: true, | ||
node: true, | ||
es6: true, | ||
}, | ||
parser: 'vue-eslint-parser', | ||
parserOptions: { | ||
parser: '@typescript-eslint/parser', | ||
ecmaVersion: 2020, | ||
sourceType: 'module', | ||
jsxPragma: 'React', | ||
ecmaFeatures: { | ||
jsx: true, | ||
}, | ||
}, | ||
extends: [ | ||
'plugin:vue/vue3-recommended', | ||
'plugin:@typescript-eslint/recommended', | ||
'prettier', | ||
'plugin:prettier/recommended', | ||
], | ||
rules: { | ||
'vue/script-setup-uses-vars': 'error', | ||
'@typescript-eslint/ban-ts-ignore': 'off', | ||
'@typescript-eslint/explicit-function-return-type': 'off', | ||
'@typescript-eslint/no-explicit-any': 'off', | ||
'@typescript-eslint/no-var-requires': 'off', | ||
'@typescript-eslint/no-empty-function': 'off', | ||
'vue/custom-event-name-casing': 'off', | ||
'no-use-before-define': 'off', | ||
'@typescript-eslint/no-use-before-define': 'off', | ||
'@typescript-eslint/ban-ts-comment': 'off', | ||
'@typescript-eslint/ban-types': 'off', | ||
'@typescript-eslint/no-non-null-assertion': 'off', | ||
'@typescript-eslint/explicit-module-boundary-types': 'off', | ||
'@typescript-eslint/no-unused-vars': [ | ||
'error', | ||
{ | ||
argsIgnorePattern: '^_', | ||
varsIgnorePattern: '^_', | ||
}, | ||
], | ||
'no-unused-vars': [ | ||
'error', | ||
{ | ||
argsIgnorePattern: '^_', | ||
varsIgnorePattern: '^_', | ||
}, | ||
], | ||
'space-before-function-paren': 'off', | ||
|
||
'vue/attributes-order': 'off', | ||
'vue/one-component-per-file': 'off', | ||
'vue/html-closing-bracket-newline': 'off', | ||
'vue/max-attributes-per-line': 'off', | ||
'vue/multiline-html-element-content-newline': 'off', | ||
'vue/singleline-html-element-content-newline': 'off', | ||
'vue/attribute-hyphenation': 'off', | ||
'vue/require-default-prop': 'off', | ||
'vue/multi-word-component-names': 'off', | ||
'vue/html-self-closing': [ | ||
'error', | ||
{ | ||
html: { | ||
void: 'always', | ||
normal: 'never', | ||
component: 'always', | ||
}, | ||
svg: 'always', | ||
math: 'always', | ||
}, | ||
], | ||
}, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
# Logs | ||
logs | ||
*.log | ||
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* | ||
pnpm-debug.log* | ||
lerna-debug.log* | ||
|
||
node_modules | ||
/dist | ||
dist-ssr | ||
*.local | ||
|
||
# Editor directories and files | ||
.vscode/* | ||
!.vscode/extensions.json | ||
.idea | ||
.DS_Store | ||
*.suo | ||
*.ntvs* | ||
*.njsproj | ||
*.sln | ||
*.sw? | ||
/components.d.ts | ||
/components.d.ts |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
/dist/* | ||
.local | ||
.output.js | ||
/node_modules/** | ||
|
||
**/*.svg | ||
**/*.sh | ||
|
||
/public/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
/dist/* | ||
/public/* | ||
public/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,20 @@ | ||
# vue3-vant4-mobile | ||
vue3.2 + vite + vant4 + pinia + ts 移动端 h5 模板 | ||
文档完善中... | ||
# vue3-ts | ||
|
||
## Project setup | ||
``` | ||
pnpm install | ||
``` | ||
|
||
### Compiles and hot-reloads for development | ||
``` | ||
pnpm dev | ||
``` | ||
|
||
### Compiles and minifies for production | ||
``` | ||
pnpm build | ||
``` | ||
|
||
|
||
### Customize configuration | ||
See [Configuration Reference](https://vitejs.cn/guide/features.html). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
/** | ||
* The name of the configuration file entered in the production environment | ||
*/ | ||
export const GLOB_CONFIG_FILE_NAME = 'app.config.js'; | ||
|
||
export const OUTPUT_DIR = 'dist/vant-mobile'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
/** | ||
* Get the configuration file variable name | ||
* @param env | ||
*/ | ||
export const getConfigFileName = (env: Record<string, any>) => { | ||
return `__PRODUCTION__${env.VITE_GLOB_APP_SHORT_NAME || '__APP'}__CONF__` | ||
.toUpperCase() | ||
.replace(/\s/g, ''); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
/** | ||
* Generate additional configuration files when used for packaging. The file can be configured with some global variables, so that it can be changed directly externally without repackaging | ||
*/ | ||
import { GLOB_CONFIG_FILE_NAME, OUTPUT_DIR } from '../constant'; | ||
import fs, { writeFileSync } from 'fs-extra'; | ||
import colors from 'picocolors'; | ||
|
||
import { getRootPath, getEnvConfig } from '../utils'; | ||
import { getConfigFileName } from '../getConfigFileName'; | ||
|
||
import pkg from '../../package.json'; | ||
|
||
function createConfig( | ||
{ | ||
configName, | ||
config, | ||
configFileName = GLOB_CONFIG_FILE_NAME, | ||
}: { configName: string; config: any; configFileName?: string } = { configName: '', config: {} } | ||
) { | ||
try { | ||
const windowConf = `window.${configName}`; | ||
// Ensure that the variable will not be modified | ||
const configStr = `${windowConf}=${JSON.stringify(config)}; | ||
Object.freeze(${windowConf}); | ||
Object.defineProperty(window, "${configName}", { | ||
configurable: false, | ||
writable: false, | ||
}); | ||
`.replace(/\s/g, ''); | ||
fs.mkdirp(getRootPath(OUTPUT_DIR)); | ||
writeFileSync(getRootPath(`${OUTPUT_DIR}/${configFileName}`), configStr); | ||
|
||
console.log(colors.cyan(`✨ [${pkg.name}]`) + ` - configuration file is build successfully:`); | ||
console.log(colors.gray(OUTPUT_DIR + '/' + colors.green(configFileName)) + '\n'); | ||
} catch (error) { | ||
console.log(colors.red('configuration file configuration file failed to package:\n' + error)); | ||
} | ||
} | ||
|
||
export function runBuildConfig() { | ||
const config = getEnvConfig(); | ||
const configFileName = getConfigFileName(config); | ||
createConfig({ config, configName: configFileName }); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
// #!/usr/bin/env node | ||
|
||
import { runBuildConfig } from './buildConf'; | ||
import colors from 'picocolors'; | ||
|
||
import pkg from '../../package.json'; | ||
|
||
export const runBuild = async () => { | ||
try { | ||
const argvList = process.argv.splice(2); | ||
|
||
// Generate configuration file | ||
if (!argvList.includes('disabled-config')) { | ||
await runBuildConfig(); | ||
} | ||
|
||
console.log(`✨ ${colors.cyan(`[${pkg.name}]`)}` + ' - build successfully!'); | ||
} catch (error) { | ||
console.log(colors.red('vite build error:\n' + error)); | ||
process.exit(1); | ||
} | ||
}; | ||
runBuild(); |
Oops, something went wrong.