gtfs-to-html 2.6.0 → 2.6.1

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/CHANGELOG.md CHANGED
@@ -5,6 +5,18 @@ All notable changes to this project will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [2.6.1] - 2024-03-26
9
+
10
+ ### Fixed
11
+
12
+ - Fix for missing stops
13
+
14
+ ### Updated
15
+ - Dependency updates
16
+ - Day List selector label wording
17
+ - Updates to timetable map
18
+ - Filename format for CSV export files
19
+
8
20
  ## [2.6.0] - 2024-02-27
9
21
 
10
22
  ### Updated
package/lib/file-utils.js CHANGED
@@ -132,7 +132,7 @@ export function zipFolder(exportPath) {
132
132
  /*
133
133
  * Generate the filename for a given timetable.
134
134
  */
135
- export function generateFileName(timetable, config) {
135
+ export function generateFileName(timetable, config, extension = 'html') {
136
136
  let filename = timetable.timetable_id;
137
137
 
138
138
  for (const route of timetable.routes) {
@@ -145,24 +145,11 @@ export function generateFileName(timetable, config) {
145
145
  filename += `_${timetable.direction_id}`;
146
146
  }
147
147
 
148
- filename += `_${formatDays(timetable, config).replace(/\s/g, '')}.html`;
148
+ filename += `_${formatDays(timetable, config).replace(/\s/g, '')}.${extension}`;
149
149
 
150
150
  return sanitize(filename).toLowerCase();
151
151
  }
152
152
 
153
- /*
154
- * Generate the filename for a CSV timetable.
155
- */
156
- export function generateCSVFileName(timetable, timetablePage) {
157
- let filename = timetablePage.filename.replace(/.html$/, '');
158
-
159
- if (timetablePage.timetables.length > 1) {
160
- filename += `_${timetable.direction_id}`;
161
- }
162
-
163
- return sanitize(`${filename}.csv`);
164
- }
165
-
166
153
  /*
167
154
  * Generates the folder name for a timetable page based on the date.
168
155
  */
@@ -12,7 +12,7 @@ import {
12
12
  generateFolderName,
13
13
  renderPdf,
14
14
  zipFolder,
15
- generateCSVFileName,
15
+ generateFileName,
16
16
  } from './file-utils.js';
17
17
  import {
18
18
  log,
@@ -139,7 +139,7 @@ const gtfsToHtml = async (initialConfig) => {
139
139
  const csvPath = path.join(
140
140
  exportPath,
141
141
  datePath,
142
- generateCSVFileName(timetable, timetablePage),
142
+ generateFileName(timetable, config, 'csv'),
143
143
  );
144
144
  await writeFile(csvPath, csv);
145
145
  }
package/lib/utils.js CHANGED
@@ -472,7 +472,7 @@ const convertTimetableToTimetablePage = (timetable, config) => {
472
472
  });
473
473
  }
474
474
 
475
- const filename = generateFileName(timetable, config);
475
+ const filename = generateFileName(timetable, config, 'html');
476
476
 
477
477
  return {
478
478
  timetable_page_id: timetable.timetable_id,
@@ -855,6 +855,10 @@ const getAllStationStopIds = (stopId) => {
855
855
  stop_id: stopId,
856
856
  });
857
857
 
858
+ if (stops.length === 0) {
859
+ throw new Error(`No stop found for stop_id=${stopId}`);
860
+ }
861
+
858
862
  const stop = stops[0];
859
863
 
860
864
  if (isNullOrEmpty(stop.parent_station)) {
@@ -1153,11 +1157,11 @@ const getTripsForTimetable = (timetable, calendars, config) => {
1153
1157
 
1154
1158
  for (const trip of formattedTrips) {
1155
1159
  for (const stoptime of trip.stoptimes) {
1156
- const parentStationStop = stops.find(
1157
- (stop) => stop.stop_id === stoptime.stop_id,
1158
- );
1159
- stoptime.stop_id =
1160
- parentStationStop.parent_station || parentStationStop.stop_id;
1160
+ const stop = stops.find((stop) => stop.stop_id === stoptime.stop_id);
1161
+
1162
+ if (stop?.parent_station) {
1163
+ stoptime.stop_id = stop.parent_station;
1164
+ }
1161
1165
  }
1162
1166
  }
1163
1167
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gtfs-to-html",
3
- "version": "2.6.0",
3
+ "version": "2.6.1",
4
4
  "private": false,
5
5
  "description": "Build human readable transit timetables as HTML, PDF or CSV from GTFS",
6
6
  "keywords": [
@@ -37,26 +37,26 @@
37
37
  "dependencies": {
38
38
  "@turf/helpers": "^6.5.0",
39
39
  "@turf/simplify": "^6.5.0",
40
- "archiver": "^6.0.2",
40
+ "archiver": "^7.0.1",
41
41
  "cli-table": "^0.3.11",
42
42
  "copy-dir": "^1.3.0",
43
43
  "csv-stringify": "^6.4.6",
44
- "express": "^4.18.2",
45
- "gtfs": "^4.7.1",
44
+ "express": "^4.19.2",
45
+ "gtfs": "^4.9.0",
46
46
  "js-beautify": "^1.15.1",
47
47
  "lodash-es": "^4.17.21",
48
48
  "moment": "^2.30.1",
49
49
  "morgan": "^1.10.0",
50
50
  "pretty-error": "^4.0.0",
51
51
  "pug": "^3.0.2",
52
- "puppeteer": "^22.3.0",
52
+ "puppeteer": "^22.6.1",
53
53
  "sanitize-filename": "^1.6.3",
54
54
  "sqlstring": "^2.3.3",
55
55
  "timer-machine": "^1.1.0",
56
56
  "toposort": "^2.0.2",
57
57
  "untildify": "^5.0.0",
58
58
  "yargs": "^17.7.2",
59
- "yoctocolors": "^1.0.0"
59
+ "yoctocolors": "^2.0.0"
60
60
  },
61
61
  "devDependencies": {
62
62
  "husky": "^9.0.11",
@@ -28,6 +28,11 @@ function formatRoute(route) {
28
28
  .text(route.route_long_name || ''),
29
29
  ])
30
30
  .appendTo(html);
31
+ } else {
32
+ $('<div>')
33
+ .addClass('hover:underline')
34
+ .text(route.route_long_name || '')
35
+ .appendTo(html);
31
36
  }
32
37
 
33
38
  return html.prop('outerHTML');
@@ -48,7 +53,7 @@ function formatStopPopup(feature, routes) {
48
53
  $('<strong>').text(feature.properties.stop_code).appendTo(html);
49
54
  }
50
55
 
51
- $('<div>').addClass('text-sm').text('Routes Served:').appendTo(html);
56
+ $('<div>').addClass('text-sm mb-2').text('Routes Served:').appendTo(html);
52
57
 
53
58
  $(html).append(routeIds.map((routeId) => formatRoute(routes[routeId])));
54
59
 
@@ -42,7 +42,7 @@ if timetablePage.consolidatedTimetables.length > 1
42
42
  span= directionName
43
43
  div(hidden=timetablePage.dayLists.length <= 1)
44
44
  #day_list_selector
45
- h3.font-bold Days of Week
45
+ h3.font-bold Day of Week
46
46
  each dayList, idx in timetablePage.dayLists
47
47
  label.cursor-pointer.mb-2.w-full.flex.items-center.justify-center.px-8.py-3.border.border-transparent.text-base.rounded-md(class=idx === 0 ? 'text-white bg-blue-600': 'text-gray-600 bg-gray-300')
48
48
  input.hidden(type="radio" name="dayList" autocomplete="off" value=dayList checked=(idx === 0))
package/www/package.json CHANGED
@@ -9,8 +9,8 @@
9
9
  "deploy": "docusaurus deploy"
10
10
  },
11
11
  "dependencies": {
12
- "@docusaurus/core": "^3.1.0",
13
- "@docusaurus/preset-classic": "^3.1.0",
12
+ "@docusaurus/core": "^3.1.1",
13
+ "@docusaurus/preset-classic": "^3.1.1",
14
14
  "clsx": "^2.1.0",
15
15
  "react": "^18.2.0",
16
16
  "react-dom": "^18.2.0"