33 lines
695 B
JavaScript
33 lines
695 B
JavaScript
|
|
#!/usr/bin/env node
|
||
|
|
/**
|
||
|
|
* Run MTG + Pokémon + Lorcana bulk syncs (with pricing ingest) against POSTGRES_URL.
|
||
|
|
*
|
||
|
|
* Usage:
|
||
|
|
* node --env-file=.env.local scripts/run-unified-catalog-sync.js
|
||
|
|
*/
|
||
|
|
|
||
|
|
import { runUnifiedCatalogSync } from '../lib/card-import/sync-catalog.js';
|
||
|
|
import { closeSqlPool } from '../lib/sql.js';
|
||
|
|
|
||
|
|
async function main() {
|
||
|
|
const summary = await runUnifiedCatalogSync();
|
||
|
|
console.log(JSON.stringify(summary, null, 2));
|
||
|
|
|
||
|
|
if (summary.errors?.length) {
|
||
|
|
process.exitCode = 1;
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
main()
|
||
|
|
.catch((err) => {
|
||
|
|
console.error(err);
|
||
|
|
process.exitCode = 1;
|
||
|
|
})
|
||
|
|
.finally(async () => {
|
||
|
|
try {
|
||
|
|
await closeSqlPool();
|
||
|
|
} catch {
|
||
|
|
// ignore
|
||
|
|
}
|
||
|
|
});
|