@botim/botim-cli 0.0.5 → 0.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/dist/cli.js CHANGED
@@ -1,16 +1,25 @@
1
1
  #!/usr/bin/env node
2
+ {
3
+ const origEmit = process.emit;
4
+ process.emit = function(name, data, ...args) {
5
+ if (name === "warning" && data && data.name === "DeprecationWarning") {
6
+ return false;
7
+ }
8
+ return origEmit.call(process, name, data, ...args);
9
+ };
10
+ }
2
11
  import { Command } from "commander";
3
12
  import { createReactApp, createVueApp, handleLogin, handleLogout, handleQRCode } from "./commands/index.js";
4
13
  import { showMenuOrRequireAuth } from "./commands/auth/index.js";
5
14
  import { displayExamples, displayQuickStart } from "./utils/help.js";
6
- import { logger } from "./utils/logger.js";
15
+ import { logger, displayErrorSync } from "./utils/logger.js";
7
16
  import { isLoggedIn, getCurrentEnvironment, setCurrentEnvironment, getAllEnvironmentStatus } from "./utils/config.js";
8
17
  import { setRuntimeEnvironment, parseEnvironment, getEnvironmentDisplayName } from "./utils/environment.js";
9
18
  import { executeWithAuthRetry } from "./utils/auth-handler.js";
10
19
  import chalk from "chalk";
11
20
  import fs from "fs-extra";
12
21
  import path from "path";
13
- const version = "0.0.5";
22
+ const version = "0.0.7";
14
23
  const program = new Command();
15
24
  program.name("botim-cli").description("CLI tool to generate boilerplate code for React and Vue applications").version(version, "-v, --version", "Output the current version").option("--env <environment>", "Target environment: prod, uat, or beta (overrides default)", (value) => {
16
25
  const env = parseEnvironment(value);
@@ -127,7 +136,7 @@ program.command("status").description("Show login status for all environments").
127
136
  program.command("auth").description("Access authenticated commands (requires login)").alias("authenticated").action(async () => {
128
137
  await showMenuOrRequireAuth();
129
138
  });
130
- program.command("create-mp-app").description("Create a new Mini-Program app non-interactively (requires authentication)").alias("cmp").requiredOption("--projectName <name>", "Project folder name").option("--framework <framework>", "Template framework: react or vue", "react").option("--title <title>", "App title (default: derived from projectName)").option("--domainPrefix <prefix>", "Domain prefix (default: auto-selected)").option("--reviewNote <note>", "Review note for submission (default: auto-generated)").option("--creatorType <type>", "Creator type: hybrid or h5bridge", "hybrid").option("--website <url>", "Website URL (required if creatorType=h5bridge)").option("--shareText <text>", "Share card description (default: same as title)").option("--screenOrientation <orientation>", "Screen mode: fullscreen, immersive, or standard", "fullscreen").option("--apiLevel <version>", "API level version (default: latest available)").option("--audience <audience>", "Audience: 1=Private or 2=Public", "2").addHelpText("after", `
139
+ program.command("create-mp-app").description("Create a new Mini-Program app non-interactively (requires authentication)").alias("cmp").requiredOption("--projectName <name>", "Project folder name").option("--framework <framework>", "Template framework: react or vue", "react").option("--title <title>", "App title (default: derived from projectName)").option("--domainPrefix <prefix>", "Domain prefix (default: auto-selected)").option("--reviewNote <note>", "Review note for submission (default: auto-generated)").option("--creatorType <type>", "Creator type: hybrid or h5bridge", "hybrid").option("--website <url>", "Website URL (required if creatorType=h5bridge)").option("--shareText <text>", "Share card description (default: same as title)").option("--screenOrientation <orientation>", "Screen mode: fullscreen, immersive, or standard", "fullscreen").option("--apiLevel <version>", "API level version (default: latest available)").option("--audience <audience>", "Audience: 1=Public or 2=Private", "1").addHelpText("after", `
131
140
 
132
141
  Examples:
133
142
  Basic usage with minimal options:
@@ -174,8 +183,8 @@ Screen Orientations:
174
183
  standard - Standard page with title bar
175
184
 
176
185
  Audience Options:
177
- 1 - Private (only accessible to specific users)
178
- 2 - Public (accessible to all users) (default)
186
+ 1 - Public (accessible to all users) (default)
187
+ 2 - Private (only accessible to specific users)
179
188
  `).action(async (options) => {
180
189
  try {
181
190
  const loggedIn = await isLoggedIn();
@@ -201,6 +210,7 @@ Audience Options:
201
210
  }
202
211
  } catch (error) {
203
212
  logger.error("create-mp-app command failed", error);
213
+ displayErrorSync(error, "Create MP App failed");
204
214
  process.exit(1);
205
215
  }
206
216
  });
@@ -225,6 +235,7 @@ program.command("init-mp-app").description("Initialize MP app in current directo
225
235
  }
226
236
  } catch (error) {
227
237
  logger.error("init-mp-app command failed", error);
238
+ displayErrorSync(error, "Init MP App failed");
228
239
  process.exit(1);
229
240
  }
230
241
  });
@@ -249,6 +260,7 @@ program.command("deploy-mp-app").description("Deploy MP app to server (requires
249
260
  }
250
261
  } catch (error) {
251
262
  logger.error("deploy-mp-app command failed", error);
263
+ displayErrorSync(error, "Deployment failed");
252
264
  process.exit(1);
253
265
  }
254
266
  });
@@ -273,6 +285,7 @@ program.command("debug-mp-app").description("Debug MP app (requires authenticati
273
285
  }
274
286
  } catch (error) {
275
287
  logger.error("debug-mp-app command failed", error);
288
+ displayErrorSync(error, "Debug MP App failed");
276
289
  process.exit(1);
277
290
  }
278
291
  });
@@ -297,6 +310,7 @@ program.command("list-mp-permissions [app-id]").description("List permissions fo
297
310
  }
298
311
  } catch (error) {
299
312
  logger.error("list-mp-permissions command failed", error);
313
+ displayErrorSync(error, "List MP Permissions failed");
300
314
  process.exit(1);
301
315
  }
302
316
  });
@@ -586,6 +600,7 @@ async function showMainMenu() {
586
600
  );
587
601
  } catch (error) {
588
602
  logger.error("Command execution failed", error);
603
+ displayErrorSync(error, "Command failed");
589
604
  process.exit(1);
590
605
  }
591
606
  }