gtfs-realtime-bindings 1.1.0 → 2.0.0
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/Dockerfile +1 -1
- package/README.md +11 -5
- package/UPDATING.md +16 -20
- package/gtfs-realtime.d.ts +1539 -73
- package/gtfs-realtime.js +5096 -532
- package/package.json +11 -8
- package/test/test.js +279 -6
package/Dockerfile
CHANGED
package/README.md
CHANGED
|
@@ -11,9 +11,15 @@ These bindings are designed to be used in the [Node.js](http://nodejs.org/)
|
|
|
11
11
|
environment, but with some effort, they can probably be used in other
|
|
12
12
|
JavaScript environments as well.
|
|
13
13
|
|
|
14
|
-
We use the [ProtoBuf.js](https://github.com/
|
|
14
|
+
We use the [ProtoBuf.js](https://github.com/protobufjs/protobuf.js) library for
|
|
15
15
|
JavaScript Protocol Buffer support.
|
|
16
16
|
|
|
17
|
+
## Breaking Changes
|
|
18
|
+
|
|
19
|
+
### Version 2.0.0
|
|
20
|
+
|
|
21
|
+
Version 2.0.0 requires **Node.js 22 or later**. If you are using an older version of Node.js, please continue using version `1.x`.
|
|
22
|
+
|
|
17
23
|
## Add the Dependency
|
|
18
24
|
|
|
19
25
|
To use the `gtfs-realtime-bindings` classes in your own project, you need to
|
|
@@ -48,9 +54,9 @@ import fetch from "node-fetch";
|
|
|
48
54
|
// e.g. x-api-key is the header value used for NY's MTA GTFS APIs
|
|
49
55
|
},
|
|
50
56
|
});
|
|
51
|
-
if (!
|
|
52
|
-
const error = new Error(`${
|
|
53
|
-
error.response =
|
|
57
|
+
if (!response.ok) {
|
|
58
|
+
const error = new Error(`${response.url}: ${response.status} ${response.statusText}`);
|
|
59
|
+
error.response = response;
|
|
54
60
|
throw error;
|
|
55
61
|
process.exit(1);
|
|
56
62
|
}
|
|
@@ -74,5 +80,5 @@ import fetch from "node-fetch";
|
|
|
74
80
|
For more details on the naming conventions for the JavaScript classes generated
|
|
75
81
|
from the
|
|
76
82
|
[gtfs-realtime.proto](https://github.com/google/transit/blob/master/gtfs-realtime/proto/gtfs-realtime.proto),
|
|
77
|
-
check out the [ProtoBuf.js project](https://github.com/
|
|
83
|
+
check out the [ProtoBuf.js project](https://github.com/protobufjs/protobuf.js)
|
|
78
84
|
which we use to handle our Protocol Buffer serialization.
|
package/UPDATING.md
CHANGED
|
@@ -4,50 +4,46 @@
|
|
|
4
4
|
|
|
5
5
|
#### One-Time Setup
|
|
6
6
|
|
|
7
|
-
1. Download and install [
|
|
7
|
+
1. Download and install [Node.js](https://nodejs.org/) >= 22 (see `engines` in `package.json`).
|
|
8
8
|
|
|
9
9
|
#### Every time node package dependencies change
|
|
10
10
|
|
|
11
|
-
1.
|
|
11
|
+
1. Edit the dependency versions using `npm install` and/or `npm remove` inside the `nodejs/` folder.
|
|
12
12
|
|
|
13
|
-
1.
|
|
14
|
-
|
|
15
|
-
1. Re-generate the code by following instructions below.
|
|
13
|
+
1. Re-generate the code by following the instructions below.
|
|
16
14
|
|
|
17
15
|
#### Re-generating the code
|
|
18
16
|
|
|
19
|
-
1.
|
|
17
|
+
1. Install dependencies from the `nodejs/` folder:
|
|
20
18
|
|
|
21
19
|
```
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
# -t uses TTY, which causes linux to include carriage returns, which are stripped using tr
|
|
25
|
-
docker run -it --rm gtfs-nodejs cat /lib/gtfs-realtime.js | tr -d '\r' > nodejs/gtfs-realtime.js
|
|
26
|
-
docker run -it --rm gtfs-nodejs cat /lib/gtfs-realtime.d.ts | tr -d '\r' > nodejs/gtfs-realtime.d.ts
|
|
20
|
+
cd nodejs
|
|
21
|
+
npm ci
|
|
27
22
|
```
|
|
28
23
|
|
|
29
|
-
1.
|
|
24
|
+
1. Re-generate the JS bindings and TypeScript types from the root of the project:
|
|
25
|
+
|
|
26
|
+
```
|
|
27
|
+
npm run buildProto
|
|
28
|
+
```
|
|
30
29
|
|
|
31
30
|
1. Test the generated code:
|
|
32
31
|
|
|
33
32
|
```
|
|
34
|
-
npm
|
|
33
|
+
npm test
|
|
35
34
|
```
|
|
36
35
|
|
|
37
36
|
1. Update the version number in `package.json`.
|
|
38
37
|
|
|
39
38
|
## Publishing a new release
|
|
40
39
|
|
|
41
|
-
|
|
40
|
+
Releases are published to npm automatically via GitHub Actions when a change to the `nodejs/` folder
|
|
41
|
+
is merged into `master`, provided the version in `package.json` has been bumped.
|
|
42
42
|
|
|
43
|
-
|
|
43
|
+
To publish manually (e.g. for testing), log in with an npm account that has permissions for
|
|
44
|
+
https://www.npmjs.com/package/gtfs-realtime-bindings and run from the `nodejs/` folder:
|
|
44
45
|
|
|
45
46
|
```
|
|
46
47
|
npm login
|
|
47
|
-
```
|
|
48
|
-
|
|
49
|
-
Publish the package to NPM:
|
|
50
|
-
|
|
51
|
-
```
|
|
52
48
|
npm publish
|
|
53
49
|
```
|