refactor: remove --test-parse debug block from discovermass importer
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -95,7 +95,6 @@ interface CLIArgs {
|
||||
dryRun: boolean;
|
||||
resumeFrom?: number;
|
||||
jobId?: string;
|
||||
testParse?: boolean;
|
||||
}
|
||||
|
||||
// ─── Day Mappings ─────────────────────────────────────────────────────────────
|
||||
@@ -509,39 +508,16 @@ function parseCLIArgs(): CLIArgs {
|
||||
case '--dry-run': result.dryRun = true; break;
|
||||
case '--resume-from': result.resumeFrom = parseInt(args[++i], 10); break;
|
||||
case '--job-id': result.jobId = args[++i]; break;
|
||||
case '--test-parse': result.testParse = true; break;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
// ─── Test Parse ───────────────────────────────────────────────────────────────
|
||||
|
||||
async function runTestParse() {
|
||||
const testUrl = 'https://discovermass.com/church/st-paul-the-apostle-chino-hills/';
|
||||
console.log(`Fetching test page: ${testUrl}`);
|
||||
const html = await fetchHtml(testUrl);
|
||||
const church = parseChurch(html);
|
||||
const masses = parseMassTimes(html);
|
||||
const { confessions, adorations } = parseOtherServices(html);
|
||||
console.log('Church:', JSON.stringify(church, null, 2));
|
||||
console.log(`Masses (${masses.length}):`, JSON.stringify(masses, null, 2));
|
||||
console.log(`Confessions (${confessions.length}):`, JSON.stringify(confessions, null, 2));
|
||||
console.log(`Adorations (${adorations.length}):`, JSON.stringify(adorations, null, 2));
|
||||
await pool.end();
|
||||
process.exit(0);
|
||||
}
|
||||
|
||||
// ─── Main ─────────────────────────────────────────────────────────────────────
|
||||
|
||||
async function main() {
|
||||
const args = parseCLIArgs();
|
||||
|
||||
if (args.testParse) {
|
||||
await runTestParse();
|
||||
return;
|
||||
}
|
||||
|
||||
if (!args.all) {
|
||||
console.error('Usage: npx tsx scripts/import-discovermass.ts --all [--dry-run] [--resume-from N] [--job-id UUID]');
|
||||
process.exit(1);
|
||||
|
||||
Reference in New Issue
Block a user