fix(判据): 读取欠账登记改用 prose(判据目录不得出现裸 readFileSync)
我自己刚踩的:往 run-all.mjs 里写余额时用了 readFileSync,被判据目录的读取纪律抓住。 JSON 属于数据 → 按既有约定走 prose。
This commit is contained in:
@ -23,7 +23,6 @@
|
|||||||
*/
|
*/
|
||||||
import { prose } from './lib/read.mjs';
|
import { prose } from './lib/read.mjs';
|
||||||
import { spawnSync } from 'node:child_process';
|
import { spawnSync } from 'node:child_process';
|
||||||
import { readFileSync } from 'node:fs';
|
|
||||||
import { existsSync, readdirSync } from 'node:fs';
|
import { existsSync, readdirSync } from 'node:fs';
|
||||||
import { dirname, join } from 'node:path';
|
import { dirname, join } from 'node:path';
|
||||||
import { fileURLToPath } from 'node:url';
|
import { fileURLToPath } from 'node:url';
|
||||||
@ -515,7 +514,7 @@ if (skippedByPhase.length) {
|
|||||||
*/
|
*/
|
||||||
let debtsLine = '';
|
let debtsLine = '';
|
||||||
try {
|
try {
|
||||||
const led = JSON.parse(readFileSync(join(HERE, '..', '..', '..', 'docs', 'DEBTS.json'), 'utf8'));
|
const led = JSON.parse(prose(join(HERE, '..', '..', '..', 'docs', 'DEBTS.json')));
|
||||||
const items = led.debts.map(d => `${d.id}:${d.count}`).join(',');
|
const items = led.debts.map(d => `${d.id}:${d.count}`).join(',');
|
||||||
const total = led.debts.reduce((n, d) => n + d.count, 0);
|
const total = led.debts.reduce((n, d) => n + d.count, 0);
|
||||||
debtsLine = ` debts=${total}(${items})`;
|
debtsLine = ` debts=${total}(${items})`;
|
||||||
|
|||||||
Reference in New Issue
Block a user