wanzhuang-cli 1.0.6 → 1.0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +0 -10
- package/dist/commands/create.js +50 -37
- package/dist/utils/template.js +6 -0
- package/package.json +1 -1
- package/templates/uniapp/.commitlintrc.cjs +106 -0
- package/templates/uniapp/.editorconfig +13 -0
- package/templates/uniapp/.eslintignore +1 -0
- package/templates/uniapp/.eslintrc-auto-import.json +101 -0
- package/templates/uniapp/.eslintrc.cjs +97 -0
- package/templates/uniapp/.prettierignore +9 -0
- package/templates/uniapp/.prettierrc.cjs +19 -0
- package/templates/uniapp/.stylelintignore +1 -0
- package/templates/uniapp/.stylelintrc.cjs +58 -0
- package/templates/uniapp/.vscode/extensions.json +17 -0
- package/templates/uniapp/.vscode/settings.json +65 -0
- package/templates/uniapp/.vscode/vue3.code-snippets +56 -0
- package/templates/uniapp/LICENSE +21 -0
- package/templates/uniapp/README.md +78 -0
- package/templates/uniapp/env/.env +15 -0
- package/templates/uniapp/env/.env.development +6 -0
- package/templates/uniapp/env/.env.production +6 -0
- package/templates/uniapp/env/.env.test +4 -0
- package/templates/uniapp/favicon.ico +0 -0
- package/templates/uniapp/index.html +13 -7
- package/templates/uniapp/manifest.config.ts +134 -0
- package/templates/uniapp/package.json +119 -31
- package/templates/uniapp/pages.config.ts +43 -0
- package/templates/uniapp/scripts/postupgrade.js +36 -0
- package/templates/uniapp/src/App.vue +58 -17
- package/templates/uniapp/src/components/.gitkeep +0 -0
- package/templates/uniapp/src/env.d.ts +31 -0
- package/templates/uniapp/src/hooks/.gitkeep +0 -0
- package/templates/uniapp/src/hooks/useRequest.ts +44 -0
- package/templates/uniapp/src/hooks/useUpload.ts +67 -0
- package/templates/uniapp/src/interceptors/index.ts +3 -0
- package/templates/uniapp/src/interceptors/prototype.ts +13 -0
- package/templates/uniapp/src/interceptors/request.ts +67 -0
- package/templates/uniapp/src/interceptors/route.ts +53 -0
- package/templates/uniapp/src/layouts/default.vue +17 -0
- package/templates/uniapp/src/layouts/demo.vue +17 -0
- package/templates/uniapp/src/main.ts +17 -0
- package/templates/uniapp/src/manifest.json +112 -67
- package/templates/uniapp/src/pages/about/about.vue +30 -0
- package/templates/uniapp/src/pages/about/components/request.vue +21 -0
- package/templates/uniapp/src/pages/index/index.vue +53 -48
- package/templates/uniapp/src/pages-sub/demo/index.vue +20 -0
- package/templates/uniapp/src/pages.json +58 -16
- package/templates/uniapp/src/service/index/foo.ts +15 -0
- package/templates/uniapp/src/static/app/icons/1024x1024.png +0 -0
- package/templates/uniapp/src/static/app/icons/120x120.png +0 -0
- package/templates/uniapp/src/static/app/icons/144x144.png +0 -0
- package/templates/uniapp/src/static/app/icons/152x152.png +0 -0
- package/templates/uniapp/src/static/app/icons/167x167.png +0 -0
- package/templates/uniapp/src/static/app/icons/180x180.png +0 -0
- package/templates/uniapp/src/static/app/icons/192x192.png +0 -0
- package/templates/uniapp/src/static/app/icons/20x20.png +0 -0
- package/templates/uniapp/src/static/app/icons/29x29.png +0 -0
- package/templates/uniapp/src/static/app/icons/40x40.png +0 -0
- package/templates/uniapp/src/static/app/icons/58x58.png +0 -0
- package/templates/uniapp/src/static/app/icons/60x60.png +0 -0
- package/templates/uniapp/src/static/app/icons/72x72.png +0 -0
- package/templates/uniapp/src/static/app/icons/76x76.png +0 -0
- package/templates/uniapp/src/static/app/icons/80x80.png +0 -0
- package/templates/uniapp/src/static/app/icons/87x87.png +0 -0
- package/templates/uniapp/src/static/app/icons/96x96.png +0 -0
- package/templates/uniapp/src/static/images/.gitkeep +0 -0
- package/templates/uniapp/src/static/logo.svg +33 -0
- package/templates/uniapp/src/static/tabbar/example.png +0 -0
- package/templates/uniapp/src/static/tabbar/exampleHL.png +0 -0
- package/templates/uniapp/src/static/tabbar/home.png +0 -0
- package/templates/uniapp/src/static/tabbar/homeHL.png +0 -0
- package/templates/uniapp/src/static/tabbar/personal.png +0 -0
- package/templates/uniapp/src/static/tabbar/personalHL.png +0 -0
- package/templates/uniapp/src/store/index.ts +17 -0
- package/templates/uniapp/src/store/user.ts +35 -0
- package/templates/uniapp/src/style/iconfont.css +28 -0
- package/templates/uniapp/src/style/index.scss +18 -0
- package/templates/uniapp/src/types/auto-import.d.ts +187 -0
- package/templates/uniapp/src/types/global.d.ts +16 -0
- package/templates/uniapp/src/types/shims-uni.d.ts +8 -0
- package/templates/uniapp/src/types/uni-pages.d.ts +23 -0
- package/templates/uniapp/src/typings.ts +29 -0
- package/templates/uniapp/src/uni.scss +77 -76
- package/templates/uniapp/src/uni_modules/.gitkeep +0 -0
- package/templates/uniapp/src/utils/http.ts +80 -0
- package/templates/uniapp/src/utils/index.ts +113 -0
- package/templates/uniapp/src/utils/platform.ts +17 -0
- package/templates/uniapp/tsconfig.json +34 -0
- package/templates/uniapp/uno.config.ts +89 -0
- package/templates/uniapp/vite.config.ts +158 -0
- package/templates/uniapp/shims-uni.d.ts +0 -10
- package/templates/uniapp/src/main.js +0 -10
- package/templates/uniapp/src/shime-uni.d.ts +0 -6
- package/templates/uniapp/src/static/logo.png +0 -0
- package/templates/uniapp/vite.config.js +0 -8
package/README.md
CHANGED
|
@@ -80,21 +80,11 @@ wz update
|
|
|
80
80
|
|
|
81
81
|
### UniApp 模板
|
|
82
82
|
|
|
83
|
-
跨平台开发框架,支持编译到多端:
|
|
84
|
-
|
|
85
83
|
| 技术栈 | 版本 |
|
|
86
84
|
| ------ | ------- |
|
|
87
85
|
| Vue | ^3.4.21 |
|
|
88
86
|
| Vite | 5.2.8 |
|
|
89
87
|
|
|
90
|
-
支持平台:
|
|
91
|
-
|
|
92
|
-
| 平台 | 命令 |
|
|
93
|
-
| ------------ | -------------------- |
|
|
94
|
-
| H5 | `pnpm dev:h5` |
|
|
95
|
-
| 微信小程序 | `pnpm dev:mp-weixin` |
|
|
96
|
-
| 支付宝小程序 | `pnpm dev:mp-alipay` |
|
|
97
|
-
|
|
98
88
|
## 命令一览
|
|
99
89
|
|
|
100
90
|
| 命令 | 说明 | 选项 |
|
package/dist/commands/create.js
CHANGED
|
@@ -102,32 +102,42 @@ async function createProject(projectName, options) {
|
|
|
102
102
|
]);
|
|
103
103
|
template = answer.template;
|
|
104
104
|
}
|
|
105
|
-
// 4.
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
105
|
+
// 4. 交互多选功能(uniapp 模板已内置所有功能,跳过选择)
|
|
106
|
+
let features = [];
|
|
107
|
+
if (template === 'uniapp') {
|
|
108
|
+
// unibest 模板已内置 TypeScript、Prettier、ESLint、UnoCSS
|
|
109
|
+
features = ['typescript', 'prettier', 'eslint', 'unocss'];
|
|
110
|
+
console.log(chalk_1.default.cyan('unibest 模板已内置:'), 'TypeScript, Prettier, ESLint, UnoCSS');
|
|
111
|
+
}
|
|
112
|
+
else {
|
|
113
|
+
const answer = await inquirer_1.default.prompt([
|
|
114
|
+
{
|
|
115
|
+
name: 'features',
|
|
116
|
+
type: 'checkbox',
|
|
117
|
+
message: '请选择要包含的功能:',
|
|
118
|
+
choices: [
|
|
119
|
+
{ name: 'TypeScript', value: 'typescript' },
|
|
120
|
+
{ name: 'Prettier', value: 'prettier' },
|
|
121
|
+
{ name: 'ESLint', value: 'eslint' },
|
|
122
|
+
{ name: 'UnoCSS', value: 'unocss' },
|
|
123
|
+
{ name: 'Tailwind CSS', value: 'tailwindcss' },
|
|
124
|
+
],
|
|
125
|
+
},
|
|
126
|
+
]);
|
|
127
|
+
features = answer.features;
|
|
128
|
+
console.log(chalk_1.default.cyan('已选择功能:'), features);
|
|
129
|
+
}
|
|
121
130
|
// 5. 复制模板到目标目录
|
|
122
131
|
await (0, template_1.copyTemplate)(template, targetDir);
|
|
123
|
-
// 6. 类型/文件自动转换(React: jsx->tsx,Vue
|
|
132
|
+
// 6. 类型/文件自动转换(React: jsx->tsx,Vue: js->ts + vue lang="ts")
|
|
133
|
+
// unibest 模板已经是 TypeScript 项目,跳过转换
|
|
124
134
|
const srcDir = (0, path_1.join)(targetDir, 'src');
|
|
125
|
-
if (features.includes('typescript')) {
|
|
135
|
+
if (features.includes('typescript') && template !== 'uniapp') {
|
|
126
136
|
if (template === 'react' && (0, fs_1.existsSync)(srcDir)) {
|
|
127
137
|
(0, fileOps_1.convertExtRecursive)(srcDir, '.jsx', '.tsx');
|
|
128
138
|
(0, fileOps_1.replaceImportExtRecursive)(srcDir, '.jsx', '.tsx');
|
|
129
139
|
}
|
|
130
|
-
if (
|
|
140
|
+
if (template === 'vue' && (0, fs_1.existsSync)(srcDir)) {
|
|
131
141
|
(0, fileOps_1.convertExtRecursive)(srcDir, '.js', '.ts');
|
|
132
142
|
(0, fileOps_1.replaceImportExtRecursive)(srcDir, '.js', '.ts');
|
|
133
143
|
(0, fileOps_1.addLangTsToAllVue)(srcDir);
|
|
@@ -136,18 +146,22 @@ async function createProject(projectName, options) {
|
|
|
136
146
|
(0, fileOps_1.convertViteConfigToTs)(targetDir);
|
|
137
147
|
(0, configGen_1.genTsConfig)(targetDir, template);
|
|
138
148
|
}
|
|
139
|
-
// 7.
|
|
140
|
-
if (
|
|
141
|
-
(
|
|
142
|
-
|
|
143
|
-
(
|
|
144
|
-
|
|
145
|
-
(
|
|
146
|
-
|
|
147
|
-
(
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
149
|
+
// 7. 配置文件自动生成(unibest 模板已内置配置,跳过生成)
|
|
150
|
+
if (template !== 'uniapp') {
|
|
151
|
+
if (features.includes('eslint'))
|
|
152
|
+
(0, configGen_1.genEslintConfig)(targetDir, template, features);
|
|
153
|
+
if (features.includes('prettier'))
|
|
154
|
+
(0, configGen_1.genPrettierConfig)(targetDir);
|
|
155
|
+
if (features.includes('unocss'))
|
|
156
|
+
(0, configGen_1.genUnoConfig)(targetDir);
|
|
157
|
+
if (features.includes('tailwindcss'))
|
|
158
|
+
(0, configGen_1.genTailwindConfig)(targetDir);
|
|
159
|
+
}
|
|
160
|
+
// 8. 安装开发依赖(unibest 模板已有完整依赖,跳过)
|
|
161
|
+
if (template !== 'uniapp') {
|
|
162
|
+
const devDeps = (0, deps_1.getDevDeps)(template, features);
|
|
163
|
+
(0, deps_1.installDevDeps)(targetDir, devDeps);
|
|
164
|
+
}
|
|
151
165
|
// 9. 进度提示与最终依赖安装
|
|
152
166
|
const spinner = (0, ora_1.default)('正在创建项目...').start();
|
|
153
167
|
try {
|
|
@@ -161,12 +175,11 @@ async function createProject(projectName, options) {
|
|
|
161
175
|
if (template === 'uniapp') {
|
|
162
176
|
console.log('\n开始使用:');
|
|
163
177
|
console.log(` cd ${projectName}`);
|
|
164
|
-
console.log(' #
|
|
165
|
-
console.log(' #
|
|
166
|
-
console.log(' pnpm
|
|
167
|
-
console.log(' pnpm
|
|
168
|
-
console.log(' pnpm build:mp-weixin
|
|
169
|
-
console.log(' pnpm dev:mp-weixin # 运行微信小程序');
|
|
178
|
+
console.log(' pnpm dev # 运行 H5');
|
|
179
|
+
console.log(' pnpm dev:mp-weixin # 运行微信小程序');
|
|
180
|
+
console.log(' pnpm dev:mp-alipay # 运行支付宝小程序');
|
|
181
|
+
console.log(' pnpm build:h5 # 打包 H5');
|
|
182
|
+
console.log(' pnpm build:mp-weixin # 打包微信小程序');
|
|
170
183
|
}
|
|
171
184
|
else {
|
|
172
185
|
console.log('\n开始使用:');
|
package/dist/utils/template.js
CHANGED
|
@@ -26,6 +26,12 @@ async function updatePackageJson(targetDir, projectName) {
|
|
|
26
26
|
packageJson.name = projectName;
|
|
27
27
|
packageJson.version = '1.0.0';
|
|
28
28
|
packageJson.description = `${projectName} - 基于万桩UI组件库的项目`;
|
|
29
|
+
// 移除 unibest 模板的特定字段
|
|
30
|
+
delete packageJson.author;
|
|
31
|
+
delete packageJson.repository;
|
|
32
|
+
delete packageJson['repository-gitee'];
|
|
33
|
+
delete packageJson.bugs;
|
|
34
|
+
delete packageJson.homepage;
|
|
29
35
|
// 将更新后的内容写入文件
|
|
30
36
|
(0, fs_1.writeFileSync)(packageJsonPath, JSON.stringify(packageJson, null, 2));
|
|
31
37
|
}
|
package/package.json
CHANGED
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
const fs = require('fs')
|
|
2
|
+
const path = require('path')
|
|
3
|
+
const { execSync } = require('child_process')
|
|
4
|
+
|
|
5
|
+
const scopes = fs
|
|
6
|
+
.readdirSync(path.resolve(__dirname, 'src'), { withFileTypes: true })
|
|
7
|
+
.filter((dirent) => dirent.isDirectory())
|
|
8
|
+
.map((dirent) => dirent.name.replace(/s$/, ''))
|
|
9
|
+
|
|
10
|
+
// precomputed scope
|
|
11
|
+
const scopeComplete = execSync('git status --porcelain || true')
|
|
12
|
+
.toString()
|
|
13
|
+
.trim()
|
|
14
|
+
.split('\n')
|
|
15
|
+
.find((r) => ~r.indexOf('M src'))
|
|
16
|
+
?.replace(/(\/)/g, '%%')
|
|
17
|
+
?.match(/src%%((\w|-)*)/)?.[1]
|
|
18
|
+
?.replace(/s$/, '')
|
|
19
|
+
|
|
20
|
+
module.exports = {
|
|
21
|
+
ignores: [(commit) => commit.includes('init')],
|
|
22
|
+
extends: ['@commitlint/config-conventional'],
|
|
23
|
+
rules: {
|
|
24
|
+
'body-leading-blank': [2, 'always'],
|
|
25
|
+
'footer-leading-blank': [1, 'always'],
|
|
26
|
+
'header-max-length': [2, 'always', 108],
|
|
27
|
+
'subject-empty': [2, 'never'],
|
|
28
|
+
'type-empty': [2, 'never'],
|
|
29
|
+
'subject-case': [0],
|
|
30
|
+
'type-enum': [
|
|
31
|
+
2,
|
|
32
|
+
'always',
|
|
33
|
+
[
|
|
34
|
+
'feat',
|
|
35
|
+
'fix',
|
|
36
|
+
'perf',
|
|
37
|
+
'style',
|
|
38
|
+
'docs',
|
|
39
|
+
'test',
|
|
40
|
+
'refactor',
|
|
41
|
+
'build',
|
|
42
|
+
'ci',
|
|
43
|
+
'chore',
|
|
44
|
+
'revert',
|
|
45
|
+
'wip',
|
|
46
|
+
'workflow',
|
|
47
|
+
'types',
|
|
48
|
+
'release',
|
|
49
|
+
],
|
|
50
|
+
],
|
|
51
|
+
},
|
|
52
|
+
prompt: {
|
|
53
|
+
/** @use `pnpm commit :f` */
|
|
54
|
+
alias: {
|
|
55
|
+
f: 'docs: fix typos',
|
|
56
|
+
r: 'docs: update README',
|
|
57
|
+
s: 'style: update code format',
|
|
58
|
+
b: 'build: bump dependencies',
|
|
59
|
+
c: 'chore: update config',
|
|
60
|
+
},
|
|
61
|
+
customScopesAlign: !scopeComplete ? 'top' : 'bottom',
|
|
62
|
+
defaultScope: scopeComplete,
|
|
63
|
+
scopes: [...scopes, 'mock'],
|
|
64
|
+
allowEmptyIssuePrefixs: false,
|
|
65
|
+
allowCustomIssuePrefixs: false,
|
|
66
|
+
|
|
67
|
+
// English
|
|
68
|
+
typesAppend: [
|
|
69
|
+
{ value: 'wip', name: 'wip: work in process' },
|
|
70
|
+
{ value: 'workflow', name: 'workflow: workflow improvements' },
|
|
71
|
+
{ value: 'types', name: 'types: type definition file changes' },
|
|
72
|
+
],
|
|
73
|
+
|
|
74
|
+
// 中英文对照版
|
|
75
|
+
// messages: {
|
|
76
|
+
// type: '选择你要提交的类型 :',
|
|
77
|
+
// scope: '选择一个提交范围 (可选):',
|
|
78
|
+
// customScope: '请输入自定义的提交范围 :',
|
|
79
|
+
// subject: '填写简短精炼的变更描述 :\n',
|
|
80
|
+
// body: '填写更加详细的变更描述 (可选)。使用 "|" 换行 :\n',
|
|
81
|
+
// breaking: '列举非兼容性重大的变更 (可选)。使用 "|" 换行 :\n',
|
|
82
|
+
// footerPrefixsSelect: '选择关联issue前缀 (可选):',
|
|
83
|
+
// customFooterPrefixs: '输入自定义issue前缀 :',
|
|
84
|
+
// footer: '列举关联issue (可选) 例如: #31, #I3244 :\n',
|
|
85
|
+
// confirmCommit: '是否提交或修改commit ?',
|
|
86
|
+
// },
|
|
87
|
+
// types: [
|
|
88
|
+
// { value: 'feat', name: 'feat: 新增功能' },
|
|
89
|
+
// { value: 'fix', name: 'fix: 修复缺陷' },
|
|
90
|
+
// { value: 'docs', name: 'docs: 文档变更' },
|
|
91
|
+
// { value: 'style', name: 'style: 代码格式' },
|
|
92
|
+
// { value: 'refactor', name: 'refactor: 代码重构' },
|
|
93
|
+
// { value: 'perf', name: 'perf: 性能优化' },
|
|
94
|
+
// { value: 'test', name: 'test: 添加疏漏测试或已有测试改动' },
|
|
95
|
+
// { value: 'build', name: 'build: 构建流程、外部依赖变更 (如升级 npm 包、修改打包配置等)' },
|
|
96
|
+
// { value: 'ci', name: 'ci: 修改 CI 配置、脚本' },
|
|
97
|
+
// { value: 'revert', name: 'revert: 回滚 commit' },
|
|
98
|
+
// { value: 'chore', name: 'chore: 对构建过程或辅助工具和库的更改 (不影响源文件、测试用例)' },
|
|
99
|
+
// { value: 'wip', name: 'wip: 正在开发中' },
|
|
100
|
+
// { value: 'workflow', name: 'workflow: 工作流程改进' },
|
|
101
|
+
// { value: 'types', name: 'types: 类型定义文件修改' },
|
|
102
|
+
// ],
|
|
103
|
+
// emptyScopesAlias: 'empty: 不填写',
|
|
104
|
+
// customScopesAlias: 'custom: 自定义',
|
|
105
|
+
},
|
|
106
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
root = true
|
|
2
|
+
|
|
3
|
+
[*] # 表示所有文件适用
|
|
4
|
+
charset = utf-8 # 设置文件字符集为 utf-8
|
|
5
|
+
indent_style = space # 缩进风格(tab | space)
|
|
6
|
+
indent_size = 2 # 缩进大小
|
|
7
|
+
end_of_line = lf # 控制换行类型(lf | cr | crlf)
|
|
8
|
+
trim_trailing_whitespace = true # 去除行首的任意空白字符
|
|
9
|
+
insert_final_newline = true # 始终在文件末尾插入一个新行
|
|
10
|
+
|
|
11
|
+
[*.md] # 表示仅 md 文件适用以下规则
|
|
12
|
+
max_line_length = off # 关闭最大行长度限制
|
|
13
|
+
trim_trailing_whitespace = false # 关闭末尾空格修剪
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
src/uni_modules/
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
{
|
|
2
|
+
"globals": {
|
|
3
|
+
"Component": true,
|
|
4
|
+
"ComponentPublicInstance": true,
|
|
5
|
+
"ComputedRef": true,
|
|
6
|
+
"EffectScope": true,
|
|
7
|
+
"ExtractDefaultPropTypes": true,
|
|
8
|
+
"ExtractPropTypes": true,
|
|
9
|
+
"ExtractPublicPropTypes": true,
|
|
10
|
+
"InjectionKey": true,
|
|
11
|
+
"PropType": true,
|
|
12
|
+
"Ref": true,
|
|
13
|
+
"VNode": true,
|
|
14
|
+
"WritableComputedRef": true,
|
|
15
|
+
"computed": true,
|
|
16
|
+
"createApp": true,
|
|
17
|
+
"customRef": true,
|
|
18
|
+
"defineAsyncComponent": true,
|
|
19
|
+
"defineComponent": true,
|
|
20
|
+
"effectScope": true,
|
|
21
|
+
"getCurrentInstance": true,
|
|
22
|
+
"getCurrentScope": true,
|
|
23
|
+
"h": true,
|
|
24
|
+
"inject": true,
|
|
25
|
+
"isProxy": true,
|
|
26
|
+
"isReactive": true,
|
|
27
|
+
"isReadonly": true,
|
|
28
|
+
"isRef": true,
|
|
29
|
+
"markRaw": true,
|
|
30
|
+
"nextTick": true,
|
|
31
|
+
"onActivated": true,
|
|
32
|
+
"onAddToFavorites": true,
|
|
33
|
+
"onBackPress": true,
|
|
34
|
+
"onBeforeMount": true,
|
|
35
|
+
"onBeforeUnmount": true,
|
|
36
|
+
"onBeforeUpdate": true,
|
|
37
|
+
"onDeactivated": true,
|
|
38
|
+
"onError": true,
|
|
39
|
+
"onErrorCaptured": true,
|
|
40
|
+
"onHide": true,
|
|
41
|
+
"onLaunch": true,
|
|
42
|
+
"onLoad": true,
|
|
43
|
+
"onMounted": true,
|
|
44
|
+
"onNavigationBarButtonTap": true,
|
|
45
|
+
"onNavigationBarSearchInputChanged": true,
|
|
46
|
+
"onNavigationBarSearchInputClicked": true,
|
|
47
|
+
"onNavigationBarSearchInputConfirmed": true,
|
|
48
|
+
"onNavigationBarSearchInputFocusChanged": true,
|
|
49
|
+
"onPageNotFound": true,
|
|
50
|
+
"onPageScroll": true,
|
|
51
|
+
"onPullDownRefresh": true,
|
|
52
|
+
"onReachBottom": true,
|
|
53
|
+
"onReady": true,
|
|
54
|
+
"onRenderTracked": true,
|
|
55
|
+
"onRenderTriggered": true,
|
|
56
|
+
"onResize": true,
|
|
57
|
+
"onScopeDispose": true,
|
|
58
|
+
"onServerPrefetch": true,
|
|
59
|
+
"onShareAppMessage": true,
|
|
60
|
+
"onShareTimeline": true,
|
|
61
|
+
"onShow": true,
|
|
62
|
+
"onTabItemTap": true,
|
|
63
|
+
"onThemeChange": true,
|
|
64
|
+
"onUnhandledRejection": true,
|
|
65
|
+
"onUnload": true,
|
|
66
|
+
"onUnmounted": true,
|
|
67
|
+
"onUpdated": true,
|
|
68
|
+
"provide": true,
|
|
69
|
+
"reactive": true,
|
|
70
|
+
"readonly": true,
|
|
71
|
+
"ref": true,
|
|
72
|
+
"resolveComponent": true,
|
|
73
|
+
"shallowReactive": true,
|
|
74
|
+
"shallowReadonly": true,
|
|
75
|
+
"shallowRef": true,
|
|
76
|
+
"toRaw": true,
|
|
77
|
+
"toRef": true,
|
|
78
|
+
"toRefs": true,
|
|
79
|
+
"toValue": true,
|
|
80
|
+
"triggerRef": true,
|
|
81
|
+
"unref": true,
|
|
82
|
+
"useAttrs": true,
|
|
83
|
+
"useCssModule": true,
|
|
84
|
+
"useCssVars": true,
|
|
85
|
+
"useRequest": true,
|
|
86
|
+
"useSlots": true,
|
|
87
|
+
"useUpload": true,
|
|
88
|
+
"useUpload2": true,
|
|
89
|
+
"watch": true,
|
|
90
|
+
"watchEffect": true,
|
|
91
|
+
"watchPostEffect": true,
|
|
92
|
+
"watchSyncEffect": true,
|
|
93
|
+
"DirectiveBinding": true,
|
|
94
|
+
"MaybeRef": true,
|
|
95
|
+
"MaybeRefOrGetter": true,
|
|
96
|
+
"onWatcherCleanup": true,
|
|
97
|
+
"useId": true,
|
|
98
|
+
"useModel": true,
|
|
99
|
+
"useTemplateRef": true
|
|
100
|
+
}
|
|
101
|
+
}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
module.exports = {
|
|
2
|
+
env: {
|
|
3
|
+
browser: true,
|
|
4
|
+
es2021: true,
|
|
5
|
+
node: true,
|
|
6
|
+
},
|
|
7
|
+
extends: [
|
|
8
|
+
'eslint:recommended',
|
|
9
|
+
'plugin:@typescript-eslint/recommended',
|
|
10
|
+
'plugin:vue/vue3-essential',
|
|
11
|
+
// eslint-plugin-import 插件, @see https://www.npmjs.com/package/eslint-plugin-import
|
|
12
|
+
'plugin:import/recommended',
|
|
13
|
+
// eslint-config-airbnb-base 插件 已经改用 eslint-config-standard 插件
|
|
14
|
+
'standard',
|
|
15
|
+
// 1. 接入 prettier 的规则
|
|
16
|
+
'prettier',
|
|
17
|
+
'plugin:prettier/recommended',
|
|
18
|
+
'./.eslintrc-auto-import.json',
|
|
19
|
+
],
|
|
20
|
+
overrides: [
|
|
21
|
+
{
|
|
22
|
+
env: {
|
|
23
|
+
node: true,
|
|
24
|
+
},
|
|
25
|
+
files: ['.eslintrc.{js,cjs}'],
|
|
26
|
+
parserOptions: {
|
|
27
|
+
sourceType: 'script',
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
],
|
|
31
|
+
parserOptions: {
|
|
32
|
+
ecmaVersion: 'latest',
|
|
33
|
+
parser: '@typescript-eslint/parser',
|
|
34
|
+
sourceType: 'module',
|
|
35
|
+
},
|
|
36
|
+
plugins: [
|
|
37
|
+
'@typescript-eslint',
|
|
38
|
+
'vue',
|
|
39
|
+
// 2. 加入 prettier 的 eslint 插件
|
|
40
|
+
'prettier',
|
|
41
|
+
// eslint-import-resolver-typescript 插件,@see https://www.npmjs.com/package/eslint-import-resolver-typescript
|
|
42
|
+
'import',
|
|
43
|
+
],
|
|
44
|
+
rules: {
|
|
45
|
+
// 3. 注意要加上这一句,开启 prettier 自动修复的功能
|
|
46
|
+
'prettier/prettier': 'error',
|
|
47
|
+
// turn on errors for missing imports
|
|
48
|
+
'import/no-unresolved': 'off',
|
|
49
|
+
// 对后缀的检测,否则 import 一个ts文件也会报错,需要手动添加'.ts', 增加了下面的配置后就不用了
|
|
50
|
+
'import/extensions': [
|
|
51
|
+
'error',
|
|
52
|
+
'ignorePackages',
|
|
53
|
+
{ js: 'never', jsx: 'never', ts: 'never', tsx: 'never' },
|
|
54
|
+
],
|
|
55
|
+
// 只允许1个默认导出,关闭,否则不能随意export xxx
|
|
56
|
+
'import/prefer-default-export': ['off'],
|
|
57
|
+
'no-console': ['off'],
|
|
58
|
+
// 'no-unused-vars': ['off'],
|
|
59
|
+
// '@typescript-eslint/no-unused-vars': ['off'],
|
|
60
|
+
// 解决vite.config.ts报错问题
|
|
61
|
+
'import/no-extraneous-dependencies': 'off',
|
|
62
|
+
'no-plusplus': 'off',
|
|
63
|
+
'no-shadow': 'off',
|
|
64
|
+
'vue/multi-word-component-names': 'off',
|
|
65
|
+
'@typescript-eslint/no-explicit-any': 'off',
|
|
66
|
+
'no-underscore-dangle': 'off',
|
|
67
|
+
'no-use-before-define': 'off',
|
|
68
|
+
'no-undef': 'off',
|
|
69
|
+
'no-unused-vars': 'off',
|
|
70
|
+
'no-param-reassign': 'off',
|
|
71
|
+
'@typescript-eslint/no-unused-vars': 'off',
|
|
72
|
+
// 避免 `eslint` 对于 `typescript` 函数重载的误报
|
|
73
|
+
'no-redeclare': 'off',
|
|
74
|
+
'@typescript-eslint/no-redeclare': 'error',
|
|
75
|
+
},
|
|
76
|
+
// eslint-import-resolver-typescript 插件,@see https://www.npmjs.com/package/eslint-import-resolver-typescript
|
|
77
|
+
settings: {
|
|
78
|
+
'import/parsers': {
|
|
79
|
+
'@typescript-eslint/parser': ['.ts', '.tsx'],
|
|
80
|
+
},
|
|
81
|
+
'import/resolver': {
|
|
82
|
+
typescript: {},
|
|
83
|
+
},
|
|
84
|
+
},
|
|
85
|
+
globals: {
|
|
86
|
+
$t: true,
|
|
87
|
+
uni: true,
|
|
88
|
+
UniApp: true,
|
|
89
|
+
wx: true,
|
|
90
|
+
WechatMiniprogram: true,
|
|
91
|
+
getCurrentPages: true,
|
|
92
|
+
UniHelper: true,
|
|
93
|
+
Page: true,
|
|
94
|
+
App: true,
|
|
95
|
+
NodeJS: true,
|
|
96
|
+
},
|
|
97
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
// @see https://prettier.io/docs/en/options
|
|
2
|
+
module.exports = {
|
|
3
|
+
singleQuote: true,
|
|
4
|
+
printWidth: 100,
|
|
5
|
+
tabWidth: 2,
|
|
6
|
+
useTabs: false,
|
|
7
|
+
semi: false,
|
|
8
|
+
trailingComma: 'all',
|
|
9
|
+
endOfLine: 'auto',
|
|
10
|
+
htmlWhitespaceSensitivity: 'ignore',
|
|
11
|
+
overrides: [
|
|
12
|
+
{
|
|
13
|
+
files: '*.json',
|
|
14
|
+
options: {
|
|
15
|
+
trailingComma: 'none',
|
|
16
|
+
},
|
|
17
|
+
},
|
|
18
|
+
],
|
|
19
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
src/uni_modules/
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
// .stylelintrc.cjs
|
|
2
|
+
|
|
3
|
+
module.exports = {
|
|
4
|
+
root: true,
|
|
5
|
+
extends: [
|
|
6
|
+
// stylelint-config-standard 替换成了更宽松的 stylelint-config-recommended
|
|
7
|
+
'stylelint-config-recommended',
|
|
8
|
+
// stylelint-config-standard-scss 替换成了更宽松的 stylelint-config-recommended-scss
|
|
9
|
+
'stylelint-config-recommended-scss',
|
|
10
|
+
'stylelint-config-recommended-vue/scss',
|
|
11
|
+
'stylelint-config-html/vue',
|
|
12
|
+
'stylelint-config-recess-order',
|
|
13
|
+
],
|
|
14
|
+
plugins: ['stylelint-prettier'],
|
|
15
|
+
overrides: [
|
|
16
|
+
// 扫描 .vue/html 文件中的<style>标签内的样式
|
|
17
|
+
{
|
|
18
|
+
files: ['**/*.{vue,html}'],
|
|
19
|
+
customSyntax: 'postcss-html',
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
files: ['**/*.{css,scss}'],
|
|
23
|
+
customSyntax: 'postcss-scss',
|
|
24
|
+
},
|
|
25
|
+
],
|
|
26
|
+
// 自定义规则
|
|
27
|
+
rules: {
|
|
28
|
+
'prettier/prettier': true,
|
|
29
|
+
// 允许 global 、export 、v-deep等伪类
|
|
30
|
+
'selector-pseudo-class-no-unknown': [
|
|
31
|
+
true,
|
|
32
|
+
{
|
|
33
|
+
ignorePseudoClasses: ['global', 'export', 'v-deep', 'deep'],
|
|
34
|
+
},
|
|
35
|
+
],
|
|
36
|
+
'unit-no-unknown': [
|
|
37
|
+
true,
|
|
38
|
+
{
|
|
39
|
+
ignoreUnits: ['rpx'],
|
|
40
|
+
},
|
|
41
|
+
],
|
|
42
|
+
// 处理小程序page标签不认识的问题
|
|
43
|
+
'selector-type-no-unknown': [
|
|
44
|
+
true,
|
|
45
|
+
{
|
|
46
|
+
ignoreTypes: ['page'],
|
|
47
|
+
},
|
|
48
|
+
],
|
|
49
|
+
'comment-empty-line-before': 'never', // never|always|always-multi-line|never-multi-line
|
|
50
|
+
'custom-property-empty-line-before': 'never',
|
|
51
|
+
'no-empty-source': null,
|
|
52
|
+
'comment-no-empty': null,
|
|
53
|
+
'no-duplicate-selectors': null,
|
|
54
|
+
'scss/comment-no-empty': null,
|
|
55
|
+
'selector-class-pattern': null,
|
|
56
|
+
'font-family-no-missing-generic-family-keyword': null,
|
|
57
|
+
},
|
|
58
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
{
|
|
2
|
+
"recommendations": [
|
|
3
|
+
"vue.volar",
|
|
4
|
+
"stylelint.vscode-stylelint",
|
|
5
|
+
"esbenp.prettier-vscode",
|
|
6
|
+
"dbaeumer.vscode-eslint",
|
|
7
|
+
"antfu.unocss",
|
|
8
|
+
"antfu.iconify",
|
|
9
|
+
"evils.uniapp-vscode",
|
|
10
|
+
"uni-helper.uni-helper-vscode",
|
|
11
|
+
"uni-helper.uni-app-schemas-vscode",
|
|
12
|
+
"uni-helper.uni-highlight-vscode",
|
|
13
|
+
"uni-helper.uni-ui-snippets-vscode",
|
|
14
|
+
"uni-helper.uni-app-snippets-vscode",
|
|
15
|
+
"mrmlnc.vscode-json5"
|
|
16
|
+
]
|
|
17
|
+
}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
{
|
|
2
|
+
// 默认格式化工具选择prettier
|
|
3
|
+
"editor.defaultFormatter": "esbenp.prettier-vscode",
|
|
4
|
+
// 保存的时候自动格式化
|
|
5
|
+
"editor.formatOnSave": true,
|
|
6
|
+
//开启自动修复
|
|
7
|
+
"editor.codeActionsOnSave": {
|
|
8
|
+
"source.fixAll": "explicit",
|
|
9
|
+
"source.fixAll.eslint": "explicit",
|
|
10
|
+
"source.fixAll.stylelint": "explicit"
|
|
11
|
+
},
|
|
12
|
+
// 配置stylelint检查的文件类型范围
|
|
13
|
+
"stylelint.validate": ["css", "scss", "vue", "html"], // 与package.json的scripts对应
|
|
14
|
+
"stylelint.enable": true,
|
|
15
|
+
"css.validate": false,
|
|
16
|
+
"less.validate": false,
|
|
17
|
+
"scss.validate": false,
|
|
18
|
+
"[shellscript]": {
|
|
19
|
+
"editor.defaultFormatter": "foxundermoon.shell-format"
|
|
20
|
+
},
|
|
21
|
+
"[dotenv]": {
|
|
22
|
+
"editor.defaultFormatter": "foxundermoon.shell-format"
|
|
23
|
+
},
|
|
24
|
+
"[vue]": {
|
|
25
|
+
"editor.defaultFormatter": "esbenp.prettier-vscode"
|
|
26
|
+
},
|
|
27
|
+
"[typescript]": {
|
|
28
|
+
"editor.defaultFormatter": "esbenp.prettier-vscode"
|
|
29
|
+
},
|
|
30
|
+
"[jsonc]": {
|
|
31
|
+
"editor.defaultFormatter": "esbenp.prettier-vscode"
|
|
32
|
+
},
|
|
33
|
+
// 配置语言的文件关联
|
|
34
|
+
"files.associations": {
|
|
35
|
+
"pages.json": "jsonc", // pages.json 可以写注释
|
|
36
|
+
"manifest.json": "jsonc" // manifest.json 可以写注释
|
|
37
|
+
},
|
|
38
|
+
"cSpell.words": [
|
|
39
|
+
"climblee",
|
|
40
|
+
"commitlint",
|
|
41
|
+
"dcloudio",
|
|
42
|
+
"iconfont",
|
|
43
|
+
"qrcode",
|
|
44
|
+
"refresherrefresh",
|
|
45
|
+
"scrolltolower",
|
|
46
|
+
"tabbar",
|
|
47
|
+
"unibest",
|
|
48
|
+
"uvui",
|
|
49
|
+
"WechatMiniprogram"
|
|
50
|
+
],
|
|
51
|
+
"typescript.tsdk": "node_modules\\typescript\\lib",
|
|
52
|
+
// 控制相关文件嵌套展示
|
|
53
|
+
"explorer.fileNesting.enabled": true,
|
|
54
|
+
"explorer.fileNesting.expand": false,
|
|
55
|
+
"explorer.fileNesting.patterns": {
|
|
56
|
+
"*.ts": "$(capture).test.ts, $(capture).test.tsx",
|
|
57
|
+
"*.tsx": "$(capture).test.ts, $(capture).test.tsx",
|
|
58
|
+
"*.env": "$(capture).env.*",
|
|
59
|
+
"CHANGELOG.md": "CHANGELOG*",
|
|
60
|
+
"package.json": "pnpm-lock.yaml,pnpm-workspace.yaml,LICENSE,.gitattributes,.gitignore,.gitpod.yml,CNAME,README*,.npmrc,.browserslistrc",
|
|
61
|
+
".eslintrc.cjs": ".eslintignore,.prettierignore,.stylelintignore,.commitlintrc.*,.prettierrc.*,.stylelintrc.*,.eslintrc-auto-import.json,.editorconfig,.commitlint.cjs",
|
|
62
|
+
"vite.config.ts": "tsconfig.*.json,uno.config.ts,tsconfig.json,uni-pages.d.ts",
|
|
63
|
+
"manifest.config.ts": "manifest.config.ts,pages.config.ts"
|
|
64
|
+
}
|
|
65
|
+
}
|