gtfs-to-html 2.12.1 → 2.12.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.
@@ -25,7 +25,6 @@ import {
25
25
  rm
26
26
  } from "fs/promises";
27
27
  import { homedir } from "os";
28
- import { findPackageJSON } from "module";
29
28
  import * as _ from "lodash-es";
30
29
  import { uniqBy as uniqBy2 } from "lodash-es";
31
30
  import archiver from "archiver";
@@ -494,7 +493,7 @@ function formatTripNameForCSV(trip, timetable) {
494
493
  // package.json
495
494
  var package_default = {
496
495
  name: "gtfs-to-html",
497
- version: "2.12.1",
496
+ version: "2.12.2",
498
497
  private: false,
499
498
  description: "Build human readable transit timetables as HTML, PDF or CSV from GTFS",
500
499
  keywords: [
@@ -529,6 +528,7 @@ var package_default = {
529
528
  "dist",
530
529
  "docker",
531
530
  "examples",
531
+ "scripts",
532
532
  "views/default",
533
533
  "config-sample.json"
534
534
  ],
@@ -537,30 +537,32 @@ var package_default = {
537
537
  },
538
538
  scripts: {
539
539
  build: "tsup",
540
+ postbuild: "node scripts/postinstall.js",
540
541
  start: "node ./dist/app",
541
- prepare: "husky"
542
+ prepare: "husky && npm run build",
543
+ postinstall: "node scripts/postinstall.js"
542
544
  },
543
545
  dependencies: {
544
546
  "@maplibre/maplibre-gl-geocoder": "^1.9.1",
545
- "@turf/helpers": "^7.3.0",
546
- "@turf/simplify": "^7.3.0",
547
+ "@turf/helpers": "^7.3.1",
548
+ "@turf/simplify": "^7.3.1",
547
549
  anchorme: "^3.0.8",
548
550
  archiver: "^7.0.1",
549
551
  "cli-table": "^0.3.11",
550
552
  "css.escape": "^1.5.1",
551
553
  "csv-stringify": "^6.6.0",
552
- express: "^5.1.0",
553
- gtfs: "^4.18.1",
554
+ express: "^5.2.1",
555
+ gtfs: "^4.18.2",
554
556
  "gtfs-realtime-pbf-js-module": "^1.0.0",
555
557
  "js-beautify": "^1.15.4",
556
558
  "lodash-es": "^4.17.21",
557
- "maplibre-gl": "^5.13.0",
558
- marked: "^17.0.0",
559
+ "maplibre-gl": "^5.14.0",
560
+ marked: "^17.0.1",
559
561
  moment: "^2.30.1",
560
562
  pbf: "^4.0.1",
561
563
  "pretty-error": "^4.0.0",
562
564
  pug: "^3.0.3",
563
- puppeteer: "^24.30.0",
565
+ puppeteer: "^24.32.0",
564
566
  "sanitize-filename": "^1.6.3",
565
567
  "sanitize-html": "^2.17.0",
566
568
  sqlstring: "^2.3.3",
@@ -571,7 +573,7 @@ var package_default = {
571
573
  devDependencies: {
572
574
  "@types/archiver": "^7.0.0",
573
575
  "@types/cli-table": "^0.3.4",
574
- "@types/express": "^5.0.5",
576
+ "@types/express": "^5.0.6",
575
577
  "@types/insane": "^1.0.0",
576
578
  "@types/js-beautify": "^1.14.3",
577
579
  "@types/lodash-es": "^4.17.12",
@@ -584,7 +586,7 @@ var package_default = {
584
586
  "@types/yargs": "^17.0.35",
585
587
  husky: "^9.1.7",
586
588
  "lint-staged": "^16.2.7",
587
- prettier: "^3.6.2",
589
+ prettier: "^3.7.4",
588
590
  tsup: "^8.5.1",
589
591
  typescript: "^5.9.3"
590
592
  },
@@ -2319,20 +2321,23 @@ async function getConfig(argv2) {
2319
2321
  }
2320
2322
  return config;
2321
2323
  }
2322
- function getPathToViewsFolder(config) {
2323
- if (config.templatePath) {
2324
- return untildify(config.templatePath);
2325
- }
2324
+ function getPathToThisModuleFolder() {
2326
2325
  const __dirname = dirname(fileURLToPath(import.meta.url));
2327
- let viewsFolderPath;
2326
+ let distFolderPath;
2328
2327
  if (__dirname.endsWith("/dist/bin") || __dirname.endsWith("/dist/app")) {
2329
- viewsFolderPath = resolve(__dirname, "../../views/default");
2328
+ distFolderPath = resolve(__dirname, "../../");
2330
2329
  } else if (__dirname.endsWith("/dist")) {
2331
- viewsFolderPath = resolve(__dirname, "../views/default");
2330
+ distFolderPath = resolve(__dirname, "../");
2332
2331
  } else {
2333
- viewsFolderPath = resolve(__dirname, "../../views/default");
2332
+ distFolderPath = resolve(__dirname, "../../");
2333
+ }
2334
+ return distFolderPath;
2335
+ }
2336
+ function getPathToViewsFolder(config) {
2337
+ if (config.templatePath) {
2338
+ return untildify(config.templatePath);
2334
2339
  }
2335
- return viewsFolderPath;
2340
+ return join(getPathToThisModuleFolder(), "views/default");
2336
2341
  }
2337
2342
  function getPathToTemplateFile(templateFileName, config) {
2338
2343
  const fullTemplateFileName = config.noHead !== true ? `${templateFileName}_full.pug` : `${templateFileName}.pug`;
@@ -2365,6 +2370,7 @@ async function prepDirectory(outputPath, config) {
2365
2370
  }
2366
2371
  async function copyStaticAssets(config, outputPath) {
2367
2372
  const viewsFolderPath = getPathToViewsFolder(config);
2373
+ const thisModuleFolderPath = getPathToThisModuleFolder();
2368
2374
  const foldersToCopy = ["css", "js", "img"];
2369
2375
  for (const folder of foldersToCopy) {
2370
2376
  if (await access(join(viewsFolderPath, folder)).then(() => true).catch(() => false)) {
@@ -2375,70 +2381,43 @@ async function copyStaticAssets(config, outputPath) {
2375
2381
  }
2376
2382
  if (config.hasGtfsRealtimeVehiclePositions || config.hasGtfsRealtimeTripUpdates || config.hasGtfsRealtimeAlerts) {
2377
2383
  await copyFile(
2378
- join(
2379
- dirname(findPackageJSON("pbf", import.meta.url)),
2380
- "dist/pbf.js"
2381
- ),
2384
+ join(thisModuleFolderPath, "dist/frontend_libraries/pbf.js"),
2382
2385
  join(outputPath, "js/pbf.js")
2383
2386
  );
2384
2387
  await copyFile(
2385
2388
  join(
2386
- dirname(
2387
- findPackageJSON(
2388
- "gtfs-realtime-pbf-js-module",
2389
- import.meta.url
2390
- )
2391
- ),
2392
- "gtfs-realtime.browser.proto.js"
2389
+ thisModuleFolderPath,
2390
+ "dist/frontend_libraries/gtfs-realtime.browser.proto.js"
2393
2391
  ),
2394
2392
  join(outputPath, "js/gtfs-realtime.browser.proto.js")
2395
2393
  );
2396
2394
  }
2397
2395
  if (config.hasGtfsRealtimeAlerts) {
2398
2396
  await copyFile(
2399
- join(
2400
- dirname(findPackageJSON("anchorme", import.meta.url)),
2401
- "dist/browser/anchorme.min.js"
2402
- ),
2397
+ join(thisModuleFolderPath, "dist/frontend_libraries/anchorme.min.js"),
2403
2398
  join(outputPath, "js/anchorme.min.js")
2404
2399
  );
2405
2400
  }
2406
2401
  if (config.showMap) {
2407
2402
  await copyFile(
2408
- join(
2409
- dirname(findPackageJSON("maplibre-gl", import.meta.url)),
2410
- "dist/maplibre-gl.js"
2411
- ),
2403
+ join(thisModuleFolderPath, "dist/frontend_libraries/maplibre-gl.js"),
2412
2404
  join(outputPath, "js/maplibre-gl.js")
2413
2405
  );
2414
2406
  await copyFile(
2415
- join(
2416
- dirname(findPackageJSON("maplibre-gl", import.meta.url)),
2417
- "dist/maplibre-gl.css"
2418
- ),
2407
+ join(thisModuleFolderPath, "dist/frontend_libraries/maplibre-gl.css"),
2419
2408
  join(outputPath, "css/maplibre-gl.css")
2420
2409
  );
2421
2410
  await copyFile(
2422
2411
  join(
2423
- dirname(
2424
- findPackageJSON(
2425
- "@maplibre/maplibre-gl-geocoder",
2426
- import.meta.url
2427
- )
2428
- ),
2429
- "dist/maplibre-gl-geocoder.js"
2412
+ thisModuleFolderPath,
2413
+ "dist/frontend_libraries/maplibre-gl-geocoder.js"
2430
2414
  ),
2431
2415
  join(outputPath, "js/maplibre-gl-geocoder.js")
2432
2416
  );
2433
2417
  await copyFile(
2434
2418
  join(
2435
- dirname(
2436
- findPackageJSON(
2437
- "@maplibre/maplibre-gl-geocoder",
2438
- import.meta.url
2439
- )
2440
- ),
2441
- "dist/maplibre-gl-geocoder.css"
2419
+ thisModuleFolderPath,
2420
+ "dist/frontend_libraries/maplibre-gl-geocoder.css"
2442
2421
  ),
2443
2422
  join(outputPath, "css/maplibre-gl-geocoder.css")
2444
2423
  );