Standalone batch file: clones (or pulls), installs, builds, seeds the reporter settings, and writes a start-autofirmer.bat. Prompts for the master dashboard URL and instance name, defaulting to %COMPUTERNAME%. Two install hazards it handles: - better-sqlite3 has no prebuilt binary above Node 22, so install silently falls back to node-gyp and dies without Visual Studio Build Tools. The script warns first and names the fix if install fails anyway - playwright is declared but referenced nowhere in the source, so its postinstall browser download is skipped Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
32 lines
1.0 KiB
JavaScript
32 lines
1.0 KiB
JavaScript
/**
|
|
* Writes the reporter settings into autotrader.sqlite before first launch.
|
|
*
|
|
* lib/db.ts seeds these keys with INSERT OR IGNORE, so values written here
|
|
* survive the app's own startup seeding. Must be run from the project root —
|
|
* lib/db.ts opens the database at process.cwd().
|
|
*
|
|
* node scripts/seed-settings.js <master_dashboard_url> <instance_name>
|
|
*/
|
|
const path = require('path');
|
|
const Database = require('better-sqlite3');
|
|
|
|
const [, , url, name] = process.argv;
|
|
|
|
const db = new Database(path.join(process.cwd(), 'autotrader.sqlite'));
|
|
db.exec(`
|
|
CREATE TABLE IF NOT EXISTS settings (
|
|
key TEXT PRIMARY KEY,
|
|
value TEXT NOT NULL
|
|
);
|
|
`);
|
|
|
|
const upsert = db.prepare(
|
|
'INSERT INTO settings (key, value) VALUES (?, ?) ' +
|
|
'ON CONFLICT(key) DO UPDATE SET value = excluded.value'
|
|
);
|
|
|
|
if (url) { upsert.run('master_dashboard_url', url); console.log(' master_dashboard_url = ' + url); }
|
|
if (name) { upsert.run('instance_name', name); console.log(' instance_name = ' + name); }
|
|
|
|
db.close();
|