gtfs 4.5.0 → 4.5.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 +11 -0
- package/lib/export.js +17 -7
- package/package.json +7 -7
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,17 @@ 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
|
+
## [4.5.1] - 2023-11-09
|
|
9
|
+
|
|
10
|
+
### Updated
|
|
11
|
+
|
|
12
|
+
- Dependency updates
|
|
13
|
+
- Use path to types file instead of directory in package.json
|
|
14
|
+
|
|
15
|
+
### Fixed
|
|
16
|
+
|
|
17
|
+
- Exclude agency_id from export if empty
|
|
18
|
+
|
|
8
19
|
## [4.5.0] - 2023-08-23
|
|
9
20
|
|
|
10
21
|
### Updated
|
package/lib/export.js
CHANGED
|
@@ -20,12 +20,12 @@ const getAgencies = (db, config) => {
|
|
|
20
20
|
} catch (error) {
|
|
21
21
|
if (config.sqlitePath === ':memory:') {
|
|
22
22
|
throw new Error(
|
|
23
|
-
'No agencies found in SQLite. You are using an in-memory database - if running this from command line be sure to specify a value for `sqlitePath` in config.json other than ":memory:".'
|
|
23
|
+
'No agencies found in SQLite. You are using an in-memory database - if running this from command line be sure to specify a value for `sqlitePath` in config.json other than ":memory:".',
|
|
24
24
|
);
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
throw new Error(
|
|
28
|
-
'No agencies found in SQLite. Be sure to first import data into SQLite using `gtfs-import` or `importGtfs(config);`'
|
|
28
|
+
'No agencies found in SQLite. Be sure to first import data into SQLite using `gtfs-import` or `importGtfs(config);`',
|
|
29
29
|
);
|
|
30
30
|
}
|
|
31
31
|
};
|
|
@@ -42,11 +42,11 @@ const exportGtfs = async (initialConfig) => {
|
|
|
42
42
|
const agencyCount = agencies.length;
|
|
43
43
|
if (agencyCount === 0) {
|
|
44
44
|
throw new Error(
|
|
45
|
-
'No agencies found in SQLite. Be sure to first import data into SQLite using `gtfs-import` or `importGtfs(config);`'
|
|
45
|
+
'No agencies found in SQLite. Be sure to first import data into SQLite using `gtfs-import` or `importGtfs(config);`',
|
|
46
46
|
);
|
|
47
47
|
} else if (agencyCount > 1) {
|
|
48
48
|
logWarning(
|
|
49
|
-
'More than one agency is defined in config.json. Export will merge all into one GTFS file.'
|
|
49
|
+
'More than one agency is defined in config.json. Export will merge all into one GTFS file.',
|
|
50
50
|
);
|
|
51
51
|
}
|
|
52
52
|
|
|
@@ -54,8 +54,8 @@ const exportGtfs = async (initialConfig) => {
|
|
|
54
54
|
`Starting GTFS export for ${pluralize(
|
|
55
55
|
'agency',
|
|
56
56
|
agencyCount,
|
|
57
|
-
true
|
|
58
|
-
)} using SQLite database at ${config.sqlitePath}
|
|
57
|
+
true,
|
|
58
|
+
)} using SQLite database at ${config.sqlitePath}`,
|
|
59
59
|
);
|
|
60
60
|
|
|
61
61
|
const folderName = generateFolderName(agencies[0].agency_name);
|
|
@@ -92,9 +92,19 @@ const exportGtfs = async (initialConfig) => {
|
|
|
92
92
|
'ridership_end_timestamp',
|
|
93
93
|
];
|
|
94
94
|
|
|
95
|
+
// If no routes have values for agency_id, add it to the excludeColumns list
|
|
96
|
+
if (model.filenameBase === 'routes') {
|
|
97
|
+
const routesWithAgencyId = db
|
|
98
|
+
.prepare('SELECT agency_id FROM routes WHERE agency_id IS NOT NULL;')
|
|
99
|
+
.all();
|
|
100
|
+
if (!routesWithAgencyId || routesWithAgencyId.length === 0) {
|
|
101
|
+
excludeColumns.push('agency_id');
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
|
|
95
105
|
const columns = without(
|
|
96
106
|
model.schema.map((column) => column.name),
|
|
97
|
-
...excludeColumns
|
|
107
|
+
...excludeColumns,
|
|
98
108
|
);
|
|
99
109
|
const fileText = await stringify(lines, { columns, header: true });
|
|
100
110
|
await writeFile(filepath, fileText);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "gtfs",
|
|
3
|
-
"version": "4.5.
|
|
3
|
+
"version": "4.5.1",
|
|
4
4
|
"description": "Import GTFS transit data into SQLite and query routes, stops, times, fares and more",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"transit",
|
|
@@ -67,15 +67,15 @@
|
|
|
67
67
|
"gtfs-import": "bin/gtfs-import.js",
|
|
68
68
|
"gtfsrealtime-update": "bin/gtfsrealtime-update.js"
|
|
69
69
|
},
|
|
70
|
-
"types": "@types",
|
|
70
|
+
"types": "@types/index.d.ts",
|
|
71
71
|
"scripts": {
|
|
72
72
|
"test": "NODE_ENV=test mocha ./test/mocha/**/*.js --timeout 2000"
|
|
73
73
|
},
|
|
74
74
|
"dependencies": {
|
|
75
75
|
"@turf/helpers": "^6.5.0",
|
|
76
|
-
"better-sqlite3": "^
|
|
77
|
-
"csv-parse": "^5.
|
|
78
|
-
"csv-stringify": "^6.4.
|
|
76
|
+
"better-sqlite3": "^9.1.1",
|
|
77
|
+
"csv-parse": "^5.5.2",
|
|
78
|
+
"csv-stringify": "^6.4.4",
|
|
79
79
|
"gtfs-realtime-bindings": "^1.1.1",
|
|
80
80
|
"lodash-es": "^4.17.21",
|
|
81
81
|
"long": "^5.2.3",
|
|
@@ -95,9 +95,9 @@
|
|
|
95
95
|
},
|
|
96
96
|
"devDependencies": {
|
|
97
97
|
"husky": "^8.0.3",
|
|
98
|
-
"lint-staged": "^
|
|
98
|
+
"lint-staged": "^15.0.2",
|
|
99
99
|
"mocha": "^10.2.0",
|
|
100
|
-
"prettier": "^3.0.
|
|
100
|
+
"prettier": "^3.0.3",
|
|
101
101
|
"should": "^13.2.3"
|
|
102
102
|
},
|
|
103
103
|
"engines": {
|