gtfs-to-html 2.9.0 → 2.9.2
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/config-sample.json +68 -0
- package/dist/app/index.js +2 -1
- package/dist/app/index.js.map +1 -1
- package/dist/bin/gtfs-to-html.js +16 -9
- package/dist/bin/gtfs-to-html.js.map +1 -1
- package/dist/index.js +16 -9
- package/dist/index.js.map +1 -1
- package/docker/Dockerfile +14 -0
- package/docker/README.md +5 -0
- package/docker/config.json +21 -0
- package/docker/docker-compose.yml +10 -0
- package/examples/stop_attributes.txt +6 -0
- package/examples/timetable_notes.txt +8 -0
- package/examples/timetable_notes_references.txt +8 -0
- package/examples/timetable_pages.txt +3 -0
- package/examples/timetable_stop_order.txt +16 -0
- package/examples/timetables.txt +9 -0
- package/package.json +8 -3
- package/views/default/css/overview_styles.css +198 -0
- package/views/default/css/timetable_pdf_styles.css +69 -0
- package/views/default/css/timetable_styles.css +522 -0
- package/views/default/formatting_functions.pug +104 -0
- package/views/default/js/system-map.js +594 -0
- package/views/default/js/timetable-map.js +753 -0
- package/views/default/js/timetable-menu.js +57 -0
- package/views/default/layout.pug +11 -0
- package/views/default/overview.pug +27 -0
- package/views/default/overview_full.pug +16 -0
- package/views/default/timetable_continuation_as.pug +7 -0
- package/views/default/timetable_continuation_from.pug +7 -0
- package/views/default/timetable_horizontal.pug +42 -0
- package/views/default/timetable_hourly.pug +30 -0
- package/views/default/timetable_map.pug +15 -0
- package/views/default/timetable_menu.pug +48 -0
- package/views/default/timetable_note_symbol.pug +5 -0
- package/views/default/timetable_stop_name.pug +13 -0
- package/views/default/timetable_stoptime.pug +17 -0
- package/views/default/timetable_vertical.pug +67 -0
- package/views/default/timetablepage.pug +64 -0
- package/views/default/timetablepage_full.pug +25 -0
package/dist/bin/gtfs-to-html.js
CHANGED
|
@@ -14,7 +14,7 @@ import PrettyError from "pretty-error";
|
|
|
14
14
|
import path from "node:path";
|
|
15
15
|
import { createWriteStream } from "node:fs";
|
|
16
16
|
import { fileURLToPath } from "node:url";
|
|
17
|
-
import { cp, copyFile, readFile, rm
|
|
17
|
+
import { access, cp, copyFile, mkdir, readFile, rm } from "node:fs/promises";
|
|
18
18
|
import _ from "lodash-es";
|
|
19
19
|
import archiver from "archiver";
|
|
20
20
|
import beautify from "js-beautify";
|
|
@@ -323,7 +323,7 @@ function formatTripNameForCSV(trip, timetable) {
|
|
|
323
323
|
}
|
|
324
324
|
|
|
325
325
|
// package.json
|
|
326
|
-
var version = "2.
|
|
326
|
+
var version = "2.9.1";
|
|
327
327
|
|
|
328
328
|
// src/lib/utils.ts
|
|
329
329
|
var isTimepoint = (stoptime) => {
|
|
@@ -1299,6 +1299,7 @@ function setDefaultConfig(initialConfig) {
|
|
|
1299
1299
|
const config = Object.assign(defaults, initialConfig);
|
|
1300
1300
|
if (config.outputFormat === "pdf") {
|
|
1301
1301
|
config.noHead = false;
|
|
1302
|
+
config.menuType = "none";
|
|
1302
1303
|
}
|
|
1303
1304
|
config.hasGtfsRealtime = config.agencies.some(
|
|
1304
1305
|
(agency) => agency.realtimeTripUpdates?.url || agency.realtimeVehiclePositions?.url
|
|
@@ -1832,12 +1833,18 @@ async function prepDirectory(exportPath) {
|
|
|
1832
1833
|
}
|
|
1833
1834
|
async function copyStaticAssets(config, exportPath) {
|
|
1834
1835
|
const staticAssetPath = config.templatePath === void 0 ? path.join(fileURLToPath(import.meta.url), "../../../views/default") : untildify(config.templatePath);
|
|
1835
|
-
|
|
1836
|
-
|
|
1837
|
-
|
|
1838
|
-
|
|
1839
|
-
|
|
1840
|
-
|
|
1836
|
+
const foldersToCopy = ["css", "js", "img"];
|
|
1837
|
+
for (const folder of foldersToCopy) {
|
|
1838
|
+
if (await access(path.join(staticAssetPath, folder)).then(() => true).catch(() => false)) {
|
|
1839
|
+
await cp(
|
|
1840
|
+
path.join(staticAssetPath, folder),
|
|
1841
|
+
path.join(exportPath, folder),
|
|
1842
|
+
{
|
|
1843
|
+
recursive: true
|
|
1844
|
+
}
|
|
1845
|
+
);
|
|
1846
|
+
}
|
|
1847
|
+
}
|
|
1841
1848
|
if (config.hasGtfsRealtime) {
|
|
1842
1849
|
await copyFile(
|
|
1843
1850
|
"node_modules/pbf/dist/pbf.js",
|
|
@@ -1901,7 +1908,7 @@ async function renderPdf(htmlPath) {
|
|
|
1901
1908
|
const pdfPath = htmlPath.replace(/html$/, "pdf");
|
|
1902
1909
|
const browser = await puppeteer.launch();
|
|
1903
1910
|
const page = await browser.newPage();
|
|
1904
|
-
await page.emulateMediaType("
|
|
1911
|
+
await page.emulateMediaType("print");
|
|
1905
1912
|
await page.goto(`file://${htmlPath}`, {
|
|
1906
1913
|
waitUntil: "networkidle0"
|
|
1907
1914
|
});
|