@botim/botim-cli 0.1.2 → 0.1.4

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,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  {const _origEmit=process.emit;process.emit=function(n,d,...a){if(n==='warning'&&d&&d.name==='DeprecationWarning')return false;return _origEmit.call(process,n,d,...a);};}
3
3
  import { Command } from "commander";
4
- import { createReactApp, createVueApp, handleLogin, handleLogout, handleQRCode } from "./commands/index.js";
4
+ import { createReactApp, createVueApp, handleLogin, handleLogout, handleQRCode, analyzeBuild } from "./commands/index.js";
5
5
  import { showMenuOrRequireAuth } from "./commands/auth/index.js";
6
6
  import { displayExamples, displayQuickStart } from "./utils/help.js";
7
7
  import { logger, displayErrorSync } from "./utils/logger.js";
@@ -45,7 +45,7 @@ async function promptSelect(options) {
45
45
  process.stdin.removeListener("keypress", onKeypress);
46
46
  }
47
47
  }
48
- const version = "0.1.2";
48
+ const version = "0.1.4";
49
49
  let updateInfo = null;
50
50
  function displayUpdateBanner(info) {
51
51
  if (!info.updateAvailable) return;
@@ -731,6 +731,15 @@ To view full log: cat ${logPath}
731
731
  console.log(chalk.yellow("No log file found yet. Logs will be created when you run commands.\n"));
732
732
  }
733
733
  });
734
+ program.command("analyze-build").description("Analyze build output: sizes, chunks, images, fonts, unused code (beta)").alias("analyze").option("--dir <path>", "Custom build directory path").option("--json", "Output as JSON").action(async (options) => {
735
+ if (!options.json) {
736
+ console.log(chalk.cyan.bold(`
737
+ \u{1F4CA} Botim CLI v${version} - Build Analyzer`) + chalk.yellow.bold(` [BETA]`) + "\n");
738
+ console.log(chalk.gray(" Note: This feature is in beta. Results are estimates and may not be 100% accurate."));
739
+ console.log(chalk.gray(" Feedback? Open an issue at https://github.com/anthropics/claude-code/issues\n"));
740
+ }
741
+ await analyzeBuild(options);
742
+ });
734
743
  program.on("command:*", function() {
735
744
  console.error(chalk.red("\n\u274C Invalid command: %s\n"), program.args.join(" "));
736
745
  console.log(chalk.gray("Run --help to see available commands\n"));
@@ -785,6 +794,7 @@ async function showMainMenu() {
785
794
  const updateChoice = updateInfo?.updateAvailable ? [{ name: `\u2B06\uFE0F Update available (${chalk.gray(updateInfo.currentVersion)} \u2192 ${chalk.green(updateInfo.latestVersion)})`, value: "update" }] : [];
786
795
  const unauthenticatedChoices = [
787
796
  { name: "\u{1F4F1} Create a Mini-Program Template (Local)", value: "mini-program" },
797
+ { name: "\u{1F4CA} Analyze Build (Beta)", value: "analyze-build" },
788
798
  { name: "\u{1F510} Login", value: "login" },
789
799
  { name: "\u{1F504} Switch Environment", value: "switch-env" },
790
800
  { name: "\u{1F4CA} View Status", value: "status" },
@@ -796,6 +806,7 @@ async function showMainMenu() {
796
806
  authenticatedChoices = [
797
807
  ...authenticatedChoices,
798
808
  { name: "\u{1F4F1} Create a Mini-Program Template (Local)", value: "mini-program" },
809
+ { name: "\u{1F4CA} Analyze Build (Beta)", value: "analyze-build" },
799
810
  { name: "\u{1F504} Switch Environment", value: "switch-env" },
800
811
  { name: "\u{1F465} Switch Team", value: "switch-partner" },
801
812
  { name: "\u{1F4CA} View Status", value: "status" },
@@ -829,6 +840,11 @@ async function showMainMenu() {
829
840
  process.exit(1);
830
841
  }
831
842
  }
843
+ } else if (action === "analyze-build") {
844
+ console.log(chalk.cyan.bold(`
845
+ \u{1F4CA} Botim CLI v${version} - Build Analyzer
846
+ `));
847
+ await analyzeBuild({});
832
848
  } else if (action === "mini-program") {
833
849
  const framework = await promptSelect({
834
850
  message: "Select a framework template:",