gtfs-realtime-bindings 1.1.1 → 2.1.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 CHANGED
@@ -1,4 +1,4 @@
1
- FROM node:18.12.1-alpine
1
+ FROM node:22-alpine
2
2
 
3
3
  WORKDIR /lib
4
4
  COPY nodejs/package.json /lib/package.json
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/dcodeIO/ProtoBuf.js) library for
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 (!res.ok) {
52
- const error = new Error(`${res.url}: ${res.status} ${res.statusText}`);
53
- error.response = res;
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/dcodeIO/ProtoBuf.js/wiki)
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 [Docker](https://docs.docker.com/get-docker/)
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. Download and install [Node.js](https://www.npmjs.com/get-npm) (check the `package.json` for `engines` version).
11
+ 1. Edit the dependency versions using `npm install` and/or `npm remove` inside the `nodejs/` folder.
12
12
 
13
- 1. Edit the dependency versions in using `npm install` and/or `npm remove`.
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. Run the following from the project root folder:
17
+ 1. Install dependencies from the `nodejs/` folder:
20
18
 
21
19
  ```
22
- docker build -t gtfs-nodejs -f nodejs/Dockerfile .
23
- # -it to make sure docker run can be killed with ctrl-c
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. Add the license header back to the generated source file.
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 run test
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
- #### Every release
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
- Log in with your account on NPM that has permissions for https://www.npmjs.com/package/gtfs-realtime-bindings:
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
  ```