@chatbi-v/cli 2.1.7 → 2.1.9
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/index.js +102 -30
- package/package.json +5 -2
- package/templates/app/README.md.hbs +1 -1
- package/templates/app/{chatbi.config.ts.hbs → app.config.ts.hbs} +1 -1
- package/templates/app/package.json.hbs +4 -4
- package/templates/app/src/hooks/usePluginLoader.ts.hbs +3 -3
- package/templates/app/src/index.css.hbs +19 -19
- package/templates/app/src/services/config-service.ts.hbs +1 -1
- package/templates/app/src/stores/useUIStore.ts.hbs +1 -1
- package/templates/app/tsconfig.json.hbs +1 -1
- package/templates/monorepo/package.json.hbs +7 -5
- package/templates/monorepo/pnpm-workspace.yaml.hbs +2 -2
- package/templates/monorepo/tsconfig.json.hbs +1 -1
- package/templates/plugin/README.md.hbs +1 -1
- package/templates/plugin/package.json.hbs +3 -3
- package/templates/plugin/tsconfig.json.hbs +1 -1
- package/templates/sandbox/pnpm-workspace.yaml.hbs +3 -0
package/dist/index.js
CHANGED
|
@@ -77,13 +77,15 @@ var init_constants = __esm({
|
|
|
77
77
|
|
|
78
78
|
// src/utils.ts
|
|
79
79
|
import boxen from "boxen";
|
|
80
|
+
import { execa } from "execa";
|
|
80
81
|
import fs from "fs-extra";
|
|
81
82
|
import { createRequire } from "module";
|
|
83
|
+
import os2 from "os";
|
|
82
84
|
import ora from "ora";
|
|
83
85
|
import path3 from "path";
|
|
84
86
|
import pc from "picocolors";
|
|
85
87
|
import { fileURLToPath as fileURLToPath2 } from "url";
|
|
86
|
-
var _require, _filename, _dirname, logger, createSpinner, printBox, findPackageRoot, getCliRoot;
|
|
88
|
+
var _require, _filename, _dirname, UPDATE_CHECK_INTERVAL, CACHE_DIR, CACHE_FILE, logger, createSpinner, printBox, findPackageRoot, getCliRoot, checkForUpdates, printUpdateNotification;
|
|
87
89
|
var init_utils = __esm({
|
|
88
90
|
"src/utils.ts"() {
|
|
89
91
|
"use strict";
|
|
@@ -91,6 +93,9 @@ var init_utils = __esm({
|
|
|
91
93
|
_require = createRequire(import.meta.url);
|
|
92
94
|
_filename = fileURLToPath2(import.meta.url);
|
|
93
95
|
_dirname = path3.dirname(_filename);
|
|
96
|
+
UPDATE_CHECK_INTERVAL = 1e3 * 60 * 60 * 24;
|
|
97
|
+
CACHE_DIR = path3.join(os2.homedir(), ".chatbi-v-core");
|
|
98
|
+
CACHE_FILE = path3.join(CACHE_DIR, ".update-check.json");
|
|
94
99
|
logger = {
|
|
95
100
|
info: (msg) => console.log(pc.cyan(`\u2139 ${msg}`)),
|
|
96
101
|
success: (msg) => console.log(pc.green(`\u2714 ${msg}`)),
|
|
@@ -156,6 +161,47 @@ var init_utils = __esm({
|
|
|
156
161
|
}
|
|
157
162
|
return myCliRoot;
|
|
158
163
|
};
|
|
164
|
+
checkForUpdates = async (currentVersion) => {
|
|
165
|
+
try {
|
|
166
|
+
await fs.ensureDir(CACHE_DIR);
|
|
167
|
+
let cache = { lastCheck: 0, latestVersion: currentVersion };
|
|
168
|
+
if (fs.existsSync(CACHE_FILE)) {
|
|
169
|
+
cache = await fs.readJson(CACHE_FILE);
|
|
170
|
+
}
|
|
171
|
+
const now = Date.now();
|
|
172
|
+
if (now - cache.lastCheck > UPDATE_CHECK_INTERVAL) {
|
|
173
|
+
execa("npm", ["view", "@chatbi-v/cli", "version"]).then(async ({ stdout }) => {
|
|
174
|
+
const latest = stdout.trim();
|
|
175
|
+
await fs.writeJson(CACHE_FILE, {
|
|
176
|
+
lastCheck: now,
|
|
177
|
+
latestVersion: latest
|
|
178
|
+
});
|
|
179
|
+
}).catch(() => {
|
|
180
|
+
});
|
|
181
|
+
}
|
|
182
|
+
if (cache.latestVersion && cache.latestVersion !== currentVersion) {
|
|
183
|
+
const isNewer = cache.latestVersion.localeCompare(currentVersion, void 0, { numeric: true }) > 0;
|
|
184
|
+
if (isNewer) {
|
|
185
|
+
return cache.latestVersion;
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
} catch (e) {
|
|
189
|
+
}
|
|
190
|
+
return null;
|
|
191
|
+
};
|
|
192
|
+
printUpdateNotification = (current, latest) => {
|
|
193
|
+
const message = `\u66F4\u65B0\u53EF\u7528 ${pc.gray(current)} \u2192 ${pc.green(latest)}
|
|
194
|
+
\u8FD0\u884C ${pc.cyan("npm install -g @chatbi-v/cli")} \u5373\u53EF\u66F4\u65B0`;
|
|
195
|
+
console.log(
|
|
196
|
+
boxen(message, {
|
|
197
|
+
padding: 1,
|
|
198
|
+
margin: { top: 1, bottom: 1 },
|
|
199
|
+
align: "center",
|
|
200
|
+
borderColor: "yellow",
|
|
201
|
+
borderStyle: "round"
|
|
202
|
+
})
|
|
203
|
+
);
|
|
204
|
+
};
|
|
159
205
|
}
|
|
160
206
|
});
|
|
161
207
|
|
|
@@ -685,7 +731,7 @@ var init_SandboxPkgManager = __esm({
|
|
|
685
731
|
});
|
|
686
732
|
|
|
687
733
|
// src/sandbox.ts
|
|
688
|
-
import { execa } from "execa";
|
|
734
|
+
import { execa as execa2 } from "execa";
|
|
689
735
|
import fg2 from "fast-glob";
|
|
690
736
|
import fs8 from "fs-extra";
|
|
691
737
|
import path10 from "path";
|
|
@@ -847,13 +893,13 @@ var init_sandbox = __esm({
|
|
|
847
893
|
versionPath,
|
|
848
894
|
templateData
|
|
849
895
|
);
|
|
896
|
+
spinner.text = pc4.gray(" \u{1F3A8} \u540C\u6B65 Shell \u6A21\u677F...");
|
|
897
|
+
await this.ensureShell(version, force);
|
|
850
898
|
spinner.text = pc4.gray(" \u{1F50D} \u68C0\u67E5\u672C\u5730\u5F00\u53D1\u73AF\u5883...");
|
|
851
899
|
const isLocalDev = await SandboxPkgManager.tryLinkLocalPackages(versionPath, this.CORE_PACKAGES, this.RUNTIME_DEPS);
|
|
852
900
|
const installArgs = isLocalDev ? ["install", "--no-frozen-lockfile"] : ["install"];
|
|
853
901
|
spinner.text = pc4.gray(` \u23F3 \u6267\u884C pnpm ${installArgs.join(" ")}...`);
|
|
854
|
-
await
|
|
855
|
-
spinner.text = pc4.gray(" \u{1F3A8} \u540C\u6B65 Shell \u6A21\u677F...");
|
|
856
|
-
await this.ensureShell(version, force);
|
|
902
|
+
await execa2("pnpm", installArgs, { cwd: versionPath });
|
|
857
903
|
spinner.succeed(pc4.green(`\u5185\u6838\u6C99\u7BB1 ${version} \u521D\u59CB\u5316\u6210\u529F`));
|
|
858
904
|
} catch (e) {
|
|
859
905
|
spinner.fail(pc4.red(`\u5185\u6838\u6C99\u7BB1\u521D\u59CB\u5316\u5931\u8D25: ${e.message}`));
|
|
@@ -1113,7 +1159,7 @@ ${pc5.gray("Root: ")} ${pc5.white(cwd)}`,
|
|
|
1113
1159
|
logger.info("\u5DF2\u53D6\u6D88");
|
|
1114
1160
|
return;
|
|
1115
1161
|
}
|
|
1116
|
-
await this.startAppDevServer(response.appPath, version, customPort);
|
|
1162
|
+
await this.startAppDevServer(response.appPath, version, customPort, true);
|
|
1117
1163
|
}
|
|
1118
1164
|
/**
|
|
1119
1165
|
* 启动插件开发服务器 (Hosted Mode)
|
|
@@ -1207,12 +1253,16 @@ ${pc5.white("Local: ")} ${pc5.cyan(pc5.underline(localUrl))}`,
|
|
|
1207
1253
|
/**
|
|
1208
1254
|
* 启动应用开发服务器 (Integrated Mode)
|
|
1209
1255
|
*/
|
|
1210
|
-
static async startAppDevServer(appDir, version, customPort) {
|
|
1256
|
+
static async startAppDevServer(appDir, version, customPort, isMonorepo = false) {
|
|
1211
1257
|
logger.info("\u6B63\u5728\u542F\u52A8\u5E94\u7528...");
|
|
1212
1258
|
const versionPath = Sandbox.getVersionPath(version);
|
|
1213
1259
|
const sandboxNodeModules = path11.join(versionPath, "node_modules");
|
|
1214
|
-
const
|
|
1215
|
-
const
|
|
1260
|
+
const pkgPath = path11.join(appDir, "package.json");
|
|
1261
|
+
const pkg = await fs9.readJson(pkgPath).catch(() => ({}));
|
|
1262
|
+
const hasCoreDep = pkg.dependencies?.["@chatbi-v/core"] || pkg.devDependencies?.["@chatbi-v/core"];
|
|
1263
|
+
const shouldUseSandboxAlias = !(isMonorepo && hasCoreDep);
|
|
1264
|
+
const coreAlias = shouldUseSandboxAlias ? Sandbox.getCoreAlias(version) : {};
|
|
1265
|
+
const { createServer, loadConfigFromFile, searchForWorkspaceRoot } = await import("vite");
|
|
1216
1266
|
try {
|
|
1217
1267
|
const configContext = { command: "serve", mode: "development" };
|
|
1218
1268
|
const userConfig = await loadConfigFromFile(configContext, void 0, appDir).catch(() => null);
|
|
@@ -1224,9 +1274,12 @@ ${pc5.white("Local: ")} ${pc5.cyan(pc5.underline(localUrl))}`,
|
|
|
1224
1274
|
alias: {
|
|
1225
1275
|
...coreAlias,
|
|
1226
1276
|
// 补充常用的基础依赖映射,防止用户 vite.config.ts 中的插件找不到依赖
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1277
|
+
// 只有在需要使用沙箱时才注入 React Alias
|
|
1278
|
+
...shouldUseSandboxAlias ? {
|
|
1279
|
+
"react": path11.join(sandboxNodeModules, "react"),
|
|
1280
|
+
"react-dom": path11.join(sandboxNodeModules, "react-dom"),
|
|
1281
|
+
"@vitejs/plugin-react": path11.join(sandboxNodeModules, "@vitejs/plugin-react")
|
|
1282
|
+
} : {}
|
|
1230
1283
|
}
|
|
1231
1284
|
},
|
|
1232
1285
|
server: {
|
|
@@ -1242,6 +1295,7 @@ ${pc5.white("Local: ")} ${pc5.cyan(pc5.underline(localUrl))}`,
|
|
|
1242
1295
|
},
|
|
1243
1296
|
fs: {
|
|
1244
1297
|
allow: [
|
|
1298
|
+
searchForWorkspaceRoot(appDir),
|
|
1245
1299
|
Sandbox.getRoot(),
|
|
1246
1300
|
appDir,
|
|
1247
1301
|
// 允许访问沙箱中的所有依赖
|
|
@@ -1271,7 +1325,7 @@ var build_exports = {};
|
|
|
1271
1325
|
__export(build_exports, {
|
|
1272
1326
|
build: () => build
|
|
1273
1327
|
});
|
|
1274
|
-
import { execa as
|
|
1328
|
+
import { execa as execa3 } from "execa";
|
|
1275
1329
|
import fs10 from "fs-extra";
|
|
1276
1330
|
import path12 from "path";
|
|
1277
1331
|
import pc6 from "picocolors";
|
|
@@ -1331,7 +1385,7 @@ async function build(options) {
|
|
|
1331
1385
|
if (options.watch) {
|
|
1332
1386
|
args.push("--", "--watch");
|
|
1333
1387
|
}
|
|
1334
|
-
await
|
|
1388
|
+
await execa3("npm", args, {
|
|
1335
1389
|
stdio: "inherit",
|
|
1336
1390
|
env: { ...process.env, CHATBI_CLI_INTERNAL: "true" }
|
|
1337
1391
|
});
|
|
@@ -1341,7 +1395,7 @@ async function build(options) {
|
|
|
1341
1395
|
const mode = await CoreKit.detectMode(cwd);
|
|
1342
1396
|
if (mode === "monorepo") {
|
|
1343
1397
|
logger.info("\u68C0\u6D4B\u5230 Monorepo \u9879\u76EE\uFF0C\u6B63\u5728\u9012\u5F52\u6784\u5EFA\u5B50\u5305...");
|
|
1344
|
-
await
|
|
1398
|
+
await execa3("pnpm", ["-r", "build"], { stdio: "inherit", cwd });
|
|
1345
1399
|
return;
|
|
1346
1400
|
}
|
|
1347
1401
|
if (mode === "app") {
|
|
@@ -1495,15 +1549,15 @@ async function build(options) {
|
|
|
1495
1549
|
tscBin = sandboxTsc;
|
|
1496
1550
|
} else {
|
|
1497
1551
|
if (fs10.existsSync(path12.join(cwd, "pnpm-lock.yaml"))) {
|
|
1498
|
-
await
|
|
1552
|
+
await execa3("pnpm", ["exec", "tsc", "--build", "tsconfig.json"]);
|
|
1499
1553
|
dtsSpinner.succeed("\u7C7B\u578B\u5B9A\u4E49\u751F\u6210\u5B8C\u6210");
|
|
1500
1554
|
} else {
|
|
1501
|
-
await
|
|
1555
|
+
await execa3("npx", ["-p", "typescript", "tsc", "--build", "tsconfig.json"]);
|
|
1502
1556
|
dtsSpinner.succeed("\u7C7B\u578B\u5B9A\u4E49\u751F\u6210\u5B8C\u6210");
|
|
1503
1557
|
}
|
|
1504
1558
|
}
|
|
1505
1559
|
if (tscBin !== "tsc") {
|
|
1506
|
-
await
|
|
1560
|
+
await execa3(tscBin, ["--build", "tsconfig.json"]);
|
|
1507
1561
|
dtsSpinner.succeed("\u7C7B\u578B\u5B9A\u4E49\u751F\u6210\u5B8C\u6210");
|
|
1508
1562
|
}
|
|
1509
1563
|
} catch (e) {
|
|
@@ -1611,7 +1665,7 @@ var fetch_exports = {};
|
|
|
1611
1665
|
__export(fetch_exports, {
|
|
1612
1666
|
fetch: () => fetch
|
|
1613
1667
|
});
|
|
1614
|
-
import { execa as
|
|
1668
|
+
import { execa as execa4 } from "execa";
|
|
1615
1669
|
import path15 from "path";
|
|
1616
1670
|
import pc10 from "picocolors";
|
|
1617
1671
|
async function fetch(version, options = {}) {
|
|
@@ -1622,7 +1676,7 @@ async function fetch(version, options = {}) {
|
|
|
1622
1676
|
const packSpinner = createSpinner("\u6B63\u5728\u6253\u5305\u79BB\u7EBF\u8D44\u6E90...").start();
|
|
1623
1677
|
const tgzName = `chatbi-core-${version}.tgz`;
|
|
1624
1678
|
const tgzPath = path15.resolve(process.cwd(), tgzName);
|
|
1625
|
-
await
|
|
1679
|
+
await execa4("tar", [
|
|
1626
1680
|
"-czf",
|
|
1627
1681
|
tgzPath,
|
|
1628
1682
|
"-C",
|
|
@@ -1865,13 +1919,13 @@ __export(bench_exports, {
|
|
|
1865
1919
|
bench: () => bench
|
|
1866
1920
|
});
|
|
1867
1921
|
import fs17 from "fs-extra";
|
|
1868
|
-
import
|
|
1922
|
+
import os3 from "os";
|
|
1869
1923
|
import path20 from "path";
|
|
1870
1924
|
import pc15 from "picocolors";
|
|
1871
1925
|
async function bench() {
|
|
1872
1926
|
logger.info("\u6B63\u5728\u542F\u52A8 CLI \u6027\u80FD\u57FA\u51C6\u6D4B\u8BD5...");
|
|
1873
1927
|
const results = [];
|
|
1874
|
-
const tmpDir = path20.join(
|
|
1928
|
+
const tmpDir = path20.join(os3.tmpdir(), `chatbi-bench-${Date.now()}`);
|
|
1875
1929
|
await fs17.ensureDir(tmpDir);
|
|
1876
1930
|
try {
|
|
1877
1931
|
const initSpinner = createSpinner("\u6B63\u5728\u6D4B\u8BD5: \u521D\u59CB\u5316\u63D2\u4EF6\u9879\u76EE (init)...").start();
|
|
@@ -1943,14 +1997,17 @@ import pc16 from "picocolors";
|
|
|
1943
1997
|
// package.json
|
|
1944
1998
|
var package_default = {
|
|
1945
1999
|
name: "@chatbi-v/cli",
|
|
1946
|
-
version: "2.1.
|
|
2000
|
+
version: "2.1.9",
|
|
1947
2001
|
description: "Standardized CLI tooling for ChatBI Monorepo",
|
|
1948
2002
|
type: "module",
|
|
1949
2003
|
main: "dist/index.js",
|
|
1950
2004
|
module: "dist/index.js",
|
|
1951
2005
|
types: "dist/index.d.ts",
|
|
1952
2006
|
exports: {
|
|
1953
|
-
".":
|
|
2007
|
+
".": {
|
|
2008
|
+
types: "./dist/index.d.ts",
|
|
2009
|
+
import: "./dist/index.js"
|
|
2010
|
+
},
|
|
1954
2011
|
"./package.json": "./package.json"
|
|
1955
2012
|
},
|
|
1956
2013
|
bin: {
|
|
@@ -2202,8 +2259,8 @@ async function doctor(options = {}) {
|
|
|
2202
2259
|
logger.success(`Node.js \u7248\u672C: ${nodeVersion}`);
|
|
2203
2260
|
}
|
|
2204
2261
|
try {
|
|
2205
|
-
const { execa:
|
|
2206
|
-
const { stdout: pnpmVer } = await
|
|
2262
|
+
const { execa: execa7 } = await import("execa");
|
|
2263
|
+
const { stdout: pnpmVer } = await execa7("pnpm", ["-v"]);
|
|
2207
2264
|
logger.success(`pnpm \u7248\u672C: ${pnpmVer}`);
|
|
2208
2265
|
} catch (e) {
|
|
2209
2266
|
logger.warn("\u672A\u68C0\u6D4B\u5230 pnpm\uFF0C\u5EFA\u8BAE\u5B89\u88C5\u4EE5\u83B7\u5F97\u6700\u4F73\u4F53\u9A8C");
|
|
@@ -2362,7 +2419,7 @@ init_fetch();
|
|
|
2362
2419
|
// src/commands/gl.ts
|
|
2363
2420
|
init_esm_shims();
|
|
2364
2421
|
init_utils();
|
|
2365
|
-
import { execa as
|
|
2422
|
+
import { execa as execa5 } from "execa";
|
|
2366
2423
|
import fs13 from "fs-extra";
|
|
2367
2424
|
import path16 from "path";
|
|
2368
2425
|
import pc11 from "picocolors";
|
|
@@ -2453,7 +2510,7 @@ If not, use the SLOT_REQUIRED format.`.trim();
|
|
|
2453
2510
|
while (retry) {
|
|
2454
2511
|
spinner.start();
|
|
2455
2512
|
try {
|
|
2456
|
-
const { stdout } = await
|
|
2513
|
+
const { stdout } = await execa5("gemini", [geminiCmd, currentPrompt], {
|
|
2457
2514
|
stdio: "pipe"
|
|
2458
2515
|
});
|
|
2459
2516
|
spinner.stop();
|
|
@@ -2511,7 +2568,7 @@ init_init();
|
|
|
2511
2568
|
init_esm_shims();
|
|
2512
2569
|
init_sandbox();
|
|
2513
2570
|
init_utils();
|
|
2514
|
-
import { execa as
|
|
2571
|
+
import { execa as execa6 } from "execa";
|
|
2515
2572
|
import fs15 from "fs-extra";
|
|
2516
2573
|
import path18 from "path";
|
|
2517
2574
|
import pc13 from "picocolors";
|
|
@@ -2532,7 +2589,7 @@ async function install(target) {
|
|
|
2532
2589
|
const versionRoot = Sandbox.getVersionRoot();
|
|
2533
2590
|
await fs15.ensureDir(versionRoot);
|
|
2534
2591
|
spinner.text = "\u6B63\u5728\u89E3\u538B\u6587\u4EF6...";
|
|
2535
|
-
await
|
|
2592
|
+
await execa6("tar", ["-xzf", tgzPath, "-C", versionRoot]);
|
|
2536
2593
|
spinner.succeed(`\u672C\u5730\u5305\u5DF2\u5B89\u88C5\u81F3\u6C99\u7BB1: ${version}`);
|
|
2537
2594
|
spinner.text = "\u6B63\u5728\u51C6\u5907\u5185\u6838\u73AF\u5883...";
|
|
2538
2595
|
await Sandbox.prepare(version);
|
|
@@ -2640,12 +2697,18 @@ var showHeader = () => {
|
|
|
2640
2697
|
};
|
|
2641
2698
|
var wrapAction = (action, commandName) => {
|
|
2642
2699
|
return async (...args) => {
|
|
2700
|
+
const updateCheckPromise = checkForUpdates(package_default.version);
|
|
2643
2701
|
showHeader();
|
|
2644
2702
|
try {
|
|
2645
2703
|
await action(...args);
|
|
2646
2704
|
} catch (e) {
|
|
2647
2705
|
logger.error(`${commandName} \u6267\u884C\u5931\u8D25`, e);
|
|
2648
2706
|
process.exit(1);
|
|
2707
|
+
} finally {
|
|
2708
|
+
const latestVersion = await updateCheckPromise;
|
|
2709
|
+
if (latestVersion) {
|
|
2710
|
+
printUpdateNotification(package_default.version, latestVersion);
|
|
2711
|
+
}
|
|
2649
2712
|
}
|
|
2650
2713
|
};
|
|
2651
2714
|
};
|
|
@@ -2701,3 +2764,12 @@ if (process.argv.length <= 2) {
|
|
|
2701
2764
|
} else {
|
|
2702
2765
|
cli.parse();
|
|
2703
2766
|
}
|
|
2767
|
+
var main = async () => {
|
|
2768
|
+
if (process.argv.includes("--help") || process.argv.includes("-h") || process.argv.includes("--version") || process.argv.includes("-v")) {
|
|
2769
|
+
const latestVersion = await checkForUpdates(package_default.version);
|
|
2770
|
+
if (latestVersion) {
|
|
2771
|
+
printUpdateNotification(package_default.version, latestVersion);
|
|
2772
|
+
}
|
|
2773
|
+
}
|
|
2774
|
+
};
|
|
2775
|
+
main();
|
package/package.json
CHANGED
|
@@ -1,13 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@chatbi-v/cli",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.9",
|
|
4
4
|
"description": "Standardized CLI tooling for ChatBI Monorepo",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
7
7
|
"module": "dist/index.js",
|
|
8
8
|
"types": "dist/index.d.ts",
|
|
9
9
|
"exports": {
|
|
10
|
-
".":
|
|
10
|
+
".": {
|
|
11
|
+
"types": "./dist/index.d.ts",
|
|
12
|
+
"import": "./dist/index.js"
|
|
13
|
+
},
|
|
11
14
|
"./package.json": "./package.json"
|
|
12
15
|
},
|
|
13
16
|
"bin": {
|
|
@@ -12,8 +12,8 @@
|
|
|
12
12
|
"dependencies": {
|
|
13
13
|
"@ant-design/icons": "^5.2.6",
|
|
14
14
|
"@ant-design/x": "^2.1.1",
|
|
15
|
-
"@chatbi-v/core": "^2.1.
|
|
16
|
-
"@chatbi-v/mocks": "^2.1.
|
|
15
|
+
"@chatbi-v/core": "^2.1.9",
|
|
16
|
+
"@chatbi-v/mocks": "^2.1.9",
|
|
17
17
|
"antd": "^5.29.3",
|
|
18
18
|
"react": "^18.3.1",
|
|
19
19
|
"react-dom": "^18.3.1",
|
|
@@ -21,8 +21,8 @@
|
|
|
21
21
|
"zustand": "^5.0.9"
|
|
22
22
|
},
|
|
23
23
|
"devDependencies": {
|
|
24
|
-
"@chatbi-v/cli": "^2.1.
|
|
25
|
-
"@chatbi-v/config":"^2.1.
|
|
24
|
+
"@chatbi-v/cli": "^2.1.9",
|
|
25
|
+
"@chatbi-v/config":"^2.1.9",
|
|
26
26
|
"@types/node": "^25.0.3",
|
|
27
27
|
"@types/react": "^18.2.43",
|
|
28
28
|
"@types/react-dom": "^18.2.17",
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { usePluginLoader as useCorePluginLoader } from '@chatbi-v/core';
|
|
2
2
|
import { useMemo } from 'react';
|
|
3
3
|
|
|
4
|
-
import {
|
|
4
|
+
import { appConfig } from '../../app.config';
|
|
5
5
|
import { api } from '../services/api';
|
|
6
6
|
|
|
7
7
|
/**
|
|
@@ -45,8 +45,8 @@ export const usePluginLoader = () => {
|
|
|
45
45
|
|
|
46
46
|
return {
|
|
47
47
|
modules: normalizedModules,
|
|
48
|
-
pluginConfigs:
|
|
49
|
-
systemConfig:
|
|
48
|
+
pluginConfigs: appConfig.plugins,
|
|
49
|
+
systemConfig: appConfig.system,
|
|
50
50
|
sharedContext: { api },
|
|
51
51
|
};
|
|
52
52
|
}, []);
|
|
@@ -7,25 +7,7 @@
|
|
|
7
7
|
|
|
8
8
|
@layer base {
|
|
9
9
|
:root {
|
|
10
|
-
/* Default
|
|
11
|
-
--color-background: 15 23 42; /* slate-900 #0f172a */
|
|
12
|
-
--color-surface: 30 41 59; /* slate-800 #1e293b */
|
|
13
|
-
--color-primary: 99 102 241; /* indigo-500 #6366f1 */
|
|
14
|
-
--color-secondary: 168 85 247; /* purple-500 #a855f7 */
|
|
15
|
-
--color-accent: 34 211 238; /* cyan-400 #22d3ee */
|
|
16
|
-
--color-text-main: 226 232 240; /* slate-200 */
|
|
17
|
-
--color-text-muted: 148 163 184; /* slate-400 */
|
|
18
|
-
--color-border: 51 65 85; /* slate-700 */
|
|
19
|
-
|
|
20
|
-
/* Layout Variables Default (Compact) */
|
|
21
|
-
--layout-sidebar-width: 240px;
|
|
22
|
-
--layout-content-padding: 16px;
|
|
23
|
-
--layout-gap: 8px;
|
|
24
|
-
--layout-font-scale: 1;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
[data-theme='light'] {
|
|
28
|
-
/* Light Theme */
|
|
10
|
+
/* Default Light Theme */
|
|
29
11
|
--color-background: 248 250 252; /* slate-50 */
|
|
30
12
|
--color-surface: 255 255 255; /* white */
|
|
31
13
|
--color-primary: 79 70 229; /* indigo-600 */
|
|
@@ -34,6 +16,24 @@
|
|
|
34
16
|
--color-text-main: 15 23 42; /* slate-900 */
|
|
35
17
|
--color-text-muted: 100 116 139; /* slate-500 */
|
|
36
18
|
--color-border: 226 232 240; /* slate-200 */
|
|
19
|
+
|
|
20
|
+
/* Layout Variables Default (Compact) */
|
|
21
|
+
--layout-sidebar-width: 240px;
|
|
22
|
+
--layout-content-padding: 16px;
|
|
23
|
+
--layout-gap: 8px;
|
|
24
|
+
--layout-font-scale: 1;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
[data-theme='dark'], .dark {
|
|
28
|
+
/* Dark Theme (Slate/Indigo) */
|
|
29
|
+
--color-background: 15 23 42; /* slate-900 #0f172a */
|
|
30
|
+
--color-surface: 30 41 59; /* slate-800 #1e293b */
|
|
31
|
+
--color-primary: 99 102 241; /* indigo-500 #6366f1 */
|
|
32
|
+
--color-secondary: 168 85 247; /* purple-500 #a855f7 */
|
|
33
|
+
--color-accent: 34 211 238; /* cyan-400 #22d3ee */
|
|
34
|
+
--color-text-main: 226 232 240; /* slate-200 */
|
|
35
|
+
--color-text-muted: 148 163 184; /* slate-400 */
|
|
36
|
+
--color-border: 51 65 85; /* slate-700 */
|
|
37
37
|
}
|
|
38
38
|
|
|
39
39
|
body {
|
|
@@ -40,7 +40,7 @@ export const exportSystemConfig = () => {
|
|
|
40
40
|
const url = URL.createObjectURL(blob);
|
|
41
41
|
const a = document.createElement('a');
|
|
42
42
|
a.href = url;
|
|
43
|
-
a.download = `
|
|
43
|
+
a.download = `app-config-${dateUtils.formatDate()}.json`;
|
|
44
44
|
document.body.appendChild(a);
|
|
45
45
|
a.click();
|
|
46
46
|
document.body.removeChild(a);
|
|
@@ -51,7 +51,7 @@ export const useUIStore = create<UIState>()(
|
|
|
51
51
|
setIsSettingsOpen: (v) => set({ isSettingsOpen: v }),
|
|
52
52
|
|
|
53
53
|
currentThemeId: 'default',
|
|
54
|
-
themeMode: '
|
|
54
|
+
themeMode: 'light',
|
|
55
55
|
setThemeId: (id) => set({ currentThemeId: id }),
|
|
56
56
|
setThemeMode: (mode) => set({ themeMode: mode }),
|
|
57
57
|
toggleThemeMode: () => set((state) => ({ themeMode: state.themeMode === 'dark' ? 'light' : 'dark' })),
|
|
@@ -11,11 +11,13 @@
|
|
|
11
11
|
},
|
|
12
12
|
"workspaces": [
|
|
13
13
|
"apps/*",
|
|
14
|
-
"plugins/*"
|
|
14
|
+
"plugins/*",
|
|
15
|
+
"packages/*",
|
|
16
|
+
"libs/*"
|
|
15
17
|
],
|
|
16
18
|
"dependencies": {
|
|
17
|
-
"@chatbi-v/core": "^2.1.
|
|
18
|
-
"@chatbi-v/mocks": "^2.1.
|
|
19
|
+
"@chatbi-v/core": "^2.1.9",
|
|
20
|
+
"@chatbi-v/mocks": "^2.1.9",
|
|
19
21
|
"react": "^18.3.1",
|
|
20
22
|
"react-dom": "^18.3.1",
|
|
21
23
|
"antd": "^5.29.3",
|
|
@@ -26,8 +28,8 @@
|
|
|
26
28
|
},
|
|
27
29
|
"devDependencies": {
|
|
28
30
|
"typescript": "^5.0.0",
|
|
29
|
-
"@chatbi-v/config": "^2.1.
|
|
30
|
-
"@chatbi-v/cli": "^2.1.
|
|
31
|
+
"@chatbi-v/config": "^2.1.9",
|
|
32
|
+
"@chatbi-v/cli": "^2.1.9",
|
|
31
33
|
"@ant-design/icons": "^5.6.1",
|
|
32
34
|
"@types/react": "^18.3.1",
|
|
33
35
|
"@types/react-dom": "^18.3.1",
|
|
@@ -21,14 +21,14 @@
|
|
|
21
21
|
},
|
|
22
22
|
"plugin": true,
|
|
23
23
|
"peerDependencies": {
|
|
24
|
-
"@chatbi-v/core": "^2.1.
|
|
24
|
+
"@chatbi-v/core": "^2.1.9",
|
|
25
25
|
"antd": "^5.20.0",
|
|
26
26
|
"react": ">=18.0.0",
|
|
27
27
|
"react-dom": ">=18.0.0"
|
|
28
28
|
},
|
|
29
29
|
"devDependencies": {
|
|
30
|
-
"@chatbi-v/core": "^2.1.
|
|
31
|
-
"@chatbi-v/config": "^2.1.
|
|
30
|
+
"@chatbi-v/core": "^2.1.9",
|
|
31
|
+
"@chatbi-v/config": "^2.1.9",
|
|
32
32
|
"tsup": "^8.5.1",
|
|
33
33
|
"vite": "^5.0.0"
|
|
34
34
|
}
|