debug: log outputFolder + JSON files to docker logs; fix walker to use stat
- runner.js: console.log outputFolder, sitespeed INFO lines, and find output after test so everything appears in docker logs - parser.js: switch walker from withFileTypes to stat (more reliable on Docker volumes); log every directory visited Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
21
parser.js
21
parser.js
@@ -1,4 +1,4 @@
|
||||
import { readdir, readFile } from 'fs/promises';
|
||||
import { readdir, readFile, stat } from 'fs/promises';
|
||||
import { join } from 'path';
|
||||
|
||||
/**
|
||||
@@ -11,19 +11,22 @@ async function findPageSummaries(outputFolder) {
|
||||
const errors = [];
|
||||
|
||||
async function walk(dir) {
|
||||
let entries;
|
||||
let names;
|
||||
try {
|
||||
entries = await readdir(dir, { withFileTypes: true });
|
||||
names = await readdir(dir);
|
||||
} catch (err) {
|
||||
errors.push(`readdir failed on ${dir}: ${err.message}`);
|
||||
errors.push(`readdir(${dir}): ${err.message}`);
|
||||
return;
|
||||
}
|
||||
for (const e of entries) {
|
||||
const full = join(dir, e.name);
|
||||
if (e.isDirectory()) {
|
||||
console.log(`[parser] walk ${dir} → [${names.join(', ')}]`);
|
||||
for (const name of names) {
|
||||
const full = join(dir, name);
|
||||
let s;
|
||||
try { s = await stat(full); } catch { continue; }
|
||||
if (s.isDirectory()) {
|
||||
await walk(full);
|
||||
} else if (e.name.endsWith('.pageSummary.json')) {
|
||||
const plugin = e.name.replace('.pageSummary.json', '');
|
||||
} else if (name.endsWith('.pageSummary.json')) {
|
||||
const plugin = name.replace('.pageSummary.json', '');
|
||||
if (!summaries[plugin]) summaries[plugin] = [];
|
||||
summaries[plugin].push(full);
|
||||
console.log(`[parser] found: ${full}`);
|
||||
|
||||
Reference in New Issue
Block a user