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.
Files changed (40) hide show
  1. package/config-sample.json +68 -0
  2. package/dist/app/index.js +2 -1
  3. package/dist/app/index.js.map +1 -1
  4. package/dist/bin/gtfs-to-html.js +16 -9
  5. package/dist/bin/gtfs-to-html.js.map +1 -1
  6. package/dist/index.js +16 -9
  7. package/dist/index.js.map +1 -1
  8. package/docker/Dockerfile +14 -0
  9. package/docker/README.md +5 -0
  10. package/docker/config.json +21 -0
  11. package/docker/docker-compose.yml +10 -0
  12. package/examples/stop_attributes.txt +6 -0
  13. package/examples/timetable_notes.txt +8 -0
  14. package/examples/timetable_notes_references.txt +8 -0
  15. package/examples/timetable_pages.txt +3 -0
  16. package/examples/timetable_stop_order.txt +16 -0
  17. package/examples/timetables.txt +9 -0
  18. package/package.json +8 -3
  19. package/views/default/css/overview_styles.css +198 -0
  20. package/views/default/css/timetable_pdf_styles.css +69 -0
  21. package/views/default/css/timetable_styles.css +522 -0
  22. package/views/default/formatting_functions.pug +104 -0
  23. package/views/default/js/system-map.js +594 -0
  24. package/views/default/js/timetable-map.js +753 -0
  25. package/views/default/js/timetable-menu.js +57 -0
  26. package/views/default/layout.pug +11 -0
  27. package/views/default/overview.pug +27 -0
  28. package/views/default/overview_full.pug +16 -0
  29. package/views/default/timetable_continuation_as.pug +7 -0
  30. package/views/default/timetable_continuation_from.pug +7 -0
  31. package/views/default/timetable_horizontal.pug +42 -0
  32. package/views/default/timetable_hourly.pug +30 -0
  33. package/views/default/timetable_map.pug +15 -0
  34. package/views/default/timetable_menu.pug +48 -0
  35. package/views/default/timetable_note_symbol.pug +5 -0
  36. package/views/default/timetable_stop_name.pug +13 -0
  37. package/views/default/timetable_stoptime.pug +17 -0
  38. package/views/default/timetable_vertical.pug +67 -0
  39. package/views/default/timetablepage.pug +64 -0
  40. package/views/default/timetablepage_full.pug +25 -0
package/dist/index.js CHANGED
@@ -16,7 +16,7 @@ import Timer from "timer-machine";
16
16
  import path from "node:path";
17
17
  import { createWriteStream } from "node:fs";
18
18
  import { fileURLToPath } from "node:url";
19
- import { cp, copyFile, readFile, rm, mkdir } from "node:fs/promises";
19
+ import { access, cp, copyFile, mkdir, readFile, rm } from "node:fs/promises";
20
20
  import _ from "lodash-es";
21
21
  import archiver from "archiver";
22
22
  import beautify from "js-beautify";
@@ -325,7 +325,7 @@ function formatTripNameForCSV(trip, timetable) {
325
325
  }
326
326
 
327
327
  // package.json
328
- var version = "2.8.1";
328
+ var version = "2.9.1";
329
329
 
330
330
  // src/lib/utils.ts
331
331
  var isTimepoint = (stoptime) => {
@@ -1301,6 +1301,7 @@ function setDefaultConfig(initialConfig) {
1301
1301
  const config = Object.assign(defaults, initialConfig);
1302
1302
  if (config.outputFormat === "pdf") {
1303
1303
  config.noHead = false;
1304
+ config.menuType = "none";
1304
1305
  }
1305
1306
  config.hasGtfsRealtime = config.agencies.some(
1306
1307
  (agency) => agency.realtimeTripUpdates?.url || agency.realtimeVehiclePositions?.url
@@ -1809,12 +1810,18 @@ async function prepDirectory(exportPath) {
1809
1810
  }
1810
1811
  async function copyStaticAssets(config, exportPath) {
1811
1812
  const staticAssetPath = config.templatePath === void 0 ? path.join(fileURLToPath(import.meta.url), "../../../views/default") : untildify(config.templatePath);
1812
- await cp(path.join(staticAssetPath, "css"), path.join(exportPath, "css"), {
1813
- recursive: true
1814
- });
1815
- await cp(path.join(staticAssetPath, "js"), path.join(exportPath, "js"), {
1816
- recursive: true
1817
- });
1813
+ const foldersToCopy = ["css", "js", "img"];
1814
+ for (const folder of foldersToCopy) {
1815
+ if (await access(path.join(staticAssetPath, folder)).then(() => true).catch(() => false)) {
1816
+ await cp(
1817
+ path.join(staticAssetPath, folder),
1818
+ path.join(exportPath, folder),
1819
+ {
1820
+ recursive: true
1821
+ }
1822
+ );
1823
+ }
1824
+ }
1818
1825
  if (config.hasGtfsRealtime) {
1819
1826
  await copyFile(
1820
1827
  "node_modules/pbf/dist/pbf.js",
@@ -1878,7 +1885,7 @@ async function renderPdf(htmlPath) {
1878
1885
  const pdfPath = htmlPath.replace(/html$/, "pdf");
1879
1886
  const browser = await puppeteer.launch();
1880
1887
  const page = await browser.newPage();
1881
- await page.emulateMediaType("screen");
1888
+ await page.emulateMediaType("print");
1882
1889
  await page.goto(`file://${htmlPath}`, {
1883
1890
  waitUntil: "networkidle0"
1884
1891
  });