@kevisual/cli 0.0.68 → 0.0.70
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/bin/assistant-server.js +3 -3
- package/bin/assistant.js +3 -3
- package/bin/envision.js +3 -3
- package/bun.config.mjs +19 -19
- package/dist/assistant-server.js +131 -28
- package/dist/assistant.js +28 -15
- package/dist/envision.js +12 -5
- package/package.json +77 -77
- package/readme.md +8 -8
package/bin/assistant-server.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { runParser } from '../dist/assistant-server.js';
|
|
3
|
-
|
|
4
|
-
runParser(process.argv);
|
|
2
|
+
import { runParser } from '../dist/assistant-server.js';
|
|
3
|
+
|
|
4
|
+
runParser(process.argv);
|
package/bin/assistant.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { runParser } from '../dist/assistant.js';
|
|
3
|
-
|
|
4
|
-
runParser(process.argv);
|
|
2
|
+
import { runParser } from '../dist/assistant.js';
|
|
3
|
+
|
|
4
|
+
runParser(process.argv);
|
package/bin/envision.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { runParser } from '../dist/envision.js';
|
|
3
|
-
|
|
4
|
-
runParser(process.argv);
|
|
2
|
+
import { runParser } from '../dist/envision.js';
|
|
3
|
+
|
|
4
|
+
runParser(process.argv);
|
package/bun.config.mjs
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
// @ts-check
|
|
2
|
-
// https://bun.sh/docs/bundler
|
|
3
|
-
// @ts-ignore
|
|
4
|
-
import pkg from './package.json';
|
|
5
|
-
// bun run src/index.ts --
|
|
6
|
-
await Bun.build({
|
|
7
|
-
target: 'node',
|
|
8
|
-
format: 'esm',
|
|
9
|
-
entrypoints: ['./src/index.ts'],
|
|
10
|
-
outdir: './dist',
|
|
11
|
-
naming: {
|
|
12
|
-
entry: 'envision.js',
|
|
13
|
-
},
|
|
14
|
-
|
|
15
|
-
define: {
|
|
16
|
-
ENVISION_VERSION: JSON.stringify(pkg.version),
|
|
17
|
-
},
|
|
18
|
-
env: 'ENVISION_*',
|
|
19
|
-
});
|
|
1
|
+
// @ts-check
|
|
2
|
+
// https://bun.sh/docs/bundler
|
|
3
|
+
// @ts-ignore
|
|
4
|
+
import pkg from './package.json';
|
|
5
|
+
// bun run src/index.ts --
|
|
6
|
+
await Bun.build({
|
|
7
|
+
target: 'node',
|
|
8
|
+
format: 'esm',
|
|
9
|
+
entrypoints: ['./src/index.ts'],
|
|
10
|
+
outdir: './dist',
|
|
11
|
+
naming: {
|
|
12
|
+
entry: 'envision.js',
|
|
13
|
+
},
|
|
14
|
+
|
|
15
|
+
define: {
|
|
16
|
+
ENVISION_VERSION: JSON.stringify(pkg.version),
|
|
17
|
+
},
|
|
18
|
+
env: 'ENVISION_*',
|
|
19
|
+
});
|
package/dist/assistant-server.js
CHANGED
|
@@ -67103,7 +67103,7 @@ var wsProxy = (server, config2) => {
|
|
|
67103
67103
|
wssApp.upgrade(request, socket, head);
|
|
67104
67104
|
});
|
|
67105
67105
|
};
|
|
67106
|
-
// ../node_modules/.pnpm/@kevisual+local-app-manager@0.1.
|
|
67106
|
+
// ../node_modules/.pnpm/@kevisual+local-app-manager@0.1.32_supports-color@10.2.2/node_modules/@kevisual/local-app-manager/dist/manager.mjs
|
|
67107
67107
|
var exports_manager = {};
|
|
67108
67108
|
__export(exports_manager, {
|
|
67109
67109
|
onAppShowInfo: () => onAppShowInfo,
|
|
@@ -67180,10 +67180,11 @@ var getConfigFile = (opts) => {
|
|
|
67180
67180
|
return "";
|
|
67181
67181
|
};
|
|
67182
67182
|
|
|
67183
|
-
// ../node_modules/.pnpm/@kevisual+local-app-manager@0.1.
|
|
67183
|
+
// ../node_modules/.pnpm/@kevisual+local-app-manager@0.1.32_supports-color@10.2.2/node_modules/@kevisual/local-app-manager/dist/manager.mjs
|
|
67184
67184
|
import path$1 from "node:path";
|
|
67185
67185
|
import fs$4 from "node:fs";
|
|
67186
67186
|
import { fork } from "node:child_process";
|
|
67187
|
+
import { fileURLToPath } from "node:url";
|
|
67187
67188
|
import require$$02 from "os";
|
|
67188
67189
|
import require$$0$12 from "path";
|
|
67189
67190
|
import require$$0$22 from "util";
|
|
@@ -67239,7 +67240,8 @@ var saveAppInfo = async (data, appsPath, filename = "apps.config.json") => {
|
|
|
67239
67240
|
fs$4.writeFileSync(configFile, JSON.stringify(data, null, 2));
|
|
67240
67241
|
};
|
|
67241
67242
|
var deleteFileAppInfo = async (key, appsPath) => {
|
|
67242
|
-
const
|
|
67243
|
+
const normalizedKey = key.replace(/\//g, path$1.sep);
|
|
67244
|
+
const directory = path$1.join(appsPath, normalizedKey);
|
|
67243
67245
|
if (!fileIsExist2(directory)) {
|
|
67244
67246
|
return;
|
|
67245
67247
|
}
|
|
@@ -73531,6 +73533,12 @@ function requireOut() {
|
|
|
73531
73533
|
}
|
|
73532
73534
|
var outExports = requireOut();
|
|
73533
73535
|
var glob = /* @__PURE__ */ getDefaultExportFromCjs2(outExports);
|
|
73536
|
+
var normalizeScriptPath = (scriptPath) => {
|
|
73537
|
+
if (process.platform === "win32") {
|
|
73538
|
+
return scriptPath.replace(/\\/g, "/");
|
|
73539
|
+
}
|
|
73540
|
+
return scriptPath;
|
|
73541
|
+
};
|
|
73534
73542
|
var connect = async (noDaemonMode = false) => {
|
|
73535
73543
|
return new Promise((resolve, reject) => {
|
|
73536
73544
|
pm2.connect(noDaemonMode, (err) => {
|
|
@@ -73632,9 +73640,10 @@ class Pm2Manager {
|
|
|
73632
73640
|
console.error("script is required");
|
|
73633
73641
|
return;
|
|
73634
73642
|
}
|
|
73643
|
+
const normalizedScript = normalizeScriptPath(script);
|
|
73635
73644
|
const starter = {
|
|
73636
73645
|
name: appName,
|
|
73637
|
-
script,
|
|
73646
|
+
script: normalizedScript,
|
|
73638
73647
|
cwd: process.cwd(),
|
|
73639
73648
|
interpreter,
|
|
73640
73649
|
...options,
|
|
@@ -73791,7 +73800,8 @@ class Manager {
|
|
|
73791
73800
|
app.process = childProcess;
|
|
73792
73801
|
} else if (app.type === "system-app") {
|
|
73793
73802
|
const pathEntryAndTimestamp = path$1.join(app.path, entry2);
|
|
73794
|
-
const
|
|
73803
|
+
const importPath = process.platform === "win32" ? "file:///" + pathEntryAndTimestamp.replace(/\\/g, "/") : pathEntryAndTimestamp;
|
|
73804
|
+
const module = await import(importPath);
|
|
73795
73805
|
if (module.loadApp && mainApp) {
|
|
73796
73806
|
await module.loadApp?.(mainApp, app);
|
|
73797
73807
|
}
|
|
@@ -74068,7 +74078,8 @@ class Manager {
|
|
|
74068
74078
|
}
|
|
74069
74079
|
}
|
|
74070
74080
|
var installAppFromKey = async (key, _appPath) => {
|
|
74071
|
-
const
|
|
74081
|
+
const normalizedKey = key.replace(/\//g, path$1.sep);
|
|
74082
|
+
const directory = path$1.join(_appPath, normalizedKey);
|
|
74072
74083
|
if (!fileIsExist2(directory)) {
|
|
74073
74084
|
console.error("App not found", directory);
|
|
74074
74085
|
throw new Error("App not found");
|
|
@@ -74113,8 +74124,8 @@ var installAppFromKey = async (key, _appPath) => {
|
|
|
74113
74124
|
var getAppPathKeys = async (_appPath) => {
|
|
74114
74125
|
const directory = path$1.resolve(_appPath);
|
|
74115
74126
|
const root3 = directory;
|
|
74116
|
-
const path1 =
|
|
74117
|
-
const path22 =
|
|
74127
|
+
const path1 = "*/package.json";
|
|
74128
|
+
const path22 = "*/*/package.json";
|
|
74118
74129
|
const appsPackages = await glob([path1, path22], {
|
|
74119
74130
|
cwd: root3,
|
|
74120
74131
|
onlyFiles: true,
|
|
@@ -74123,21 +74134,21 @@ var getAppPathKeys = async (_appPath) => {
|
|
|
74123
74134
|
});
|
|
74124
74135
|
const appPathKeys = appsPackages.map((pkg) => {
|
|
74125
74136
|
const dir = path$1.dirname(pkg);
|
|
74126
|
-
|
|
74127
|
-
return relativePath;
|
|
74137
|
+
return dir.replace(/\\/g, "/");
|
|
74128
74138
|
});
|
|
74129
74139
|
return appPathKeys;
|
|
74130
74140
|
};
|
|
74131
74141
|
var clearMicroApp = (link) => {
|
|
74132
74142
|
try {
|
|
74133
|
-
const
|
|
74143
|
+
const moduleUrl = new URL(link, import.meta.url);
|
|
74144
|
+
const modulePath = fileURLToPath(moduleUrl);
|
|
74134
74145
|
delete __require.cache[modulePath];
|
|
74135
74146
|
console.log(`Module ${link} has been unloaded.`);
|
|
74136
74147
|
} catch (error2) {
|
|
74137
74148
|
console.error(`Failed to unload module ${link}:`, error2);
|
|
74138
74149
|
}
|
|
74139
74150
|
};
|
|
74140
|
-
// ../node_modules/.pnpm/@kevisual+local-app-manager@0.1.
|
|
74151
|
+
// ../node_modules/.pnpm/@kevisual+local-app-manager@0.1.32_supports-color@10.2.2/node_modules/@kevisual/local-app-manager/dist/pm2.mjs
|
|
74141
74152
|
import pm22 from "pm2";
|
|
74142
74153
|
import { promisify as promisify2 } from "node:util";
|
|
74143
74154
|
var disconnect = promisify2(pm22.disconnect).bind(pm22);
|
|
@@ -74191,13 +74202,15 @@ class AssistantApp extends Manager {
|
|
|
74191
74202
|
}
|
|
74192
74203
|
async getPageAndAppList() {
|
|
74193
74204
|
const root3 = this.config.configPath.configDir;
|
|
74194
|
-
const
|
|
74205
|
+
const path1 = "apps/*/*/package.json";
|
|
74206
|
+
const path22 = "pages/*/*/package.json";
|
|
74207
|
+
const pages = await import_fast_glob.default([path1, path22], {
|
|
74195
74208
|
cwd: root3,
|
|
74196
74209
|
onlyFiles: true
|
|
74197
74210
|
});
|
|
74198
74211
|
const pagesParse = pages.map((page) => {
|
|
74199
|
-
const relativePath =
|
|
74200
|
-
const contentStr = fs7.readFileSync(path7.join(page), "utf-8");
|
|
74212
|
+
const relativePath = page;
|
|
74213
|
+
const contentStr = fs7.readFileSync(path7.join(root3, page), "utf-8");
|
|
74201
74214
|
const content = parseIfJson2(contentStr);
|
|
74202
74215
|
if (!content.appType) {
|
|
74203
74216
|
const isWeb = relativePath.startsWith("pages/");
|
|
@@ -81895,7 +81908,63 @@ var {
|
|
|
81895
81908
|
} = import__.default;
|
|
81896
81909
|
|
|
81897
81910
|
// src/server.ts
|
|
81898
|
-
import { spawnSync as spawnSync4 } from "child_process";
|
|
81911
|
+
import { spawnSync as spawnSync4 } from "node:child_process";
|
|
81912
|
+
import path14 from "node:path";
|
|
81913
|
+
// src/module/get-bun-path.ts
|
|
81914
|
+
import fs13 from "node:fs";
|
|
81915
|
+
import path13 from "node:path";
|
|
81916
|
+
import { execSync } from "node:child_process";
|
|
81917
|
+
var getBunPath = () => {
|
|
81918
|
+
const isWindows = process.platform === "win32";
|
|
81919
|
+
const bunExecutableName = isWindows ? "bun.exe" : "bun";
|
|
81920
|
+
if (process.env.BUN_PATH) {
|
|
81921
|
+
return process.env.BUN_PATH;
|
|
81922
|
+
}
|
|
81923
|
+
if (isWindows) {
|
|
81924
|
+
try {
|
|
81925
|
+
const globalNodeModules = execSync("npm root -g", { encoding: "utf-8" }).trim();
|
|
81926
|
+
const bunExePath = path13.join(globalNodeModules, "bun", "bin", "bun.exe");
|
|
81927
|
+
if (fs13.existsSync(bunExePath)) {
|
|
81928
|
+
return bunExePath;
|
|
81929
|
+
}
|
|
81930
|
+
} catch (error2) {}
|
|
81931
|
+
try {
|
|
81932
|
+
const bunPath = execSync("where bun", { encoding: "utf-8" }).trim().split(`
|
|
81933
|
+
`)[0];
|
|
81934
|
+
if (bunPath && bunPath.endsWith(".exe")) {
|
|
81935
|
+
return bunPath;
|
|
81936
|
+
}
|
|
81937
|
+
if (bunPath) {
|
|
81938
|
+
const bunDir = path13.dirname(bunPath);
|
|
81939
|
+
const bunExePath = path13.join(bunDir, "node_modules", "bun", "bin", "bun.exe");
|
|
81940
|
+
if (fs13.existsSync(bunExePath)) {
|
|
81941
|
+
return bunExePath;
|
|
81942
|
+
}
|
|
81943
|
+
}
|
|
81944
|
+
} catch (error2) {}
|
|
81945
|
+
} else {
|
|
81946
|
+
try {
|
|
81947
|
+
const bunPath = execSync("which bun", { encoding: "utf-8" }).trim();
|
|
81948
|
+
if (bunPath && fs13.existsSync(bunPath)) {
|
|
81949
|
+
return bunPath;
|
|
81950
|
+
}
|
|
81951
|
+
} catch (error2) {}
|
|
81952
|
+
}
|
|
81953
|
+
const commonPaths = [
|
|
81954
|
+
"/usr/local/bin/bun",
|
|
81955
|
+
"/usr/bin/bun",
|
|
81956
|
+
"C:\\Program Files\\Bun\\bun.exe",
|
|
81957
|
+
"C:\\Bun\\bun.exe"
|
|
81958
|
+
];
|
|
81959
|
+
for (const p of commonPaths) {
|
|
81960
|
+
if (fs13.existsSync(p)) {
|
|
81961
|
+
return p;
|
|
81962
|
+
}
|
|
81963
|
+
}
|
|
81964
|
+
return bunExecutableName;
|
|
81965
|
+
};
|
|
81966
|
+
|
|
81967
|
+
// src/server.ts
|
|
81899
81968
|
var runServer = async (port, listenPath = "127.0.0.1") => {
|
|
81900
81969
|
let _port;
|
|
81901
81970
|
if (port) {
|
|
@@ -81937,27 +82006,61 @@ var runServer = async (port, listenPath = "127.0.0.1") => {
|
|
|
81937
82006
|
port: _port
|
|
81938
82007
|
};
|
|
81939
82008
|
};
|
|
81940
|
-
program.description("启动服务").option("-d, --daemon", "是否以守护进程方式运行").option("-n, --name <name>", "服务名称", "assistant-server").option("-p, --port <port>", "服务端口").option("-s, --start", "是否启动服务").option("-e, --interpreter <interpreter>", "指定使用的解释器", "bun").
|
|
82009
|
+
program.description("启动服务").option("-d, --daemon", "是否以守护进程方式运行").option("-n, --name <name>", "服务名称", "assistant-server").option("-p, --port <port>", "服务端口").option("-s, --start", "是否启动服务").option("-e, --interpreter <interpreter>", "指定使用的解释器", "bun").action(async (options) => {
|
|
81941
82010
|
if (options.daemon) {
|
|
81942
82011
|
const [_interpreter, execPath] = process.argv;
|
|
81943
82012
|
const name = options.name;
|
|
81944
82013
|
const port = options.port;
|
|
81945
|
-
|
|
82014
|
+
const runPath = path14.resolve(execPath);
|
|
82015
|
+
const escapePath = (p) => {
|
|
82016
|
+
let normalized = p.replace(/\\/g, "/");
|
|
82017
|
+
return normalized.includes(" ") ? `"${normalized}"` : normalized;
|
|
82018
|
+
};
|
|
82019
|
+
let interpreterPath = options.interpreter;
|
|
82020
|
+
if (options.interpreter === "bun") {
|
|
82021
|
+
interpreterPath = getBunPath();
|
|
82022
|
+
console.log(source_default.gray("Bun 路径:"), interpreterPath);
|
|
82023
|
+
}
|
|
82024
|
+
let pm2Command = `pm2 start ${escapePath(runPath)} --interpreter ${escapePath(interpreterPath)} --name ${name} -- -s`;
|
|
81946
82025
|
if (port) {
|
|
81947
82026
|
pm2Command += ` -p ${port}`;
|
|
81948
82027
|
}
|
|
81949
|
-
|
|
81950
|
-
|
|
81951
|
-
|
|
81952
|
-
|
|
81953
|
-
|
|
81954
|
-
|
|
81955
|
-
|
|
81956
|
-
|
|
81957
|
-
|
|
82028
|
+
console.log(source_default.gray("执行命令:"), pm2Command);
|
|
82029
|
+
console.log(source_default.gray("脚本路径:"), runPath);
|
|
82030
|
+
try {
|
|
82031
|
+
console.log(source_default.yellow("尝试删除旧进程..."));
|
|
82032
|
+
spawnSync4(`pm2 delete ${name}`, [], {
|
|
82033
|
+
shell: true,
|
|
82034
|
+
stdio: "pipe"
|
|
82035
|
+
});
|
|
82036
|
+
const result = spawnSync4(pm2Command, [], {
|
|
82037
|
+
stdio: "inherit",
|
|
82038
|
+
shell: true,
|
|
82039
|
+
windowsHide: false
|
|
82040
|
+
});
|
|
82041
|
+
if (result.error) {
|
|
82042
|
+
console.error(source_default.red("Error starting server:"), result.error.message);
|
|
82043
|
+
console.log(source_default.yellow(`
|
|
82044
|
+
提示: 请检查:`));
|
|
82045
|
+
console.log(" 1. pm2 是否已安装: npm install -g pm2");
|
|
82046
|
+
console.log(" 2. bun 是否已安装且在 PATH 中");
|
|
82047
|
+
console.log(" 3. 尝试手动执行:", pm2Command);
|
|
82048
|
+
process.exit(1);
|
|
82049
|
+
}
|
|
82050
|
+
if (result.status !== 0) {
|
|
82051
|
+
console.error(source_default.red(`PM2 exited with code ${result.status}`));
|
|
82052
|
+
console.log(source_default.yellow(`
|
|
82053
|
+
查看详细日志:`), `pm2 logs ${name}`);
|
|
82054
|
+
console.log(source_default.yellow("查看进程状态:"), "pm2 list");
|
|
82055
|
+
process.exit(result.status || 1);
|
|
82056
|
+
}
|
|
82057
|
+
console.log(source_default.green("✓ 以守护进程方式运行"));
|
|
82058
|
+
console.log(source_default.gray("查看日志:"), `pm2 logs ${name}`);
|
|
82059
|
+
} catch (error2) {
|
|
82060
|
+
console.error(source_default.red("Error starting server:"), error2.message);
|
|
81958
82061
|
process.exit(1);
|
|
81959
82062
|
}
|
|
81960
|
-
|
|
82063
|
+
process.exit(0);
|
|
81961
82064
|
} else if (options.start) {
|
|
81962
82065
|
console.log("启动服务", source_default.green(assistantConfig2.configDir));
|
|
81963
82066
|
const config3 = assistantConfig2.getCacheAssistantConfig();
|
package/dist/assistant.js
CHANGED
|
@@ -41648,7 +41648,7 @@ var import_websocket_server = __toESM(require_websocket_server(), 1);
|
|
|
41648
41648
|
var wss = new import_websocket_server.default({
|
|
41649
41649
|
noServer: true
|
|
41650
41650
|
});
|
|
41651
|
-
// ../node_modules/.pnpm/@kevisual+local-app-manager@0.1.
|
|
41651
|
+
// ../node_modules/.pnpm/@kevisual+local-app-manager@0.1.32_supports-color@10.2.2/node_modules/@kevisual/local-app-manager/dist/manager.mjs
|
|
41652
41652
|
var exports_manager = {};
|
|
41653
41653
|
__export(exports_manager, {
|
|
41654
41654
|
onAppShowInfo: () => onAppShowInfo,
|
|
@@ -41725,10 +41725,11 @@ var getConfigFile = (opts) => {
|
|
|
41725
41725
|
return "";
|
|
41726
41726
|
};
|
|
41727
41727
|
|
|
41728
|
-
// ../node_modules/.pnpm/@kevisual+local-app-manager@0.1.
|
|
41728
|
+
// ../node_modules/.pnpm/@kevisual+local-app-manager@0.1.32_supports-color@10.2.2/node_modules/@kevisual/local-app-manager/dist/manager.mjs
|
|
41729
41729
|
import path$1 from "node:path";
|
|
41730
41730
|
import fs$4 from "node:fs";
|
|
41731
41731
|
import { fork } from "node:child_process";
|
|
41732
|
+
import { fileURLToPath } from "node:url";
|
|
41732
41733
|
import require$$0 from "os";
|
|
41733
41734
|
import require$$0$1 from "path";
|
|
41734
41735
|
import require$$0$2 from "util";
|
|
@@ -41784,7 +41785,8 @@ var saveAppInfo = async (data, appsPath, filename = "apps.config.json") => {
|
|
|
41784
41785
|
fs$4.writeFileSync(configFile, JSON.stringify(data, null, 2));
|
|
41785
41786
|
};
|
|
41786
41787
|
var deleteFileAppInfo = async (key, appsPath) => {
|
|
41787
|
-
const
|
|
41788
|
+
const normalizedKey = key.replace(/\//g, path$1.sep);
|
|
41789
|
+
const directory = path$1.join(appsPath, normalizedKey);
|
|
41788
41790
|
if (!fileIsExist2(directory)) {
|
|
41789
41791
|
return;
|
|
41790
41792
|
}
|
|
@@ -48076,6 +48078,12 @@ function requireOut() {
|
|
|
48076
48078
|
}
|
|
48077
48079
|
var outExports = requireOut();
|
|
48078
48080
|
var glob = /* @__PURE__ */ getDefaultExportFromCjs(outExports);
|
|
48081
|
+
var normalizeScriptPath = (scriptPath) => {
|
|
48082
|
+
if (process.platform === "win32") {
|
|
48083
|
+
return scriptPath.replace(/\\/g, "/");
|
|
48084
|
+
}
|
|
48085
|
+
return scriptPath;
|
|
48086
|
+
};
|
|
48079
48087
|
var connect = async (noDaemonMode = false) => {
|
|
48080
48088
|
return new Promise((resolve, reject) => {
|
|
48081
48089
|
pm2.connect(noDaemonMode, (err) => {
|
|
@@ -48177,9 +48185,10 @@ class Pm2Manager {
|
|
|
48177
48185
|
console.error("script is required");
|
|
48178
48186
|
return;
|
|
48179
48187
|
}
|
|
48188
|
+
const normalizedScript = normalizeScriptPath(script);
|
|
48180
48189
|
const starter = {
|
|
48181
48190
|
name: appName,
|
|
48182
|
-
script,
|
|
48191
|
+
script: normalizedScript,
|
|
48183
48192
|
cwd: process.cwd(),
|
|
48184
48193
|
interpreter,
|
|
48185
48194
|
...options,
|
|
@@ -48336,7 +48345,8 @@ class Manager {
|
|
|
48336
48345
|
app.process = childProcess;
|
|
48337
48346
|
} else if (app.type === "system-app") {
|
|
48338
48347
|
const pathEntryAndTimestamp = path$1.join(app.path, entry2);
|
|
48339
|
-
const
|
|
48348
|
+
const importPath = process.platform === "win32" ? "file:///" + pathEntryAndTimestamp.replace(/\\/g, "/") : pathEntryAndTimestamp;
|
|
48349
|
+
const module = await import(importPath);
|
|
48340
48350
|
if (module.loadApp && mainApp) {
|
|
48341
48351
|
await module.loadApp?.(mainApp, app);
|
|
48342
48352
|
}
|
|
@@ -48613,7 +48623,8 @@ class Manager {
|
|
|
48613
48623
|
}
|
|
48614
48624
|
}
|
|
48615
48625
|
var installAppFromKey = async (key, _appPath) => {
|
|
48616
|
-
const
|
|
48626
|
+
const normalizedKey = key.replace(/\//g, path$1.sep);
|
|
48627
|
+
const directory = path$1.join(_appPath, normalizedKey);
|
|
48617
48628
|
if (!fileIsExist2(directory)) {
|
|
48618
48629
|
console.error("App not found", directory);
|
|
48619
48630
|
throw new Error("App not found");
|
|
@@ -48658,8 +48669,8 @@ var installAppFromKey = async (key, _appPath) => {
|
|
|
48658
48669
|
var getAppPathKeys = async (_appPath) => {
|
|
48659
48670
|
const directory = path$1.resolve(_appPath);
|
|
48660
48671
|
const root2 = directory;
|
|
48661
|
-
const path1 =
|
|
48662
|
-
const path22 =
|
|
48672
|
+
const path1 = "*/package.json";
|
|
48673
|
+
const path22 = "*/*/package.json";
|
|
48663
48674
|
const appsPackages = await glob([path1, path22], {
|
|
48664
48675
|
cwd: root2,
|
|
48665
48676
|
onlyFiles: true,
|
|
@@ -48668,21 +48679,21 @@ var getAppPathKeys = async (_appPath) => {
|
|
|
48668
48679
|
});
|
|
48669
48680
|
const appPathKeys = appsPackages.map((pkg) => {
|
|
48670
48681
|
const dir = path$1.dirname(pkg);
|
|
48671
|
-
|
|
48672
|
-
return relativePath;
|
|
48682
|
+
return dir.replace(/\\/g, "/");
|
|
48673
48683
|
});
|
|
48674
48684
|
return appPathKeys;
|
|
48675
48685
|
};
|
|
48676
48686
|
var clearMicroApp = (link) => {
|
|
48677
48687
|
try {
|
|
48678
|
-
const
|
|
48688
|
+
const moduleUrl = new URL(link, import.meta.url);
|
|
48689
|
+
const modulePath = fileURLToPath(moduleUrl);
|
|
48679
48690
|
delete __require.cache[modulePath];
|
|
48680
48691
|
console.log(`Module ${link} has been unloaded.`);
|
|
48681
48692
|
} catch (error2) {
|
|
48682
48693
|
console.error(`Failed to unload module ${link}:`, error2);
|
|
48683
48694
|
}
|
|
48684
48695
|
};
|
|
48685
|
-
// ../node_modules/.pnpm/@kevisual+local-app-manager@0.1.
|
|
48696
|
+
// ../node_modules/.pnpm/@kevisual+local-app-manager@0.1.32_supports-color@10.2.2/node_modules/@kevisual/local-app-manager/dist/pm2.mjs
|
|
48686
48697
|
import pm22 from "pm2";
|
|
48687
48698
|
import { promisify as promisify2 } from "node:util";
|
|
48688
48699
|
var disconnect = promisify2(pm22.disconnect).bind(pm22);
|
|
@@ -48736,13 +48747,15 @@ class AssistantApp extends Manager {
|
|
|
48736
48747
|
}
|
|
48737
48748
|
async getPageAndAppList() {
|
|
48738
48749
|
const root2 = this.config.configPath.configDir;
|
|
48739
|
-
const
|
|
48750
|
+
const path1 = "apps/*/*/package.json";
|
|
48751
|
+
const path22 = "pages/*/*/package.json";
|
|
48752
|
+
const pages = await import_fast_glob.default([path1, path22], {
|
|
48740
48753
|
cwd: root2,
|
|
48741
48754
|
onlyFiles: true
|
|
48742
48755
|
});
|
|
48743
48756
|
const pagesParse = pages.map((page) => {
|
|
48744
|
-
const relativePath =
|
|
48745
|
-
const contentStr = fs6.readFileSync(path5.join(page), "utf-8");
|
|
48757
|
+
const relativePath = page;
|
|
48758
|
+
const contentStr = fs6.readFileSync(path5.join(root2, page), "utf-8");
|
|
48746
48759
|
const content = parseIfJson(contentStr);
|
|
48747
48760
|
if (!content.appType) {
|
|
48748
48761
|
const isWeb = relativePath.startsWith("pages/");
|
package/dist/envision.js
CHANGED
|
@@ -40643,8 +40643,8 @@ InitEnv.init();
|
|
|
40643
40643
|
var version = useContextKey("version", () => {
|
|
40644
40644
|
let version2 = "0.0.64";
|
|
40645
40645
|
try {
|
|
40646
|
-
if ("0.0.
|
|
40647
|
-
version2 = "0.0.
|
|
40646
|
+
if ("0.0.70")
|
|
40647
|
+
version2 = "0.0.70";
|
|
40648
40648
|
} catch (e) {}
|
|
40649
40649
|
return version2;
|
|
40650
40650
|
});
|
|
@@ -44137,7 +44137,7 @@ class BaseQuery {
|
|
|
44137
44137
|
}
|
|
44138
44138
|
}
|
|
44139
44139
|
|
|
44140
|
-
// node_modules/.pnpm/@kevisual+query-login@0.0.
|
|
44140
|
+
// node_modules/.pnpm/@kevisual+query-login@0.0.7_73acd6e183c2d11636e1682f8e793fc3/node_modules/@kevisual/query-login/dist/query-login-node.js
|
|
44141
44141
|
import { homedir } from "os";
|
|
44142
44142
|
import { join, dirname } from "path";
|
|
44143
44143
|
import fs3 from "fs";
|
|
@@ -47213,6 +47213,12 @@ var fileIsExist = (filePath) => {
|
|
|
47213
47213
|
return false;
|
|
47214
47214
|
}
|
|
47215
47215
|
};
|
|
47216
|
+
var normalizeScriptPath = (scriptPath) => {
|
|
47217
|
+
if (process.platform === "win32") {
|
|
47218
|
+
return scriptPath.replace(/\\/g, "/");
|
|
47219
|
+
}
|
|
47220
|
+
return scriptPath;
|
|
47221
|
+
};
|
|
47216
47222
|
|
|
47217
47223
|
// src/command/npm.ts
|
|
47218
47224
|
import fs8 from "fs";
|
|
@@ -48554,8 +48560,9 @@ class SyncBase {
|
|
|
48554
48560
|
const replaceKeys = Object.keys(replace);
|
|
48555
48561
|
let newKey = key;
|
|
48556
48562
|
for (let replaceKey of replaceKeys) {
|
|
48557
|
-
|
|
48558
|
-
|
|
48563
|
+
const _replaceKey = normalizeScriptPath(replaceKey);
|
|
48564
|
+
if (newKey.startsWith(_replaceKey)) {
|
|
48565
|
+
newKey = key.replace(_replaceKey, replace[replaceKey]);
|
|
48559
48566
|
}
|
|
48560
48567
|
}
|
|
48561
48568
|
const pathname = path10.join(_registryURL.pathname, newKey);
|
package/package.json
CHANGED
|
@@ -1,78 +1,78 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@kevisual/cli",
|
|
3
|
-
"version": "0.0.
|
|
4
|
-
"description": "envision 命令行工具",
|
|
5
|
-
"type": "module",
|
|
6
|
-
"basename": "/root/cli",
|
|
7
|
-
"app": {
|
|
8
|
-
"key": "cli",
|
|
9
|
-
"entry": "dist/app.mjs",
|
|
10
|
-
"type": "pm2-system-app",
|
|
11
|
-
"runtime": [
|
|
12
|
-
"cli"
|
|
13
|
-
]
|
|
14
|
-
},
|
|
15
|
-
"bin": {
|
|
16
|
-
"envision": "bin/envision.js",
|
|
17
|
-
"ev": "bin/envision.js",
|
|
18
|
-
"assistant": "bin/assistant.js",
|
|
19
|
-
"assistant-server": "bin/assistant-server.js",
|
|
20
|
-
"asst": "bin/assistant.js",
|
|
21
|
-
"asst-server": "bin/assistant-server.js"
|
|
22
|
-
},
|
|
23
|
-
"files": [
|
|
24
|
-
"dist",
|
|
25
|
-
"bin",
|
|
26
|
-
"bun.config.mjs"
|
|
27
|
-
],
|
|
28
|
-
"scripts": {
|
|
29
|
-
"dev": "bun src/run.ts ",
|
|
30
|
-
"dev:tsx": "tsx src/run.ts ",
|
|
31
|
-
"build": "rimraf dist && bun run bun.config.mjs",
|
|
32
|
-
"deploy": "ev pack -u -p -m no",
|
|
33
|
-
"pub:me": "npm publish --registry https://npm.xiongxiao.me --tag beta",
|
|
34
|
-
"postbuild": "cd assistant && pnpm build ",
|
|
35
|
-
"dts": "dts-bundle-generator --external-inlines=@types/jsonwebtoken src/index.ts -o dist/index.d.ts "
|
|
36
|
-
},
|
|
37
|
-
"keywords": [
|
|
38
|
-
"kevisual",
|
|
39
|
-
"cli"
|
|
40
|
-
],
|
|
41
|
-
"author": "abearxiong",
|
|
42
|
-
"dependencies": {
|
|
43
|
-
"@kevisual/context": "^0.0.4",
|
|
44
|
-
"micromatch": "^4.0.8",
|
|
45
|
-
"pm2": "^6.0.14",
|
|
46
|
-
"semver": "^7.7.3"
|
|
47
|
-
},
|
|
48
|
-
"devDependencies": {
|
|
49
|
-
"@kevisual/dts": "^0.0.3",
|
|
50
|
-
"@kevisual/load": "^0.0.6",
|
|
51
|
-
"@kevisual/logger": "^0.0.4",
|
|
52
|
-
"@kevisual/query": "0.0.29",
|
|
53
|
-
"@kevisual/query-login": "0.0.7",
|
|
54
|
-
"@types/bun": "^1.3.3",
|
|
55
|
-
"@types/crypto-js": "^4.2.2",
|
|
56
|
-
"@types/jsonwebtoken": "^9.0.10",
|
|
57
|
-
"@types/micromatch": "^4.0.10",
|
|
58
|
-
"@types/node": "^24.10.1",
|
|
59
|
-
"@types/semver": "^7.7.1",
|
|
60
|
-
"chalk": "^5.6.2",
|
|
61
|
-
"commander": "^14.0.2",
|
|
62
|
-
"crypto-js": "^4.2.0",
|
|
63
|
-
"fast-glob": "^3.3.3",
|
|
64
|
-
"filesize": "^11.0.13",
|
|
65
|
-
"form-data": "^4.0.5",
|
|
66
|
-
"ignore": "^7.0.5",
|
|
67
|
-
"inquirer": "^13.0.1",
|
|
68
|
-
"jsonwebtoken": "^9.0.2",
|
|
69
|
-
"tar": "^7.5.2",
|
|
70
|
-
"zustand": "^5.0.9"
|
|
71
|
-
},
|
|
72
|
-
"engines": {
|
|
73
|
-
"node": ">=22.0.0"
|
|
74
|
-
},
|
|
75
|
-
"publishConfig": {
|
|
76
|
-
"access": "public"
|
|
77
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@kevisual/cli",
|
|
3
|
+
"version": "0.0.70",
|
|
4
|
+
"description": "envision 命令行工具",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"basename": "/root/cli",
|
|
7
|
+
"app": {
|
|
8
|
+
"key": "cli",
|
|
9
|
+
"entry": "dist/app.mjs",
|
|
10
|
+
"type": "pm2-system-app",
|
|
11
|
+
"runtime": [
|
|
12
|
+
"cli"
|
|
13
|
+
]
|
|
14
|
+
},
|
|
15
|
+
"bin": {
|
|
16
|
+
"envision": "bin/envision.js",
|
|
17
|
+
"ev": "bin/envision.js",
|
|
18
|
+
"assistant": "bin/assistant.js",
|
|
19
|
+
"assistant-server": "bin/assistant-server.js",
|
|
20
|
+
"asst": "bin/assistant.js",
|
|
21
|
+
"asst-server": "bin/assistant-server.js"
|
|
22
|
+
},
|
|
23
|
+
"files": [
|
|
24
|
+
"dist",
|
|
25
|
+
"bin",
|
|
26
|
+
"bun.config.mjs"
|
|
27
|
+
],
|
|
28
|
+
"scripts": {
|
|
29
|
+
"dev": "bun src/run.ts ",
|
|
30
|
+
"dev:tsx": "tsx src/run.ts ",
|
|
31
|
+
"build": "rimraf dist && bun run bun.config.mjs",
|
|
32
|
+
"deploy": "ev pack -u -p -m no",
|
|
33
|
+
"pub:me": "npm publish --registry https://npm.xiongxiao.me --tag beta",
|
|
34
|
+
"postbuild": "cd assistant && pnpm build ",
|
|
35
|
+
"dts": "dts-bundle-generator --external-inlines=@types/jsonwebtoken src/index.ts -o dist/index.d.ts "
|
|
36
|
+
},
|
|
37
|
+
"keywords": [
|
|
38
|
+
"kevisual",
|
|
39
|
+
"cli"
|
|
40
|
+
],
|
|
41
|
+
"author": "abearxiong",
|
|
42
|
+
"dependencies": {
|
|
43
|
+
"@kevisual/context": "^0.0.4",
|
|
44
|
+
"micromatch": "^4.0.8",
|
|
45
|
+
"pm2": "^6.0.14",
|
|
46
|
+
"semver": "^7.7.3"
|
|
47
|
+
},
|
|
48
|
+
"devDependencies": {
|
|
49
|
+
"@kevisual/dts": "^0.0.3",
|
|
50
|
+
"@kevisual/load": "^0.0.6",
|
|
51
|
+
"@kevisual/logger": "^0.0.4",
|
|
52
|
+
"@kevisual/query": "0.0.29",
|
|
53
|
+
"@kevisual/query-login": "0.0.7",
|
|
54
|
+
"@types/bun": "^1.3.3",
|
|
55
|
+
"@types/crypto-js": "^4.2.2",
|
|
56
|
+
"@types/jsonwebtoken": "^9.0.10",
|
|
57
|
+
"@types/micromatch": "^4.0.10",
|
|
58
|
+
"@types/node": "^24.10.1",
|
|
59
|
+
"@types/semver": "^7.7.1",
|
|
60
|
+
"chalk": "^5.6.2",
|
|
61
|
+
"commander": "^14.0.2",
|
|
62
|
+
"crypto-js": "^4.2.0",
|
|
63
|
+
"fast-glob": "^3.3.3",
|
|
64
|
+
"filesize": "^11.0.13",
|
|
65
|
+
"form-data": "^4.0.5",
|
|
66
|
+
"ignore": "^7.0.5",
|
|
67
|
+
"inquirer": "^13.0.1",
|
|
68
|
+
"jsonwebtoken": "^9.0.2",
|
|
69
|
+
"tar": "^7.5.2",
|
|
70
|
+
"zustand": "^5.0.9"
|
|
71
|
+
},
|
|
72
|
+
"engines": {
|
|
73
|
+
"node": ">=22.0.0"
|
|
74
|
+
},
|
|
75
|
+
"publishConfig": {
|
|
76
|
+
"access": "public"
|
|
77
|
+
}
|
|
78
78
|
}
|
package/readme.md
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
# 可视化控制台工具
|
|
2
|
-
|
|
3
|
-
## 1. 上传文件
|
|
4
|
-
|
|
5
|
-
## 2. 下载文件
|
|
6
|
-
|
|
7
|
-
## 3. 同步模板
|
|
8
|
-
|
|
1
|
+
# 可视化控制台工具
|
|
2
|
+
|
|
3
|
+
## 1. 上传文件
|
|
4
|
+
|
|
5
|
+
## 2. 下载文件
|
|
6
|
+
|
|
7
|
+
## 3. 同步模板
|
|
8
|
+
|