@hlw-uni/mp-cli 1.0.19 → 1.0.21
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 +27 -25
- package/bin/cli.js +0 -0
- package/package.json +37 -37
- package/templates/mp-toutiao/base/package.json +2 -2
- package/templates/mp-toutiao/base/src/main.ts +1 -0
- package/templates/mp-toutiao/base/vite.config.ts +7 -0
- package/templates/mp-weixin/base/package.json +2 -2
- package/templates/mp-weixin/base/src/main.ts +1 -0
- package/templates/mp-weixin/base/src/manifest.json +6 -2
- package/templates/mp-weixin/base/vite.config.ts +7 -0
package/README.md
CHANGED
|
@@ -10,28 +10,30 @@ npm install -g @hlw-uni/mp-cli
|
|
|
10
10
|
|
|
11
11
|
# 或直接使用 npx
|
|
12
12
|
npx @hlw-uni/mp-cli create my-project
|
|
13
|
+
|
|
14
|
+
npx -y @hlw-uni/mp-cli@latest create my-project
|
|
13
15
|
```
|
|
14
16
|
|
|
15
17
|
## 命令
|
|
16
18
|
|
|
17
|
-
| 命令
|
|
18
|
-
|
|
19
|
-
| `hlw-uni-mp create [name]`
|
|
20
|
-
| `hlw-uni-mp create [name] --ci`
|
|
21
|
-
| `hlw-uni-mp add page <name>`
|
|
22
|
-
| `hlw-uni-mp add component <name>` | 添加新组件
|
|
23
|
-
| `hlw-uni-mp list`
|
|
24
|
-
| `hlw-uni-mp --help`
|
|
19
|
+
| 命令 | 说明 |
|
|
20
|
+
| --------------------------------- | ----------------------------------- |
|
|
21
|
+
| `hlw-uni-mp create [name]` | 创建新项目(交互式引导) |
|
|
22
|
+
| `hlw-uni-mp create [name] --ci` | 非交互模式创建,使用默认选项 |
|
|
23
|
+
| `hlw-uni-mp add page <name>` | 添加新页面(自动注册到 pages.json) |
|
|
24
|
+
| `hlw-uni-mp add component <name>` | 添加新组件 |
|
|
25
|
+
| `hlw-uni-mp list` | 列出所有可用平台和模板 |
|
|
26
|
+
| `hlw-uni-mp --help` | 显示帮助信息 |
|
|
25
27
|
|
|
26
28
|
### create 命令选项
|
|
27
29
|
|
|
28
|
-
| 选项
|
|
29
|
-
|
|
30
|
-
| `-p, --platform <platform>`
|
|
31
|
-
| `-t, --template <template>`
|
|
32
|
-
| `-d, --description <description>` | 项目描述
|
|
33
|
-
| `-a, --author <author>`
|
|
34
|
-
| `--ci`
|
|
30
|
+
| 选项 | 说明 |
|
|
31
|
+
| --------------------------------- | ------------------------------------- |
|
|
32
|
+
| `-p, --platform <platform>` | 指定平台 (`mp-weixin` / `mp-toutiao`) |
|
|
33
|
+
| `-t, --template <template>` | 指定模板 ID |
|
|
34
|
+
| `-d, --description <description>` | 项目描述 |
|
|
35
|
+
| `-a, --author <author>` | 作者名称 |
|
|
36
|
+
| `--ci` | 非交互模式,自动使用默认选项 |
|
|
35
37
|
|
|
36
38
|
## 使用示例
|
|
37
39
|
|
|
@@ -60,9 +62,9 @@ hlw-uni-mp list
|
|
|
60
62
|
|
|
61
63
|
## 支持的平台
|
|
62
64
|
|
|
63
|
-
| 平台
|
|
64
|
-
|
|
65
|
-
| 微信小程序 | `mp-weixin`
|
|
65
|
+
| 平台 | ID | 描述 |
|
|
66
|
+
| ---------- | ------------ | -------------- |
|
|
67
|
+
| 微信小程序 | `mp-weixin` | 微信小程序模板 |
|
|
66
68
|
| 抖音小程序 | `mp-toutiao` | 抖音小程序模板 |
|
|
67
69
|
|
|
68
70
|
## 模板
|
|
@@ -151,12 +153,12 @@ npm run build:mp-toutiao
|
|
|
151
153
|
|
|
152
154
|
```json
|
|
153
155
|
{
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
156
|
+
"dependencies": {
|
|
157
|
+
"chalk": "^4.1.2",
|
|
158
|
+
"commander": "^11.1.0",
|
|
159
|
+
"fs-extra": "^11.2.0",
|
|
160
|
+
"inquirer": "^8.2.7",
|
|
161
|
+
"ora": "^5.4.1"
|
|
162
|
+
}
|
|
161
163
|
}
|
|
162
164
|
```
|
package/bin/cli.js
CHANGED
|
File without changes
|
package/package.json
CHANGED
|
@@ -1,38 +1,38 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
"
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
"
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
}
|
|
2
|
+
"name": "@hlw-uni/mp-cli",
|
|
3
|
+
"version": "1.0.21",
|
|
4
|
+
"description": "uniapp 小程序脚手架生成器",
|
|
5
|
+
"main": "bin/cli.js",
|
|
6
|
+
"bin": {
|
|
7
|
+
"hlw-uni-mp": "./bin/cli.js"
|
|
8
|
+
},
|
|
9
|
+
"scripts": {
|
|
10
|
+
"dev": "tsx bin/cli.ts",
|
|
11
|
+
"create": "tsx bin/cli.ts create",
|
|
12
|
+
"build": "esbuild bin/cli.ts --bundle --platform=node --outfile=bin/cli.js --format=cjs --external:fs-extra --external:inquirer --external:chalk --external:commander --external:ora --external:path --external:fs",
|
|
13
|
+
"prepublish": "pnpm build",
|
|
14
|
+
"postbuild": "node scripts/fix-templates-path.js"
|
|
15
|
+
},
|
|
16
|
+
"keywords": [
|
|
17
|
+
"uniapp",
|
|
18
|
+
"scaffold",
|
|
19
|
+
"weixin",
|
|
20
|
+
"toutiao",
|
|
21
|
+
"miniprogram"
|
|
22
|
+
],
|
|
23
|
+
"author": "hlw2326",
|
|
24
|
+
"license": "MIT",
|
|
25
|
+
"dependencies": {
|
|
26
|
+
"chalk": "^4.1.2",
|
|
27
|
+
"commander": "^11.1.0",
|
|
28
|
+
"fs-extra": "^11.2.0",
|
|
29
|
+
"inquirer": "^8.2.7",
|
|
30
|
+
"ora": "^5.4.1"
|
|
31
|
+
},
|
|
32
|
+
"devDependencies": {
|
|
33
|
+
"@types/fs-extra": "^11.0.4",
|
|
34
|
+
"@types/node": "^20.11.0",
|
|
35
|
+
"esbuild": "^0.28.0",
|
|
36
|
+
"tsx": "^4.19.0"
|
|
37
|
+
}
|
|
38
|
+
}
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"@dcloudio/uni-app-plus": "3.0.0-4080420251103001",
|
|
12
12
|
"@dcloudio/uni-components": "3.0.0-4080420251103001",
|
|
13
13
|
"@dcloudio/uni-mp-toutiao": "3.0.0-4080420251103001",
|
|
14
|
-
"@hlw-uni/mp-core": "^1.0.
|
|
14
|
+
"@hlw-uni/mp-core": "^1.0.9",
|
|
15
15
|
"@hlw-uni/mp-vue": "^1.0.2",
|
|
16
16
|
"@vueuse/core": "^10.9.0",
|
|
17
17
|
"pinia": "^2.1.7",
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
"@dcloudio/types": "^3.4.8",
|
|
23
23
|
"@dcloudio/uni-cli-shared": "3.0.0-4080420251103001",
|
|
24
24
|
"@dcloudio/vite-plugin-uni": "3.0.0-4080420251103001",
|
|
25
|
-
"@hlw-uni/mp-vite-plugin": "^1.0.
|
|
25
|
+
"@hlw-uni/mp-vite-plugin": "^1.0.9",
|
|
26
26
|
"@unocss/transformer-directives": "^66.1.1",
|
|
27
27
|
"@vue/tsconfig": "^0.1.3",
|
|
28
28
|
"sass": "^1.70.0",
|
|
@@ -7,6 +7,7 @@ import { useUserStore } from "./stores/user";
|
|
|
7
7
|
|
|
8
8
|
// 注册默认拦截器(Token + 业务错误 + 401)
|
|
9
9
|
setupDefaultInterceptors({
|
|
10
|
+
baseURL: (import.meta.env as Record<string, string>).VITE_API_BASE_URL ?? "",
|
|
10
11
|
getToken: () => useUserStore().token,
|
|
11
12
|
onUnauthorized: () => {
|
|
12
13
|
useUserStore().$patch({ token: "", userInfo: null });
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
"@dcloudio/uni-app-plus": "3.0.0-4080420251103001",
|
|
13
13
|
"@dcloudio/uni-components": "3.0.0-4080420251103001",
|
|
14
14
|
"@dcloudio/uni-mp-weixin": "3.0.0-4080420251103001",
|
|
15
|
-
"@hlw-uni/mp-core": "^1.0.
|
|
15
|
+
"@hlw-uni/mp-core": "^1.0.9",
|
|
16
16
|
"@hlw-uni/mp-vue": "^1.0.2",
|
|
17
17
|
"@vueuse/core": "^10.9.0",
|
|
18
18
|
"pinia": "^2.1.7",
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
"@dcloudio/types": "^3.4.8",
|
|
24
24
|
"@dcloudio/uni-cli-shared": "3.0.0-4080420251103001",
|
|
25
25
|
"@dcloudio/vite-plugin-uni": "3.0.0-4080420251103001",
|
|
26
|
-
"@hlw-uni/mp-vite-plugin": "^1.0.
|
|
26
|
+
"@hlw-uni/mp-vite-plugin": "^1.0.9",
|
|
27
27
|
"@unocss/transformer-directives": "^66.1.1",
|
|
28
28
|
"@vue/tsconfig": "^0.1.3",
|
|
29
29
|
"sass": "^1.70.0",
|
|
@@ -7,6 +7,7 @@ import { useUserStore } from "./stores/user";
|
|
|
7
7
|
|
|
8
8
|
// 注册默认拦截器(Token + 业务错误 + 401)
|
|
9
9
|
setupDefaultInterceptors({
|
|
10
|
+
baseURL: (import.meta.env as Record<string, string>).VITE_API_BASE_URL ?? "",
|
|
10
11
|
getToken: () => useUserStore().token,
|
|
11
12
|
onUnauthorized: () => {
|
|
12
13
|
useUserStore().$patch({ token: "", userInfo: null });
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"name": "",
|
|
2
|
+
"name": "hlw-uni",
|
|
3
3
|
"appid": "",
|
|
4
4
|
"description": "",
|
|
5
5
|
"versionName": "1.0.0",
|
|
@@ -7,7 +7,11 @@
|
|
|
7
7
|
"transformPx": false,
|
|
8
8
|
"mp-weixin": {
|
|
9
9
|
"appid": "",
|
|
10
|
-
"setting": {
|
|
10
|
+
"setting": {
|
|
11
|
+
"urlCheck": false,
|
|
12
|
+
"postcss": true,
|
|
13
|
+
"minified": true
|
|
14
|
+
},
|
|
11
15
|
"usingComponents": true
|
|
12
16
|
}
|
|
13
17
|
}
|