mirror of
https://github.com/whyour/qinglong.git
synced 2026-09-15 19:57:07 +08:00
fix: 修复任务生命周期与调度就绪,优化执行和构建开销 (#3069)
* fix: harden task lifecycle and scheduler readiness * fix: confine log writes to the configured log directory * fix: verify complete build artifacts and untracked inputs * fix: reconcile scheduler state and make stop win startup races * fix: isolate cron generations and serialize scheduler recovery
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
const fs = require('node:fs');
|
||||
const path = require('node:path');
|
||||
const crypto = require('node:crypto');
|
||||
|
||||
// Include every artifact, including imported backend modules and frontend chunks.
|
||||
function collectBuildFiles(root = 'static') {
|
||||
const files = {};
|
||||
function visit(relative) {
|
||||
for (const name of fs.readdirSync(path.join(root, relative)).sort()) {
|
||||
const entry = relative ? `${relative}/${name}` : name;
|
||||
if (entry === 'build-info.json') continue;
|
||||
const file = path.join(root, entry);
|
||||
const stat = fs.lstatSync(file);
|
||||
if (stat.isSymbolicLink())
|
||||
throw new Error(`Build output symlink: ${entry}`);
|
||||
if (stat.isDirectory()) visit(entry);
|
||||
else if (stat.isFile()) {
|
||||
files[entry] = crypto
|
||||
.createHash('sha256')
|
||||
.update(fs.readFileSync(file))
|
||||
.digest('hex');
|
||||
} else throw new Error(`Unsupported build output: ${entry}`);
|
||||
}
|
||||
}
|
||||
visit('');
|
||||
return files;
|
||||
}
|
||||
module.exports = { collectBuildFiles };
|
||||
Reference in New Issue
Block a user