ec-web 0.0.24 → 0.0.25
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/LICENSE +21 -21
- package/README.md +17 -17
- package/dist/index.js +0 -0
- package/dist/server.js +1 -1
- package/dist/sources/basic-settings.js +0 -6
- package/dist/sources/session-codex.js +11 -11
- package/dist/sources/stats.js +92 -92
- package/dist/static/app.js +11691 -11691
- package/dist/static/index.html +427 -427
- package/dist/static/style.css +4899 -4899
- package/dist/static/vendor/echarts-5.6.0.min.js +45 -45
- package/ecweb-wrapper.cjs +67 -67
- package/package.json +35 -35
package/ecweb-wrapper.cjs
CHANGED
|
@@ -1,68 +1,68 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
/**
|
|
3
|
-
* ecweb 智能启动包装器
|
|
4
|
-
* 检测源码变化,需要时自动重新编译,然后启动
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
const fs = require('fs');
|
|
8
|
-
const path = require('path');
|
|
9
|
-
const { execSync } = require('child_process');
|
|
10
|
-
|
|
11
|
-
const ECWEB_DIR = path.resolve(__dirname);
|
|
12
|
-
const SRC_DIR = path.join(ECWEB_DIR, 'src');
|
|
13
|
-
const DIST_DIR = path.join(ECWEB_DIR, 'dist');
|
|
14
|
-
const DIST_INDEX = path.join(DIST_DIR, 'index.js');
|
|
15
|
-
|
|
16
|
-
function needsBuild() {
|
|
17
|
-
if (!fs.existsSync(DIST_INDEX)) return true;
|
|
18
|
-
// Published packages contain the compiled dist/ tree but not the TypeScript
|
|
19
|
-
// source or devDependencies. Only source checkouts should trigger a build.
|
|
20
|
-
if (!fs.existsSync(SRC_DIR)) return false;
|
|
21
|
-
|
|
22
|
-
try {
|
|
23
|
-
const distStat = fs.statSync(DIST_INDEX);
|
|
24
|
-
const distMtime = distStat.mtimeMs;
|
|
25
|
-
|
|
26
|
-
// 递归检查所有 src 文件
|
|
27
|
-
let newestSrcMtime = 0;
|
|
28
|
-
function walkDir(dir) {
|
|
29
|
-
const entries = fs.readdirSync(dir, { withFileTypes: true });
|
|
30
|
-
for (const entry of entries) {
|
|
31
|
-
const fullPath = path.join(dir, entry.name);
|
|
32
|
-
if (entry.isDirectory()) {
|
|
33
|
-
walkDir(fullPath);
|
|
34
|
-
// Static assets are part of the runtime too. In particular,
|
|
35
|
-
// basic-settings.js may change without touching a TypeScript source;
|
|
36
|
-
// leave the wrapper on an old dist tree in that case would serve stale
|
|
37
|
-
// UI code (and hide newly added API calls) after a normal restart.
|
|
38
|
-
} else if (entry.isFile() && /\.(ts|tsx|json|js|css|html)$/.test(entry.name)) {
|
|
39
|
-
const stat = fs.statSync(fullPath);
|
|
40
|
-
if (stat.mtimeMs > newestSrcMtime) {
|
|
41
|
-
newestSrcMtime = stat.mtimeMs;
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
walkDir(SRC_DIR);
|
|
47
|
-
|
|
48
|
-
return newestSrcMtime > distMtime;
|
|
49
|
-
} catch {
|
|
50
|
-
return false;
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
if (needsBuild()) {
|
|
55
|
-
console.error('🔨 检测到代码变化,编译中...');
|
|
56
|
-
try {
|
|
57
|
-
execSync('npm run build', { cwd: ECWEB_DIR, stdio: 'inherit' });
|
|
58
|
-
} catch (e) {
|
|
59
|
-
console.error('❌ 编译失败');
|
|
60
|
-
process.exit(1);
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
// 执行真正的入口(ES module 需要用 import,Windows 路径需转 file:// URL)
|
|
65
|
-
(async () => {
|
|
66
|
-
const { pathToFileURL } = require('url');
|
|
67
|
-
await import(pathToFileURL(DIST_INDEX).href);
|
|
68
|
-
})();
|
|
2
|
+
/**
|
|
3
|
+
* ecweb 智能启动包装器
|
|
4
|
+
* 检测源码变化,需要时自动重新编译,然后启动
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
const fs = require('fs');
|
|
8
|
+
const path = require('path');
|
|
9
|
+
const { execSync } = require('child_process');
|
|
10
|
+
|
|
11
|
+
const ECWEB_DIR = path.resolve(__dirname);
|
|
12
|
+
const SRC_DIR = path.join(ECWEB_DIR, 'src');
|
|
13
|
+
const DIST_DIR = path.join(ECWEB_DIR, 'dist');
|
|
14
|
+
const DIST_INDEX = path.join(DIST_DIR, 'index.js');
|
|
15
|
+
|
|
16
|
+
function needsBuild() {
|
|
17
|
+
if (!fs.existsSync(DIST_INDEX)) return true;
|
|
18
|
+
// Published packages contain the compiled dist/ tree but not the TypeScript
|
|
19
|
+
// source or devDependencies. Only source checkouts should trigger a build.
|
|
20
|
+
if (!fs.existsSync(SRC_DIR)) return false;
|
|
21
|
+
|
|
22
|
+
try {
|
|
23
|
+
const distStat = fs.statSync(DIST_INDEX);
|
|
24
|
+
const distMtime = distStat.mtimeMs;
|
|
25
|
+
|
|
26
|
+
// 递归检查所有 src 文件
|
|
27
|
+
let newestSrcMtime = 0;
|
|
28
|
+
function walkDir(dir) {
|
|
29
|
+
const entries = fs.readdirSync(dir, { withFileTypes: true });
|
|
30
|
+
for (const entry of entries) {
|
|
31
|
+
const fullPath = path.join(dir, entry.name);
|
|
32
|
+
if (entry.isDirectory()) {
|
|
33
|
+
walkDir(fullPath);
|
|
34
|
+
// Static assets are part of the runtime too. In particular,
|
|
35
|
+
// basic-settings.js may change without touching a TypeScript source;
|
|
36
|
+
// leave the wrapper on an old dist tree in that case would serve stale
|
|
37
|
+
// UI code (and hide newly added API calls) after a normal restart.
|
|
38
|
+
} else if (entry.isFile() && /\.(ts|tsx|json|js|css|html)$/.test(entry.name)) {
|
|
39
|
+
const stat = fs.statSync(fullPath);
|
|
40
|
+
if (stat.mtimeMs > newestSrcMtime) {
|
|
41
|
+
newestSrcMtime = stat.mtimeMs;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
walkDir(SRC_DIR);
|
|
47
|
+
|
|
48
|
+
return newestSrcMtime > distMtime;
|
|
49
|
+
} catch {
|
|
50
|
+
return false;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
if (needsBuild()) {
|
|
55
|
+
console.error('🔨 检测到代码变化,编译中...');
|
|
56
|
+
try {
|
|
57
|
+
execSync('npm run build', { cwd: ECWEB_DIR, stdio: 'inherit' });
|
|
58
|
+
} catch (e) {
|
|
59
|
+
console.error('❌ 编译失败');
|
|
60
|
+
process.exit(1);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
// 执行真正的入口(ES module 需要用 import,Windows 路径需转 file:// URL)
|
|
65
|
+
(async () => {
|
|
66
|
+
const { pathToFileURL } = require('url');
|
|
67
|
+
await import(pathToFileURL(DIST_INDEX).href);
|
|
68
|
+
})();
|
package/package.json
CHANGED
|
@@ -1,35 +1,35 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "ec-web",
|
|
3
|
-
"version": "0.0.
|
|
4
|
-
"description": "Web console and monitoring dashboard for EvolCore",
|
|
5
|
-
"type": "module",
|
|
6
|
-
"bin": {
|
|
7
|
-
"ec-web": "ecweb-wrapper.cjs"
|
|
8
|
-
},
|
|
9
|
-
"files": [
|
|
10
|
-
"dist/"
|
|
11
|
-
],
|
|
12
|
-
"scripts": {
|
|
13
|
-
"build": "node -e \"require('fs').rmSync('dist',{recursive:true,force:true})\" && tsc && node -e \"try{require('child_process').execFileSync('chmod',['+x','dist/index.js'])}catch{}\" && node -e \"const fs=require('fs'),path=require('path');fs.cpSync('src/static','dist/static',{recursive:true});const f='dist/static/index.html',n=new Date(),ts=n.getFullYear()+'-'+String(n.getMonth()+1).padStart(2,'0')+'-'+String(n.getDate()).padStart(2,'0')+' '+String(n.getHours()).padStart(2,'0')+':'+String(n.getMinutes()).padStart(2,'0');fs.writeFileSync(f,fs.readFileSync(f,'utf8').replace(/(\\<span class=\\\"build-ts\\\"[^>]*\\>)[^<]+(\\<\\/span\\>)/,'$1'+ts+'$2'))\"",
|
|
14
|
-
"dev": "node dev.mjs",
|
|
15
|
-
"prepublishOnly": "npm run build"
|
|
16
|
-
},
|
|
17
|
-
"keywords": [
|
|
18
|
-
"evolcore",
|
|
19
|
-
"monitoring",
|
|
20
|
-
"debug"
|
|
21
|
-
],
|
|
22
|
-
"author": "",
|
|
23
|
-
"license": "MIT",
|
|
24
|
-
"peerDependencies": {
|
|
25
|
-
"evolcore": ">=0.0.4"
|
|
26
|
-
},
|
|
27
|
-
"dependencies": {
|
|
28
|
-
"ws": "^8.18.0"
|
|
29
|
-
},
|
|
30
|
-
"devDependencies": {
|
|
31
|
-
"@types/node": "^22.0.0",
|
|
32
|
-
"@types/ws": "^8.5.10",
|
|
33
|
-
"typescript": "^5.6.0"
|
|
34
|
-
}
|
|
35
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "ec-web",
|
|
3
|
+
"version": "0.0.25",
|
|
4
|
+
"description": "Web console and monitoring dashboard for EvolCore",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"bin": {
|
|
7
|
+
"ec-web": "ecweb-wrapper.cjs"
|
|
8
|
+
},
|
|
9
|
+
"files": [
|
|
10
|
+
"dist/"
|
|
11
|
+
],
|
|
12
|
+
"scripts": {
|
|
13
|
+
"build": "node -e \"require('fs').rmSync('dist',{recursive:true,force:true})\" && tsc && node -e \"try{require('child_process').execFileSync('chmod',['+x','dist/index.js'])}catch{}\" && node -e \"const fs=require('fs'),path=require('path');fs.cpSync('src/static','dist/static',{recursive:true});const f='dist/static/index.html',n=new Date(),ts=n.getFullYear()+'-'+String(n.getMonth()+1).padStart(2,'0')+'-'+String(n.getDate()).padStart(2,'0')+' '+String(n.getHours()).padStart(2,'0')+':'+String(n.getMinutes()).padStart(2,'0');fs.writeFileSync(f,fs.readFileSync(f,'utf8').replace(/(\\<span class=\\\"build-ts\\\"[^>]*\\>)[^<]+(\\<\\/span\\>)/,'$1'+ts+'$2'))\"",
|
|
14
|
+
"dev": "node dev.mjs",
|
|
15
|
+
"prepublishOnly": "npm run build"
|
|
16
|
+
},
|
|
17
|
+
"keywords": [
|
|
18
|
+
"evolcore",
|
|
19
|
+
"monitoring",
|
|
20
|
+
"debug"
|
|
21
|
+
],
|
|
22
|
+
"author": "",
|
|
23
|
+
"license": "MIT",
|
|
24
|
+
"peerDependencies": {
|
|
25
|
+
"evolcore": ">=0.0.4"
|
|
26
|
+
},
|
|
27
|
+
"dependencies": {
|
|
28
|
+
"ws": "^8.18.0"
|
|
29
|
+
},
|
|
30
|
+
"devDependencies": {
|
|
31
|
+
"@types/node": "^22.0.0",
|
|
32
|
+
"@types/ws": "^8.5.10",
|
|
33
|
+
"typescript": "^5.6.0"
|
|
34
|
+
}
|
|
35
|
+
}
|