@kevisual/cli 0.0.84 → 0.0.86
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/assistant-server.js +27 -13
- package/dist/assistant.js +20 -88
- package/dist/envision.js +2 -2
- package/package.json +1 -1
package/dist/assistant-server.js
CHANGED
|
@@ -95523,32 +95523,38 @@ class AssistantInit extends AssistantConfig {
|
|
|
95523
95523
|
"description": "assistant-app package pnpm, node pkgs projects",
|
|
95524
95524
|
"type": "module",
|
|
95525
95525
|
"scripts": {
|
|
95526
|
-
"start": "pm2 start apps/
|
|
95527
|
-
"
|
|
95526
|
+
"start": "pm2 start apps/code-center/dist/app.mjs --name code-center",
|
|
95527
|
+
"proxy": "pm2 start apps/page-proxy/dist/app.mjs --name page-proxy",
|
|
95528
|
+
"preview": "pnpm i && ASSISTANT_CONFIG_DIR=/workspace asst server -s -p 8686"
|
|
95528
95529
|
},
|
|
95529
95530
|
"keywords": [],
|
|
95530
95531
|
"author": "",
|
|
95531
95532
|
"license": "ISC",
|
|
95532
95533
|
"dependencies": {
|
|
95534
|
+
"@aws-sdk/client-s3": "latest",
|
|
95535
|
+
"@kevisual/oss": "latest",
|
|
95536
|
+
"@kevisual/query": "latest",
|
|
95533
95537
|
"@kevisual/router": "latest",
|
|
95534
95538
|
"@kevisual/use-config": "latest",
|
|
95535
|
-
"
|
|
95539
|
+
"better-sqlite3": "latest",
|
|
95540
|
+
"crypto-js": "latest",
|
|
95541
|
+
"dayjs": "latest",
|
|
95542
|
+
"dotenv": "latest",
|
|
95543
|
+
"es-toolkit": "latest",
|
|
95544
|
+
"eventemitter3": "latest",
|
|
95536
95545
|
"ioredis": "latest",
|
|
95537
95546
|
"minio": "latest",
|
|
95547
|
+
"node-cron": "latest",
|
|
95538
95548
|
"pg": "latest",
|
|
95539
95549
|
"pm2": "latest",
|
|
95540
95550
|
"sequelize": "latest",
|
|
95541
|
-
"
|
|
95542
|
-
"better-sqlite3": "latest",
|
|
95543
|
-
"unstorage": "latest",
|
|
95544
|
-
"dayjs": "latest",
|
|
95545
|
-
"es-toolkit": "latest",
|
|
95546
|
-
"node-cron": "latest",
|
|
95547
|
-
"dotenv": "latest"
|
|
95551
|
+
"unstorage": "latest"
|
|
95548
95552
|
},
|
|
95549
95553
|
"devDependencies": {
|
|
95550
|
-
"@types
|
|
95551
|
-
"@types/
|
|
95554
|
+
"@kevisual/types": "^0.0.11",
|
|
95555
|
+
"@types/bun": "^1.3.6",
|
|
95556
|
+
"@types/crypto-js": "latest",
|
|
95557
|
+
"@types/node": "latest"
|
|
95552
95558
|
}
|
|
95553
95559
|
}
|
|
95554
95560
|
`);
|
|
@@ -102271,6 +102277,14 @@ var proxyRoute = async (req, res) => {
|
|
|
102271
102277
|
const apiBackendProxy = allProxy.find((item) => pathname.startsWith(item.path));
|
|
102272
102278
|
if (apiBackendProxy) {
|
|
102273
102279
|
log.debug("apiBackendProxy", { apiBackendProxy, url: req.url });
|
|
102280
|
+
if (apiBackendProxy.s3?.id) {
|
|
102281
|
+
const storage = _assistantConfig?.storage || [];
|
|
102282
|
+
const storageConfig = storage.find((item) => item.id === apiBackendProxy.s3?.id);
|
|
102283
|
+
apiBackendProxy.s3 = {
|
|
102284
|
+
...storageConfig,
|
|
102285
|
+
...apiBackendProxy.s3
|
|
102286
|
+
};
|
|
102287
|
+
}
|
|
102274
102288
|
return proxy(req, res, {
|
|
102275
102289
|
path: apiBackendProxy.path,
|
|
102276
102290
|
target: apiBackendProxy.target,
|
|
@@ -105558,7 +105572,7 @@ program.description("启动服务").option("-d, --daemon", "是否以守护进
|
|
|
105558
105572
|
} else if (options.start) {
|
|
105559
105573
|
console.log("启动服务", source_default.green(assistantConfig2.configDir));
|
|
105560
105574
|
const config2 = assistantConfig2.getCacheAssistantConfig();
|
|
105561
|
-
const listenPort = options.port || config2?.server?.port;
|
|
105575
|
+
const listenPort = parseInt(options.port || config2?.server?.port);
|
|
105562
105576
|
const listenPath = config2?.server?.path || "::";
|
|
105563
105577
|
const server = await runServer(listenPort, listenPath);
|
|
105564
105578
|
} else {
|
package/dist/assistant.js
CHANGED
|
@@ -54544,8 +54544,8 @@ var assistantConfig2 = new AssistantConfig({
|
|
|
54544
54544
|
import fs8 from "fs";
|
|
54545
54545
|
var version = "0.0.1";
|
|
54546
54546
|
try {
|
|
54547
|
-
if ("0.0.
|
|
54548
|
-
version = "0.0.
|
|
54547
|
+
if ("0.0.7")
|
|
54548
|
+
version = "0.0.7";
|
|
54549
54549
|
} catch (e) {}
|
|
54550
54550
|
program.name("asst").description("A CLI tool with envison").version(version, "-v, --version", "output the current version");
|
|
54551
54551
|
var ls = new Command("ls").description("List files in the current directory").action(() => {
|
|
@@ -55189,32 +55189,38 @@ class AssistantInit extends AssistantConfig {
|
|
|
55189
55189
|
"description": "assistant-app package pnpm, node pkgs projects",
|
|
55190
55190
|
"type": "module",
|
|
55191
55191
|
"scripts": {
|
|
55192
|
-
"start": "pm2 start apps/
|
|
55193
|
-
"
|
|
55192
|
+
"start": "pm2 start apps/code-center/dist/app.mjs --name code-center",
|
|
55193
|
+
"proxy": "pm2 start apps/page-proxy/dist/app.mjs --name page-proxy",
|
|
55194
|
+
"preview": "pnpm i && ASSISTANT_CONFIG_DIR=/workspace asst server -s -p 8686"
|
|
55194
55195
|
},
|
|
55195
55196
|
"keywords": [],
|
|
55196
55197
|
"author": "",
|
|
55197
55198
|
"license": "ISC",
|
|
55198
55199
|
"dependencies": {
|
|
55200
|
+
"@aws-sdk/client-s3": "latest",
|
|
55201
|
+
"@kevisual/oss": "latest",
|
|
55202
|
+
"@kevisual/query": "latest",
|
|
55199
55203
|
"@kevisual/router": "latest",
|
|
55200
55204
|
"@kevisual/use-config": "latest",
|
|
55201
|
-
"
|
|
55205
|
+
"better-sqlite3": "latest",
|
|
55206
|
+
"crypto-js": "latest",
|
|
55207
|
+
"dayjs": "latest",
|
|
55208
|
+
"dotenv": "latest",
|
|
55209
|
+
"es-toolkit": "latest",
|
|
55210
|
+
"eventemitter3": "latest",
|
|
55202
55211
|
"ioredis": "latest",
|
|
55203
55212
|
"minio": "latest",
|
|
55213
|
+
"node-cron": "latest",
|
|
55204
55214
|
"pg": "latest",
|
|
55205
55215
|
"pm2": "latest",
|
|
55206
55216
|
"sequelize": "latest",
|
|
55207
|
-
"
|
|
55208
|
-
"better-sqlite3": "latest",
|
|
55209
|
-
"unstorage": "latest",
|
|
55210
|
-
"dayjs": "latest",
|
|
55211
|
-
"es-toolkit": "latest",
|
|
55212
|
-
"node-cron": "latest",
|
|
55213
|
-
"dotenv": "latest"
|
|
55217
|
+
"unstorage": "latest"
|
|
55214
55218
|
},
|
|
55215
55219
|
"devDependencies": {
|
|
55216
|
-
"@types
|
|
55217
|
-
"@types/
|
|
55220
|
+
"@kevisual/types": "^0.0.11",
|
|
55221
|
+
"@types/bun": "^1.3.6",
|
|
55222
|
+
"@types/crypto-js": "latest",
|
|
55223
|
+
"@types/node": "latest"
|
|
55218
55224
|
}
|
|
55219
55225
|
}
|
|
55220
55226
|
`);
|
|
@@ -58645,82 +58651,8 @@ commdands.forEach((name) => {
|
|
|
58645
58651
|
});
|
|
58646
58652
|
|
|
58647
58653
|
// src/command/run-scripts/index.ts
|
|
58648
|
-
import { spawnSync as spawnSync5 } from "node:child_process";
|
|
58649
58654
|
import path11 from "node:path";
|
|
58650
58655
|
import fs12 from "node:fs";
|
|
58651
|
-
var runScriptsCommand = new Command("run-scripts").alias("run").arguments("<cmd> [env]").option("-l --local", "使用当前文件夹的package.json中的scripts", false).description("运行脚本,在assistant.config.json中配置的脚本").action(async (cmd, env3, opts) => {
|
|
58652
|
-
const useLocal = opts.local;
|
|
58653
|
-
const showScripts = cmd === "show";
|
|
58654
|
-
const showScriptFunc = (scripts2) => {
|
|
58655
|
-
console.log("可用的本地脚本:");
|
|
58656
|
-
let has = false;
|
|
58657
|
-
Object.keys(scripts2).forEach((key) => {
|
|
58658
|
-
console.log(`- ${key}: ${scripts2[key]}`);
|
|
58659
|
-
has = true;
|
|
58660
|
-
});
|
|
58661
|
-
if (!has) {
|
|
58662
|
-
console.log("当前未定义任何脚本。");
|
|
58663
|
-
}
|
|
58664
|
-
};
|
|
58665
|
-
if (useLocal) {
|
|
58666
|
-
const pkgPath = path11.join(process.cwd(), "package.json");
|
|
58667
|
-
if (checkFileExists(pkgPath) === false) {
|
|
58668
|
-
console.error("当前目录下未找到 package.json 文件。");
|
|
58669
|
-
return;
|
|
58670
|
-
}
|
|
58671
|
-
const pkg = JSON.parse(fs12.readFileSync(pkgPath, "utf-8"));
|
|
58672
|
-
const scripts2 = pkg.scripts || {};
|
|
58673
|
-
if (showScripts) {
|
|
58674
|
-
showScriptFunc(scripts2);
|
|
58675
|
-
return;
|
|
58676
|
-
}
|
|
58677
|
-
const script = scripts2[cmd];
|
|
58678
|
-
if (!script) {
|
|
58679
|
-
console.error(`Script "${cmd}" not found in local package.json.`);
|
|
58680
|
-
return;
|
|
58681
|
-
}
|
|
58682
|
-
const command2 = [script, ...env3 ? [env3] : []].join(" ");
|
|
58683
|
-
const res = spawnSync5(command2, { shell: true, stdio: "inherit", cwd: assistantConfig2.configDir });
|
|
58684
|
-
console.log(`执行 "[${command2}]"...`);
|
|
58685
|
-
if (res.error) {
|
|
58686
|
-
console.error(`执行失败 "${cmd}":`, res.error);
|
|
58687
|
-
return;
|
|
58688
|
-
}
|
|
58689
|
-
if (res.status !== 0) {
|
|
58690
|
-
console.error(`本地脚本 "${cmd}" 以代码 ${res.status} 退出`);
|
|
58691
|
-
return;
|
|
58692
|
-
}
|
|
58693
|
-
return;
|
|
58694
|
-
}
|
|
58695
|
-
assistantConfig2.checkMounted();
|
|
58696
|
-
const configs = assistantConfig2.getCacheAssistantConfig();
|
|
58697
|
-
const scripts = configs?.scripts || {};
|
|
58698
|
-
try {
|
|
58699
|
-
const script = scripts[cmd];
|
|
58700
|
-
if (showScripts) {
|
|
58701
|
-
showScriptFunc(scripts);
|
|
58702
|
-
return;
|
|
58703
|
-
}
|
|
58704
|
-
if (!script) {
|
|
58705
|
-
console.error(`Script "${cmd}" not found.`);
|
|
58706
|
-
return;
|
|
58707
|
-
}
|
|
58708
|
-
const command2 = [script, ...env3 ? [env3] : []].join(" ");
|
|
58709
|
-
const res = spawnSync5(command2, { shell: true, stdio: "inherit", cwd: assistantConfig2.configDir });
|
|
58710
|
-
if (res.error) {
|
|
58711
|
-
console.error(`Error running script "${cmd}":`, res.error);
|
|
58712
|
-
return;
|
|
58713
|
-
}
|
|
58714
|
-
if (res.status !== 0) {
|
|
58715
|
-
console.error(`Script "${cmd}" exited with code ${res.status}`);
|
|
58716
|
-
return;
|
|
58717
|
-
}
|
|
58718
|
-
console.log(`Script "${cmd}" run successfully.`);
|
|
58719
|
-
} catch (error2) {
|
|
58720
|
-
console.error(`Failed to run script "${cmd}":`, error2);
|
|
58721
|
-
}
|
|
58722
|
-
});
|
|
58723
|
-
program.addCommand(runScriptsCommand);
|
|
58724
58656
|
var createRandomApp = (opts) => {
|
|
58725
58657
|
const { app, package: packageJson, pwd } = opts;
|
|
58726
58658
|
if (!app.status) {
|
package/dist/envision.js
CHANGED
|
@@ -22327,8 +22327,8 @@ InitEnv.init();
|
|
|
22327
22327
|
var version = useContextKey("version", () => {
|
|
22328
22328
|
let version2 = "0.0.64";
|
|
22329
22329
|
try {
|
|
22330
|
-
if ("0.0.
|
|
22331
|
-
version2 = "0.0.
|
|
22330
|
+
if ("0.0.86")
|
|
22331
|
+
version2 = "0.0.86";
|
|
22332
22332
|
} catch (e) {}
|
|
22333
22333
|
return version2;
|
|
22334
22334
|
});
|