mirror of
https://github.com/whyour/qinglong.git
synced 2026-11-30 16:27:21 +08:00
Return committed trigger IDs and add CLI wait and trigger-specific logs while preserving API, CLI, transaction, deduplication and unknown-result semantics. Move scheduling, lifecycle, settlement, queries and legacy adapters into back/cron; remove obsolete internal import paths and circular dependencies. Apply project formatting across the repository, cover CJS/MJS in formatting hooks, add prettier:check and require formatting checks in AGENTS.md. Validation: backend build; 1398 backend/frontend tests passed (17 platform skips); 327 CLI tests passed (6 platform skips); 670 files pass format checks.
48 lines
1.4 KiB
JavaScript
48 lines
1.4 KiB
JavaScript
const fs = require('node:fs');
|
|
const path = require('node:path');
|
|
const { execFileSync } = require('node:child_process');
|
|
const prettier = require('prettier');
|
|
|
|
process.chdir(path.resolve(__dirname, '..'));
|
|
const check = process.argv.includes('--check');
|
|
// Include new source files, but never build output or ignored local tooling.
|
|
const files = new Set(
|
|
execFileSync(
|
|
'git',
|
|
['ls-files', '-z', '--cached', '--others', '--exclude-standard'],
|
|
{
|
|
encoding: 'utf8',
|
|
maxBuffer: 16 * 1024 * 1024,
|
|
},
|
|
)
|
|
.split('\0')
|
|
.filter(Boolean),
|
|
);
|
|
let checked = 0;
|
|
let changed = 0;
|
|
for (const file of [...files].sort()) {
|
|
if (!fs.existsSync(file) || !fs.lstatSync(file).isFile()) continue;
|
|
const info = prettier.getFileInfo.sync(file, {
|
|
ignorePath: '.prettierignore',
|
|
});
|
|
if (info.ignored) continue;
|
|
const options = {
|
|
...prettier.resolveConfig.sync(file, { editorconfig: true }),
|
|
filepath: file,
|
|
};
|
|
if (!info.inferredParser && !options.parser) continue;
|
|
checked++;
|
|
const original = fs.readFileSync(file, 'utf8');
|
|
const formatted = prettier.format(original, options);
|
|
if (original === formatted) continue;
|
|
changed++;
|
|
console.log(file);
|
|
if (!check) fs.writeFileSync(file, formatted);
|
|
}
|
|
console.log(
|
|
`${checked} files checked; ${changed} ${
|
|
check ? 'need formatting' : 'formatted'
|
|
}.`,
|
|
);
|
|
if (check && changed) process.exitCode = 1;
|