gtfs
Version:
Import GTFS transit data into SQLite and query routes, stops, times, fares and more
37 lines (35 loc) • 1.16 kB
JavaScript
import { Et as formatStackTrace, Tt as formatError, ct as importGtfs, ft as openDb, ut as closeDb, xt as getConfig } from "../src-dE_3s7mh.js";
import yargs from "yargs";
import { hideBin } from "yargs/helpers";
//#region src/bin/gtfs-import.ts
const argv = yargs(hideBin(process.argv)).usage("Usage: $0 --configPath ./config.json").help().option("c", {
alias: "configPath",
describe: "Path to config file",
type: "string"
}).option("gtfsPath", {
describe: "Path to gtfs (zipped or unzipped)",
type: "string"
}).option("gtfsUrl", {
describe: "URL of gtfs file",
type: "string"
}).option("sqlitePath", {
describe: "Path to SQLite database",
type: "string"
}).parseSync();
const handleError = (error = "Unknown Error") => {
process.stdout.write(`\n${formatError(error)}\n`);
console.error(formatStackTrace(error));
process.exit(1);
};
const setupImport = async () => {
const config = await getConfig(argv);
await importGtfs(config);
const db = openDb(config);
if (db.name !== ":memory:") closeDb(db);
process.exit();
};
setupImport().catch(handleError);
//#endregion
export { };
//# sourceMappingURL=gtfs-import.js.map