@chatbi-v/cli 2.0.2 → 2.0.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.
Files changed (41) hide show
  1. package/bin/chatbi-cli.js +1 -2
  2. package/dist/index.d.ts +2 -0
  3. package/dist/index.js +2464 -188
  4. package/package.json +6 -3
  5. package/templates/app/package.json.hbs +5 -2
  6. package/templates/plugin/package.json.hbs +5 -5
  7. package/templates/plugin/tsconfig.json.hbs +1 -1
  8. package/dist/bench-ACSHVGHE.mjs +0 -77
  9. package/dist/build-UB4D3WNI.mjs +0 -11
  10. package/dist/chunk-4OD6C56P.mjs +0 -89
  11. package/dist/chunk-7A54IJI5.mjs +0 -6368
  12. package/dist/chunk-LJFX6MNO.mjs +0 -255
  13. package/dist/chunk-SBGVKO4C.mjs +0 -2255
  14. package/dist/chunk-TX5M36S5.mjs +0 -55
  15. package/dist/chunk-V7IEPMC4.mjs +0 -52
  16. package/dist/chunk-WCPZB47I.mjs +0 -262
  17. package/dist/chunk-WIVHOK75.mjs +0 -5292
  18. package/dist/chunk-Y24V4GQG.mjs +0 -9577
  19. package/dist/commands/add.js +0 -182
  20. package/dist/commands/bench.js +0 -100
  21. package/dist/commands/build.js +0 -290
  22. package/dist/commands/dev.js +0 -8
  23. package/dist/commands/discover.js +0 -25
  24. package/dist/commands/doctor.js +0 -231
  25. package/dist/commands/fetch.js +0 -41
  26. package/dist/commands/gl.js +0 -151
  27. package/dist/commands/init.js +0 -253
  28. package/dist/commands/install.js +0 -85
  29. package/dist/commands/ls.js +0 -46
  30. package/dist/commands/sync.js +0 -78
  31. package/dist/commands/use.js +0 -31
  32. package/dist/config.js +0 -70
  33. package/dist/corekit.js +0 -370
  34. package/dist/execa-METROS6Z.mjs +0 -17
  35. package/dist/fetch-7X2UFWIV.mjs +0 -10
  36. package/dist/index.cjs +0 -27278
  37. package/dist/index.mjs +0 -2769
  38. package/dist/init-QFRFYEA5.mjs +0 -12
  39. package/dist/sandbox.js +0 -522
  40. package/dist/sync-7HPKGVFY.mjs +0 -11
  41. package/dist/utils.js +0 -99
package/package.json CHANGED
@@ -1,8 +1,11 @@
1
1
  {
2
2
  "name": "@chatbi-v/cli",
3
- "version": "2.0.2",
3
+ "version": "2.0.4",
4
4
  "description": "Standardized CLI tooling for ChatBI Monorepo",
5
+ "type": "module",
5
6
  "main": "dist/index.js",
7
+ "module": "dist/index.js",
8
+ "types": "dist/index.d.ts",
6
9
  "bin": {
7
10
  "chatbi-cli": "./bin/chatbi-cli.js"
8
11
  },
@@ -43,8 +46,8 @@
43
46
  "vitest": "^1.0.0"
44
47
  },
45
48
  "scripts": {
46
- "build": "chatbi-cli build",
47
- "dev": "chatbi-cli build --watch",
49
+ "build": "tsup",
50
+ "dev": "tsup --watch",
48
51
  "test": "vitest"
49
52
  }
50
53
  }
@@ -12,8 +12,11 @@
12
12
  "dependencies": {
13
13
  "@ant-design/icons": "^5.2.6",
14
14
  "@ant-design/x": "^2.1.1",
15
- "@chatbi-v/core":"^2.0.2",
16
- "@chatbi-v/mocks":"^2.0.2",
15
+ "@chatbi-v/core": "2.0.4",
16
+ "@chatbi-v/mocks": "2.0.4",
17
+ "@chatbi-v/plugin-theme-manager": "2.0.4",
18
+ "@chatbi-v/plugin-layout-transform": "2.0.4",
19
+ "@chatbi-v/plugin-system-monitor": "2.0.4",
17
20
  "antd": "^5.29.3",
18
21
  "react": "^18.3.1",
19
22
  "react-dom": "^18.3.1",
@@ -21,14 +21,14 @@
21
21
  },
22
22
  "plugin": true,
23
23
  "peerDependencies": {
24
- "@chatbi-v/core": "^2.0.2",
24
+ "@chatbi-v/core": "^2.0.4",
25
25
  "antd": "^5.20.0",
26
- "react": "^18.3.1",
27
- "react-dom": "^18.3.1"
26
+ "react": ">=18.0.0",
27
+ "react-dom": ">=18.0.0"
28
28
  },
29
29
  "devDependencies": {
30
- "@chatbi-v/core": "^2.0.2",
31
- "@chatbi-v/tsconfig": "^2.0.2",
30
+ "@chatbi-v/core": "^2.0.4",
31
+ "@chatbi-v/tsconfig": "^2.0.4",
32
32
  "tsup": "^8.5.1",
33
33
  "vite": "^5.0.0"
34
34
  }
@@ -3,7 +3,7 @@
3
3
  "compilerOptions": {
4
4
  "outDir": "./dist",
5
5
  "rootDir": "./src",
6
- "moduleResolution": "node",
6
+ "moduleResolution": "bundler",
7
7
  "composite": true
8
8
  },
9
9
  "include": ["src"]
@@ -1,77 +0,0 @@
1
- import {
2
- createSpinner,
3
- logger,
4
- printBox,
5
- require_lib,
6
- require_picocolors
7
- } from "./chunk-Y24V4GQG.mjs";
8
- import {
9
- __toESM,
10
- init_esm_shims
11
- } from "./chunk-TX5M36S5.mjs";
12
-
13
- // src/commands/bench.ts
14
- init_esm_shims();
15
- var import_picocolors = __toESM(require_picocolors());
16
- var import_fs_extra = __toESM(require_lib());
17
- import path from "path";
18
- import os from "os";
19
- async function bench() {
20
- logger.info("\u6B63\u5728\u542F\u52A8 CLI \u6027\u80FD\u57FA\u51C6\u6D4B\u8BD5...");
21
- const results = [];
22
- const tmpDir = path.join(os.tmpdir(), `chatbi-bench-${Date.now()}`);
23
- await import_fs_extra.default.ensureDir(tmpDir);
24
- try {
25
- const initSpinner = createSpinner("\u6B63\u5728\u6D4B\u8BD5: \u521D\u59CB\u5316\u63D2\u4EF6\u9879\u76EE (init)...").start();
26
- const startInit = Date.now();
27
- const { init } = await import("./init-QFRFYEA5.mjs");
28
- const testProjDir = path.join(tmpDir, "bench-proj");
29
- await init({ name: "bench-proj", projectType: "plugin", cwd: tmpDir });
30
- const endInit = Date.now();
31
- const initTime = (endInit - startInit) / 1e3;
32
- initSpinner.succeed(`\u521D\u59CB\u5316\u5B8C\u6210: ${import_picocolors.default.cyan(initTime.toFixed(2) + "s")}`);
33
- results.push({
34
- scene: "\u521D\u59CB\u5316\u63D2\u4EF6\u9879\u76EE (init)",
35
- target: "\u2264 5.0 s",
36
- actual: `${initTime.toFixed(2)} s`
37
- });
38
- const syncSpinner = createSpinner("\u6B63\u5728\u6D4B\u8BD5: \u6C99\u7BB1\u73AF\u5883\u540C\u6B65 (sync)...").start();
39
- const startSync = Date.now();
40
- const { sync } = await import("./sync-7HPKGVFY.mjs");
41
- await sync({ cwd: testProjDir });
42
- const endSync = Date.now();
43
- const syncTime = (endSync - startSync) / 1e3;
44
- syncSpinner.succeed(`\u540C\u6B65\u5B8C\u6210: ${import_picocolors.default.cyan(syncTime.toFixed(2) + "s")}`);
45
- results.push({
46
- scene: "\u6C99\u7BB1\u73AF\u5883\u540C\u6B65 (sync)",
47
- target: "\u2264 2.0 s",
48
- actual: `${syncTime.toFixed(2)} s`
49
- });
50
- const buildSpinner = createSpinner("\u6B63\u5728\u6D4B\u8BD5: \u63D2\u4EF6\u9879\u76EE\u6784\u5EFA (build)...").start();
51
- const startBuild = Date.now();
52
- const { build } = await import("./build-UB4D3WNI.mjs");
53
- const originalCwd = process.cwd();
54
- process.chdir(testProjDir);
55
- await build({ watch: false });
56
- process.chdir(originalCwd);
57
- const endBuild = Date.now();
58
- const buildTime = (endBuild - startBuild) / 1e3;
59
- buildSpinner.succeed(`\u6784\u5EFA\u5B8C\u6210: ${import_picocolors.default.cyan(buildTime.toFixed(2) + "s")}`);
60
- results.push({
61
- scene: "\u63D2\u4EF6\u9879\u76EE\u6784\u5EFA (build)",
62
- target: "\u2264 10.0 s",
63
- actual: `${buildTime.toFixed(2)} s`
64
- });
65
- printBox(
66
- `${import_picocolors.default.green(import_picocolors.default.bold("\u2728 \u57FA\u51C6\u6D4B\u8BD5\u5B8C\u6210!"))}
67
-
68
- ` + results.map((r) => `${import_picocolors.default.white(r.scene.padEnd(20))}: ${import_picocolors.default.cyan(r.actual)} (\u76EE\u6807 ${r.target})`).join("\n"),
69
- "Benchmark Results"
70
- );
71
- } finally {
72
- await import_fs_extra.default.remove(tmpDir);
73
- }
74
- }
75
- export {
76
- bench
77
- };
@@ -1,11 +0,0 @@
1
- import {
2
- build
3
- } from "./chunk-WCPZB47I.mjs";
4
- import "./chunk-WIVHOK75.mjs";
5
- import "./chunk-7A54IJI5.mjs";
6
- import "./chunk-SBGVKO4C.mjs";
7
- import "./chunk-Y24V4GQG.mjs";
8
- import "./chunk-TX5M36S5.mjs";
9
- export {
10
- build
11
- };
@@ -1,89 +0,0 @@
1
- import {
2
- CoreKit
3
- } from "./chunk-WIVHOK75.mjs";
4
- import {
5
- Sandbox
6
- } from "./chunk-7A54IJI5.mjs";
7
- import {
8
- createSpinner,
9
- logger,
10
- printBox,
11
- require_lib,
12
- require_picocolors
13
- } from "./chunk-Y24V4GQG.mjs";
14
- import {
15
- __toESM,
16
- init_esm_shims
17
- } from "./chunk-TX5M36S5.mjs";
18
-
19
- // src/commands/sync.ts
20
- init_esm_shims();
21
- var import_fs_extra = __toESM(require_lib());
22
- var import_picocolors = __toESM(require_picocolors());
23
- import path from "path";
24
- async function sync(options = {}) {
25
- const cwd = options.cwd || process.cwd();
26
- const pkgPath = path.join(cwd, "package.json");
27
- if (!import_fs_extra.default.existsSync(pkgPath)) {
28
- logger.error("\u672A\u627E\u5230 package.json\u3002\u8BF7\u5728\u9879\u76EE\u6839\u76EE\u5F55\u4E0B\u8FD0\u884C\u3002");
29
- return;
30
- }
31
- const pkg = await import_fs_extra.default.readJson(pkgPath);
32
- let version = options.version;
33
- if (!version) {
34
- version = await CoreKit.resolveVersion(cwd);
35
- }
36
- if (options.clean) {
37
- const cleanSpinner = createSpinner(`\u6B63\u5728\u6E05\u7406\u6C99\u7BB1\u7248\u672C ${version}...`).start();
38
- await Sandbox.cleanVersion(version);
39
- cleanSpinner.succeed(`\u6C99\u7BB1\u7248\u672C ${version} \u5DF2\u6E05\u7406`);
40
- }
41
- const mainSpinner = createSpinner(`\u6B63\u5728\u540C\u6B65\u5185\u6838\u4F9D\u8D56 (\u7248\u672C: ${version})...`).start();
42
- mainSpinner.text = "\u6B63\u5728\u540C\u6B65\u6C99\u7BB1\u5185\u6838...";
43
- await Sandbox.prepare(version, options.force);
44
- mainSpinner.text = "\u6B63\u5728\u751F\u6210\u865A\u62DF\u4E0A\u4E0B\u6587...";
45
- if (options.version) {
46
- const versionFilePath = path.join(cwd, ".chatbi-version");
47
- await import_fs_extra.default.writeFile(versionFilePath, version, "utf-8");
48
- }
49
- await Sandbox.injectContext(cwd, version);
50
- let modified = false;
51
- const deps = pkg.dependencies || {};
52
- const devDeps = pkg.devDependencies || {};
53
- const isVirtualMode = true;
54
- if (isVirtualMode) {
55
- for (const pkgName of Sandbox.CORE_PACKAGES) {
56
- if (deps[pkgName]) {
57
- delete deps[pkgName];
58
- modified = true;
59
- }
60
- if (devDeps[pkgName]) {
61
- delete devDeps[pkgName];
62
- modified = true;
63
- }
64
- }
65
- }
66
- if (modified) {
67
- pkg.dependencies = deps;
68
- pkg.devDependencies = devDeps;
69
- await import_fs_extra.default.writeJson(pkgPath, pkg, { spaces: 2 });
70
- mainSpinner.succeed("\u5185\u6838\u540C\u6B65\u5B8C\u6210 (\u4F9D\u8D56\u5DF2\u4F18\u5316)");
71
- } else {
72
- mainSpinner.succeed("\u5185\u6838\u540C\u6B65\u5B8C\u6210");
73
- }
74
- if (!options.silent) {
75
- printBox(
76
- `${import_picocolors.default.green(import_picocolors.default.bold("\u2728 \u5185\u6838\u540C\u6B65\u6210\u529F!"))}
77
-
78
- ${import_picocolors.default.white("\u5F53\u524D\u7248\u672C: ")} ${import_picocolors.default.cyan(version)}
79
- ${import_picocolors.default.white("\u6C99\u7BB1\u8DEF\u5F84: ")} ${import_picocolors.default.gray(Sandbox.getVersionPath(version))}
80
-
81
- ${import_picocolors.default.white("\u63D0\u793A: ")} \u9879\u76EE\u73B0\u5728\u901A\u8FC7\u865A\u62DF\u522B\u540D\u5F15\u7528\u6838\u5FC3\u5305\uFF0C\u65E0\u9700\u663E\u5F0F\u5B89\u88C5\u4F9D\u8D56\u3002`,
82
- "Sync Success"
83
- );
84
- }
85
- }
86
-
87
- export {
88
- sync
89
- };