gtfs-to-html 2.12.7 → 2.12.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -1
- package/config-sample.json +4 -4
- package/dist/app/index.js +37 -35
- package/dist/app/index.js.map +1 -1
- package/dist/bin/gtfs-to-html.js +36 -21
- package/dist/bin/gtfs-to-html.js.map +1 -1
- package/dist/index.js +36 -21
- package/dist/index.js.map +1 -1
- package/package.json +11 -7
package/README.md
CHANGED
|
@@ -66,6 +66,7 @@ Many transit agencies use `gtfs-to-html` to generate the schedule pages used on
|
|
|
66
66
|
| [Brockton Area Transit Authority](https://ridebat.com) | Brockton, Massachusetts |
|
|
67
67
|
| [Cape Ann Transportation Authority](https://canntran.com) | Gloucester, Massachusetts |
|
|
68
68
|
| [Capital Transit](https://juneaucapitaltransit.org) | Juneau, Alaska |
|
|
69
|
+
| [Cascades East Transit](https://cascadeseasttransit.com) | Bend, Oregon |
|
|
69
70
|
| [Central Transit](https://centraltransit.org) | Ellensburg, Washington |
|
|
70
71
|
| [Citibus](https://citibus.com) | Lubbock, Texas |
|
|
71
72
|
| [Commute.org](https://commute.org) | San Mateo County, California |
|
|
@@ -77,7 +78,7 @@ Many transit agencies use `gtfs-to-html` to generate the schedule pages used on
|
|
|
77
78
|
| [Kings Area Rural Transit (KART)](https://www.kartbus.org) | Kings County, California |
|
|
78
79
|
| [Lowell Regional Transit Authority](https://lrta.com) | Lowell, Massachusetts |
|
|
79
80
|
| [Madera County Connection](https://mcctransit.com) | Madera County, California |
|
|
80
|
-
| [Marin Transit](https://marintransit.
|
|
81
|
+
| [Marin Transit](https://marintransit.gov) | Marin County, California |
|
|
81
82
|
| [Morongo Basin Transit Authority](https://mbtabus.com) | Morongo Basin, California |
|
|
82
83
|
| [Mountain Transit](https://mountaintransit.org) | Big Bear Valley, California |
|
|
83
84
|
| [Mountain View Community Shuttle](https://mvcommunityshuttle.com) | Mountain View, California |
|
package/config-sample.json
CHANGED
|
@@ -2,15 +2,15 @@
|
|
|
2
2
|
"agencies": [
|
|
3
3
|
{
|
|
4
4
|
"agencyKey": "marintransit",
|
|
5
|
-
"url": "https://marintransit.
|
|
5
|
+
"url": "https://marintransit.gov/data/google_transit.zip",
|
|
6
6
|
"realtimeAlerts": {
|
|
7
|
-
"url": "https://api.marintransit.
|
|
7
|
+
"url": "https://api.marintransit.gov/alerts"
|
|
8
8
|
},
|
|
9
9
|
"realtimeTripUpdates": {
|
|
10
|
-
"url": "https://api.marintransit.
|
|
10
|
+
"url": "https://api.marintransit.gov/tripupdates"
|
|
11
11
|
},
|
|
12
12
|
"realtimeVehiclePositions": {
|
|
13
|
-
"url": "https://api.marintransit.
|
|
13
|
+
"url": "https://api.marintransit.gov/vehiclepositions"
|
|
14
14
|
}
|
|
15
15
|
}
|
|
16
16
|
],
|
package/dist/app/index.js
CHANGED
|
@@ -330,6 +330,27 @@ function isGtfsToHtmlError(error) {
|
|
|
330
330
|
return candidate.name === "GtfsToHtmlError" && typeof candidate.message === "string" && typeof candidate.code === "string" && typeof candidate.category === "string" && typeof candidate.isOperational === "boolean";
|
|
331
331
|
}
|
|
332
332
|
|
|
333
|
+
// src/lib/log-utils.ts
|
|
334
|
+
import { clearLine, cursorTo } from "readline";
|
|
335
|
+
import { noop } from "lodash-es";
|
|
336
|
+
import * as colors from "yoctocolors";
|
|
337
|
+
import { getAgencies, getFeedInfo, isGtfsError as isGtfsError2, formatGtfsError } from "gtfs";
|
|
338
|
+
import Table from "cli-table";
|
|
339
|
+
function logWarning(config2) {
|
|
340
|
+
if (config2.logFunction) {
|
|
341
|
+
return config2.logFunction;
|
|
342
|
+
}
|
|
343
|
+
return (text) => {
|
|
344
|
+
process.stdout.write(`
|
|
345
|
+
${formatWarning(text)}
|
|
346
|
+
`);
|
|
347
|
+
};
|
|
348
|
+
}
|
|
349
|
+
function formatWarning(text) {
|
|
350
|
+
const warningMessage = `${colors.underline("Warning")}: ${text}`;
|
|
351
|
+
return colors.yellow(warningMessage);
|
|
352
|
+
}
|
|
353
|
+
|
|
333
354
|
// src/lib/file-utils.ts
|
|
334
355
|
var homeDirectory = homedir();
|
|
335
356
|
function getPathToThisModuleFolder() {
|
|
@@ -405,27 +426,6 @@ import { getShapesAsGeoJSON, getStopsAsGeoJSON } from "gtfs";
|
|
|
405
426
|
import simplify from "@turf/simplify";
|
|
406
427
|
import { featureCollection, round } from "@turf/helpers";
|
|
407
428
|
|
|
408
|
-
// src/lib/log-utils.ts
|
|
409
|
-
import { clearLine, cursorTo } from "readline";
|
|
410
|
-
import { noop } from "lodash-es";
|
|
411
|
-
import * as colors from "yoctocolors";
|
|
412
|
-
import { getAgencies, getFeedInfo, isGtfsError as isGtfsError2, formatGtfsError } from "gtfs";
|
|
413
|
-
import Table from "cli-table";
|
|
414
|
-
function logWarning(config2) {
|
|
415
|
-
if (config2.logFunction) {
|
|
416
|
-
return config2.logFunction;
|
|
417
|
-
}
|
|
418
|
-
return (text) => {
|
|
419
|
-
process.stdout.write(`
|
|
420
|
-
${formatWarning(text)}
|
|
421
|
-
`);
|
|
422
|
-
};
|
|
423
|
-
}
|
|
424
|
-
function formatWarning(text) {
|
|
425
|
-
const warningMessage = `${colors.underline("Warning")}: ${text}`;
|
|
426
|
-
return colors.yellow(warningMessage);
|
|
427
|
-
}
|
|
428
|
-
|
|
429
429
|
// src/lib/trip-id-utils.ts
|
|
430
430
|
var getBaseTripId = (tripId) => tripId.replace(/_freq_\d+$/, "");
|
|
431
431
|
var getBaseTripIds = (trips) => Array.from(new Set(trips.map((trip) => getBaseTripId(trip.trip_id))));
|
|
@@ -509,7 +509,7 @@ function getAgencyGeoJSON(config2) {
|
|
|
509
509
|
// package.json
|
|
510
510
|
var package_default = {
|
|
511
511
|
name: "gtfs-to-html",
|
|
512
|
-
version: "2.12.
|
|
512
|
+
version: "2.12.8",
|
|
513
513
|
private: false,
|
|
514
514
|
description: "Build human readable transit timetables as HTML, PDF or CSV from GTFS",
|
|
515
515
|
keywords: [
|
|
@@ -572,8 +572,8 @@ var package_default = {
|
|
|
572
572
|
"gtfs-realtime-pbf-js-module": "^1.0.0",
|
|
573
573
|
"js-beautify": "^1.15.4",
|
|
574
574
|
"lodash-es": "^4.18.1",
|
|
575
|
-
"maplibre-gl": "^5.
|
|
576
|
-
marked: "^
|
|
575
|
+
"maplibre-gl": "^5.23.0",
|
|
576
|
+
marked: "^18.0.0",
|
|
577
577
|
moment: "^2.30.1",
|
|
578
578
|
pbf: "^4.0.1",
|
|
579
579
|
"pretty-error": "^4.0.0",
|
|
@@ -600,7 +600,7 @@ var package_default = {
|
|
|
600
600
|
"@types/yargs": "^17.0.35",
|
|
601
601
|
husky: "^9.1.7",
|
|
602
602
|
"lint-staged": "^16.4.0",
|
|
603
|
-
prettier: "^3.8.
|
|
603
|
+
prettier: "^3.8.2",
|
|
604
604
|
tsup: "^8.5.1",
|
|
605
605
|
typescript: "^6.0.2"
|
|
606
606
|
},
|
|
@@ -624,9 +624,13 @@ var package_default = {
|
|
|
624
624
|
singleQuote: true
|
|
625
625
|
},
|
|
626
626
|
"lint-staged": {
|
|
627
|
-
"*.js": "prettier --write"
|
|
628
|
-
|
|
629
|
-
|
|
627
|
+
"*.{js,ts,json}": "prettier --write"
|
|
628
|
+
},
|
|
629
|
+
pnpm: {
|
|
630
|
+
onlyBuiltDependencies: [
|
|
631
|
+
"better-sqlite3",
|
|
632
|
+
"puppeteer"
|
|
633
|
+
]
|
|
630
634
|
}
|
|
631
635
|
};
|
|
632
636
|
|
|
@@ -1251,9 +1255,8 @@ var getCalendarsFromConfig = (config2) => {
|
|
|
1251
1255
|
}
|
|
1252
1256
|
const calendars = db.prepare(`SELECT * FROM calendar ${whereClause}`).all();
|
|
1253
1257
|
const serviceIds = calendars.map((calendar) => calendar.service_id);
|
|
1254
|
-
const
|
|
1255
|
-
|
|
1256
|
-
).all();
|
|
1258
|
+
const calendarDatesQuery = serviceIds.length > 0 ? `SELECT * FROM calendar_dates WHERE exception_type = 1 AND service_id NOT IN (${serviceIds.map((serviceId) => sqlString.escape(serviceId)).join(", ")})` : "SELECT * FROM calendar_dates WHERE exception_type = 1";
|
|
1259
|
+
const calendarDates = db.prepare(calendarDatesQuery).all();
|
|
1257
1260
|
return {
|
|
1258
1261
|
calendars,
|
|
1259
1262
|
calendarDates
|
|
@@ -1325,10 +1328,9 @@ var getCalendarDatesForDateRange = (startDate, endDate) => {
|
|
|
1325
1328
|
if (startDate) {
|
|
1326
1329
|
whereClauses.push(`date >= ${sqlString.escape(startDate)}`);
|
|
1327
1330
|
}
|
|
1331
|
+
const whereClause = whereClauses.length > 0 ? ` WHERE ${whereClauses.join(" AND ")}` : "";
|
|
1328
1332
|
const calendarDates = db.prepare(
|
|
1329
|
-
`SELECT service_id, date, exception_type FROM calendar_dates
|
|
1330
|
-
" AND "
|
|
1331
|
-
)}`
|
|
1333
|
+
`SELECT service_id, date, exception_type FROM calendar_dates${whereClause}`
|
|
1332
1334
|
).all();
|
|
1333
1335
|
return calendarDates;
|
|
1334
1336
|
};
|
|
@@ -1807,7 +1809,7 @@ var getTimetablePageById = (timetablePageId, config2) => {
|
|
|
1807
1809
|
}
|
|
1808
1810
|
if (timetablePageId.startsWith("route_")) {
|
|
1809
1811
|
const routes = getRoutes({
|
|
1810
|
-
route_id: timetablePageId.
|
|
1812
|
+
route_id: timetablePageId.slice("route_".length)
|
|
1811
1813
|
});
|
|
1812
1814
|
if (routes.length === 0) {
|
|
1813
1815
|
throw new GtfsToHtmlError(
|