weapp-ide-cli 5.1.4 → 5.1.5
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 +31 -0
- package/dist/{cli-BkQJ3Aww.js → cli-BZKq6t2k.js} +35 -21
- package/dist/cli.js +1 -1
- package/dist/index.js +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -37,6 +37,8 @@ weapp open --project ./dist/dev/mp-weixin
|
|
|
37
37
|
# 执行预览、上传等官方支持的命令
|
|
38
38
|
weapp preview
|
|
39
39
|
weapp upload --project ./dist/build/mp-weixin
|
|
40
|
+
weapp cache --clean compile
|
|
41
|
+
weapp cache --clean all
|
|
40
42
|
```
|
|
41
43
|
|
|
42
44
|
`weapp` 与 `weapp-ide-cli` 等价,选择任一前缀即可。
|
|
@@ -92,6 +94,35 @@ weapp open --platform alipay -p ./dist/dev/mp-alipay
|
|
|
92
94
|
|
|
93
95
|
- <https://developers.weixin.qq.com/miniprogram/dev/devtools/cli.html>
|
|
94
96
|
|
|
97
|
+
其中 `weapp cloud` 为云开发命令族入口,可继续透传官方子命令,例如:
|
|
98
|
+
|
|
99
|
+
```bash
|
|
100
|
+
weapp cloud env list
|
|
101
|
+
weapp cloud functions list
|
|
102
|
+
weapp cloud functions info --name hello
|
|
103
|
+
weapp cloud functions deploy --name hello
|
|
104
|
+
weapp cloud functions inc-deploy --name hello
|
|
105
|
+
weapp cloud functions download --name hello
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
缓存清理示例:
|
|
109
|
+
|
|
110
|
+
```bash
|
|
111
|
+
weapp cache --clean compile
|
|
112
|
+
weapp cache --clean network
|
|
113
|
+
weapp cache --clean all
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
支持的缓存类型:
|
|
117
|
+
|
|
118
|
+
- `storage`
|
|
119
|
+
- `file`
|
|
120
|
+
- `compile`
|
|
121
|
+
- `auth`
|
|
122
|
+
- `network`
|
|
123
|
+
- `session`
|
|
124
|
+
- `all`
|
|
125
|
+
|
|
95
126
|
### 2. automator 增强命令
|
|
96
127
|
|
|
97
128
|
`weapp-ide-cli` 内置 automator 子命令:
|
|
@@ -1108,6 +1108,36 @@ function flushExecutionOutput(result) {
|
|
|
1108
1108
|
}
|
|
1109
1109
|
//#endregion
|
|
1110
1110
|
//#region src/cli/wechat-command-schema.ts
|
|
1111
|
+
const CACHE_CLEAN_TYPES = [
|
|
1112
|
+
"storage",
|
|
1113
|
+
"file",
|
|
1114
|
+
"compile",
|
|
1115
|
+
"auth",
|
|
1116
|
+
"network",
|
|
1117
|
+
"session",
|
|
1118
|
+
"all"
|
|
1119
|
+
];
|
|
1120
|
+
function isNonEmptyText(value) {
|
|
1121
|
+
return typeof value === "string" && value.trim().length > 0;
|
|
1122
|
+
}
|
|
1123
|
+
function validatePortOption(argv) {
|
|
1124
|
+
const port = readOptionValue(argv, "--port");
|
|
1125
|
+
if (!port) return;
|
|
1126
|
+
const parsed = Number.parseInt(port, 10);
|
|
1127
|
+
if (!Number.isFinite(parsed) || parsed <= 0) throw new Error(i18nText(`无效的 --port 值: ${port}(必须为正整数)`, `Invalid --port value: ${port} (must be a positive integer)`));
|
|
1128
|
+
}
|
|
1129
|
+
function validateProjectLocator(command, argv) {
|
|
1130
|
+
const projectPath = readOptionValue(argv, "--project");
|
|
1131
|
+
const appid = readOptionValue(argv, "--appid");
|
|
1132
|
+
if (isNonEmptyText(projectPath) || isNonEmptyText(appid)) return;
|
|
1133
|
+
throw new Error(i18nText(`${command} 命令需要提供 --project 或 --appid`, `${command} command requires --project or --appid`));
|
|
1134
|
+
}
|
|
1135
|
+
function validateExtAppidDependency(argv) {
|
|
1136
|
+
if (!isNonEmptyText(readOptionValue(argv, "--ext-appid"))) return;
|
|
1137
|
+
if (isNonEmptyText(readOptionValue(argv, "--project"))) return;
|
|
1138
|
+
if (isNonEmptyText(readOptionValue(argv, "--appid"))) return;
|
|
1139
|
+
throw new Error(i18nText("--ext-appid 需要和 --appid 一起使用(当未提供 --project 时)", "--ext-appid requires --appid when --project is not provided"));
|
|
1140
|
+
}
|
|
1111
1141
|
/**
|
|
1112
1142
|
* @description 在调用官方微信 CLI 前做轻量参数校验。
|
|
1113
1143
|
*/
|
|
@@ -1131,29 +1161,13 @@ function validateWechatCliCommandArgs(argv) {
|
|
|
1131
1161
|
"base64"
|
|
1132
1162
|
].includes(qrFormat.toLowerCase())) throw new Error(i18nText(`preview 命令的二维码格式无效: ${qrFormat}(仅支持 terminal/image/base64)`, `Invalid preview qr format: ${qrFormat} (supported: terminal/image/base64)`));
|
|
1133
1163
|
}
|
|
1164
|
+
if (command === "cache") {
|
|
1165
|
+
const cleanType = readOptionValue(argv, "--clean") || readOptionValue(argv, "-c");
|
|
1166
|
+
if (!isNonEmptyText(cleanType)) throw new Error(i18nText("cache 命令缺少必填参数:--clean/-c", "cache command requires --clean/-c"));
|
|
1167
|
+
if (!CACHE_CLEAN_TYPES.includes(cleanType)) throw new Error(i18nText(`cache 命令的清理类型无效: ${cleanType}(仅支持 ${CACHE_CLEAN_TYPES.join("/")})`, `Invalid cache clean type: ${cleanType} (supported: ${CACHE_CLEAN_TYPES.join("/")})`));
|
|
1168
|
+
}
|
|
1134
1169
|
if (command === "upload" || command === "auto" || command === "auto-preview") validateProjectLocator(command, argv);
|
|
1135
1170
|
}
|
|
1136
|
-
function validatePortOption(argv) {
|
|
1137
|
-
const port = readOptionValue(argv, "--port");
|
|
1138
|
-
if (!port) return;
|
|
1139
|
-
const parsed = Number.parseInt(port, 10);
|
|
1140
|
-
if (!Number.isFinite(parsed) || parsed <= 0) throw new Error(i18nText(`无效的 --port 值: ${port}(必须为正整数)`, `Invalid --port value: ${port} (must be a positive integer)`));
|
|
1141
|
-
}
|
|
1142
|
-
function validateProjectLocator(command, argv) {
|
|
1143
|
-
const projectPath = readOptionValue(argv, "--project");
|
|
1144
|
-
const appid = readOptionValue(argv, "--appid");
|
|
1145
|
-
if (isNonEmptyText(projectPath) || isNonEmptyText(appid)) return;
|
|
1146
|
-
throw new Error(i18nText(`${command} 命令需要提供 --project 或 --appid`, `${command} command requires --project or --appid`));
|
|
1147
|
-
}
|
|
1148
|
-
function validateExtAppidDependency(argv) {
|
|
1149
|
-
if (!isNonEmptyText(readOptionValue(argv, "--ext-appid"))) return;
|
|
1150
|
-
if (isNonEmptyText(readOptionValue(argv, "--project"))) return;
|
|
1151
|
-
if (isNonEmptyText(readOptionValue(argv, "--appid"))) return;
|
|
1152
|
-
throw new Error(i18nText("--ext-appid 需要和 --appid 一起使用(当未提供 --project 时)", "--ext-appid requires --appid when --project is not provided"));
|
|
1153
|
-
}
|
|
1154
|
-
function isNonEmptyText(value) {
|
|
1155
|
-
return typeof value === "string" && value.trim().length > 0;
|
|
1156
|
-
}
|
|
1157
1171
|
//#endregion
|
|
1158
1172
|
//#region src/cli/run.ts
|
|
1159
1173
|
const MINIDEV_NAMESPACE = new Set(MINIDEV_NAMESPACE_COMMAND_NAMES);
|
package/dist/cli.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { H as logger_default } from "./commands-CSbpftLN.js";
|
|
2
|
-
import { n as parse } from "./cli-
|
|
2
|
+
import { n as parse } from "./cli-BZKq6t2k.js";
|
|
3
3
|
import process from "node:process";
|
|
4
4
|
//#region src/cli.ts
|
|
5
5
|
parse(process.argv.slice(2)).catch((err) => {
|
package/dist/index.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { A as createLocaleConfig, B as operatingSystemName, C as isAutomatorLoginError, D as getConfig, E as resolveCliPath, F as defaultCustomConfigFilePath, I as resolvePath, L as SupportedPlatformsMap, M as readCustomConfig, N as removeCustomConfigKey, O as getConfiguredLocale, P as defaultCustomConfigDirPath, R as getDefaultCliPath, S as formatAutomatorLoginError, T as launchAutomator, _ as connectMiniProgram, a as navigateBack, c as pageStack, d as remote, f as scrollTo, g as tap, h as takeScreenshot, i as input, j as overwriteCustomConfig, k as createCustomConfig, l as reLaunch, m as systemInfo, o as navigateTo, p as switchTab, r as currentPage, s as pageData, t as audit, u as redirectTo, v as withMiniProgram, w as isDevtoolsHttpPortError, z as isOperatingSystemSupported } from "./commands-CSbpftLN.js";
|
|
2
|
-
import { A as parseAutomatorArgs, C as isWeappIdeTopLevelCommand, D as runAutomatorCommand, E as isAutomatorCommand, M as removeOption, O as parseScreenshotArgs, S as WECHAT_CLI_COMMAND_NAMES, T as getAutomatorCommandHelp, _ as handleConfigCommand, a as createWechatIdeLoginRequiredExitError, b as MINIDEV_NAMESPACE_COMMAND_NAMES, c as formatWechatIdeLoginRequiredError, d as runMinidev, f as execute, g as startForwardConsole, h as transformArgv, i as runWechatCliWithRetry, j as readOptionValue, k as printScreenshotHelp, l as isWechatIdeLoginRequiredError, m as createPathCompat, n as parse, o as extractExecutionErrorText, p as createAlias, r as validateWechatCliCommandArgs, s as formatRetryHotkeyPrompt, t as createCli, u as waitForRetryKeypress, v as promptForCliPath, w as AUTOMATOR_COMMAND_NAMES, x as WEAPP_IDE_TOP_LEVEL_COMMAND_NAMES, y as CONFIG_COMMAND_NAME } from "./cli-
|
|
2
|
+
import { A as parseAutomatorArgs, C as isWeappIdeTopLevelCommand, D as runAutomatorCommand, E as isAutomatorCommand, M as removeOption, O as parseScreenshotArgs, S as WECHAT_CLI_COMMAND_NAMES, T as getAutomatorCommandHelp, _ as handleConfigCommand, a as createWechatIdeLoginRequiredExitError, b as MINIDEV_NAMESPACE_COMMAND_NAMES, c as formatWechatIdeLoginRequiredError, d as runMinidev, f as execute, g as startForwardConsole, h as transformArgv, i as runWechatCliWithRetry, j as readOptionValue, k as printScreenshotHelp, l as isWechatIdeLoginRequiredError, m as createPathCompat, n as parse, o as extractExecutionErrorText, p as createAlias, r as validateWechatCliCommandArgs, s as formatRetryHotkeyPrompt, t as createCli, u as waitForRetryKeypress, v as promptForCliPath, w as AUTOMATOR_COMMAND_NAMES, x as WEAPP_IDE_TOP_LEVEL_COMMAND_NAMES, y as CONFIG_COMMAND_NAME } from "./cli-BZKq6t2k.js";
|
|
3
3
|
export { AUTOMATOR_COMMAND_NAMES, CONFIG_COMMAND_NAME, MINIDEV_NAMESPACE_COMMAND_NAMES, SupportedPlatformsMap, WEAPP_IDE_TOP_LEVEL_COMMAND_NAMES, WECHAT_CLI_COMMAND_NAMES, audit, connectMiniProgram, createAlias, createCli, createCustomConfig, createLocaleConfig, createPathCompat, createWechatIdeLoginRequiredExitError, currentPage, defaultCustomConfigDirPath, defaultCustomConfigFilePath, execute, extractExecutionErrorText, formatAutomatorLoginError, formatRetryHotkeyPrompt, formatWechatIdeLoginRequiredError, getAutomatorCommandHelp, getConfig, getConfiguredLocale, getDefaultCliPath, handleConfigCommand, input, isAutomatorCommand, isAutomatorLoginError, isDevtoolsHttpPortError, isOperatingSystemSupported, isWeappIdeTopLevelCommand, isWechatIdeLoginRequiredError, launchAutomator, navigateBack, navigateTo, operatingSystemName, overwriteCustomConfig, pageData, pageStack, parse, parseAutomatorArgs, parseScreenshotArgs, printScreenshotHelp, promptForCliPath, reLaunch, readCustomConfig, readOptionValue, redirectTo, remote, removeCustomConfigKey, removeOption, resolveCliPath, resolvePath, runAutomatorCommand, runMinidev, runWechatCliWithRetry, scrollTo, startForwardConsole, switchTab, systemInfo, takeScreenshot, tap, transformArgv, validateWechatCliCommandArgs, waitForRetryKeypress, withMiniProgram };
|