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
@@ -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, mkdir } from "node:fs/promises";
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.8.1";
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
- await cp(path.join(staticAssetPath, "css"), path.join(exportPath, "css"), {
1836
- recursive: true
1837
- });
1838
- await cp(path.join(staticAssetPath, "js"), path.join(exportPath, "js"), {
1839
- recursive: true
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("screen");
1911
+ await page.emulateMediaType("print");
1905
1912
  await page.goto(`file://${htmlPath}`, {
1906
1913
  waitUntil: "networkidle0"
1907
1914
  });