-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 7629735
Showing
14 changed files
with
313 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
.git | ||
node_modules |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# editorconfig.org | ||
root = true | ||
|
||
[*] | ||
end_of_line = lf | ||
charset = utf-8 | ||
trim_trailing_whitespace = true | ||
insert_final_newline = true | ||
|
||
[**.{js, json}] | ||
indent_style = tab | ||
indent_size = 4 | ||
|
||
[**.{yml,yaml}] | ||
indent_style = spaces | ||
indent_size = 2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
version: 2 | ||
updates: | ||
- package-ecosystem: npm | ||
directory: '/' | ||
schedule: | ||
interval: weekly | ||
commit-message: | ||
include: scope | ||
ignore: | ||
- dependency-name: "*" | ||
update-types: ["version-update:semver-patch", "version-update:semver-minor"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
name: build & publish Docker image | ||
|
||
on: | ||
push: | ||
tags: | ||
- '*' | ||
|
||
jobs: | ||
lint-test: | ||
name: lint & test | ||
uses: './.github/workflows/test.yml' | ||
|
||
build-publish: | ||
name: build & publish Docker image | ||
needs: | ||
- lint-test | ||
runs-on: ubuntu-latest | ||
permissions: | ||
packages: write | ||
steps: | ||
- name: checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: log into the GitHub Container Registry | ||
uses: docker/login-action@v3 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.actor }} | ||
password: ${{ github.token }} | ||
|
||
- name: compute Docker image OCI metadata from commit & repo | ||
id: docker-metadata | ||
uses: docker/metadata-action@v5 | ||
with: | ||
labels: | | ||
org.opencontainers.image.version=${{ github.ref_name }} | ||
- name: set up Docker buildx | ||
uses: docker/setup-buildx-action@v3 | ||
- name: set up QEMU for cross-platform builds | ||
uses: docker/setup-qemu-action@v3 | ||
|
||
- name: build and push Docker image | ||
uses: docker/build-push-action@v5 | ||
with: | ||
push: true | ||
tags: | | ||
ghcr.io/${{ github.repository }}:latest | ||
ghcr.io/${{ github.repository }}:${{ github.ref_name }} | ||
labels: ${{ steps.docker-metadata.outputs.labels }} | ||
platforms: linux/amd64,linux/arm64 | ||
# https://docs.docker.com/build/ci/github-actions/cache/#cache-backend-api | ||
cache-from: type=gha | ||
cache-to: type=gha,mode=max |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
name: lint & test | ||
|
||
on: | ||
push: | ||
branches: | ||
- '*' | ||
pull_request: | ||
branches: | ||
- '*' | ||
# make this workflow callable from other workflows | ||
workflow_call: | ||
|
||
jobs: | ||
test: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
node-version: | ||
- '20' | ||
- '22' | ||
|
||
steps: | ||
- name: checkout | ||
uses: actions/checkout@v4 | ||
- name: setup Node v${{ matrix.node-version }} | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: ${{ matrix.node-version }} | ||
- run: npm install | ||
|
||
- run: npm run lint | ||
- run: npm test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
.DS_Store | ||
Thumbs.db | ||
|
||
.nvm-version | ||
node_modules | ||
|
||
/package-lock.json | ||
/yarn.lock |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# syntax=docker/dockerfile:1.6 | ||
# ^ needed for ADD --checksum=… | ||
|
||
FROM node:22-alpine as builder | ||
WORKDIR /app | ||
|
||
RUN npm install --production | ||
|
||
# --- | ||
|
||
FROM node:22-alpine | ||
WORKDIR /app | ||
|
||
LABEL org.opencontainers.image.title="nats-consuming-gtfs-rt-server" | ||
LABEL org.opencontainers.image.description="Reads DIFFERENTIAL-mode GTFS Realtime data from NATS message broker, and serves it as FULL_DATASET via HTTP." | ||
LABEL org.opencontainers.image.authors="Verkehrsverbund Berlin Brandenburg <[email protected]>" | ||
|
||
# install dependencies | ||
COPY --from=builder /app/node_modules ./node_modules | ||
|
||
# add source code | ||
ADD . /app | ||
|
||
# CLI smoke test | ||
RUN ./cli.js --help >/dev/null | ||
|
||
ENTRYPOINT [ "./cli.js"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
#!/usr/bin/env node | ||
|
||
import {parseArgs} from 'node:util' | ||
|
||
// todo: use import assertions once they're supported by Node.js & ESLint | ||
// https://github.com/tc39/proposal-import-assertions | ||
import {createRequire} from 'node:module' | ||
const require = createRequire(import.meta.url) | ||
const pkg = require('./package.json') | ||
|
||
const { | ||
values: flags, | ||
positionals: args, | ||
Check failure on line 13 in cli.js GitHub Actions / test (20)
|
||
} = parseArgs({ | ||
options: { | ||
'help': { | ||
type: 'boolean', | ||
short: 'h', | ||
}, | ||
'version': { | ||
type: 'boolean', | ||
short: 'v', | ||
}, | ||
}, | ||
allowPositionals: true, | ||
}) | ||
|
||
if (flags.help) { | ||
process.stdout.write(` | ||
todo | ||
\n`) | ||
process.exit(0) | ||
} | ||
|
||
if (flags.version) { | ||
process.stdout.write(`${pkg.name} v${pkg.version}\n`) | ||
process.exit(0) | ||
} | ||
|
||
// todo |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import eslint from '@eslint/js' | ||
import globals from 'globals' | ||
|
||
export default [ | ||
eslint.configs.recommended, | ||
{ | ||
languageOptions: { | ||
ecmaVersion: 2022, | ||
globals: globals.node, | ||
}, | ||
rules: { | ||
'no-unused-vars': [ | ||
'error', | ||
{ | ||
vars: 'all', | ||
args: 'none', | ||
ignoreRestSiblings: false | ||
}, | ||
], | ||
}, | ||
}, | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
// todo |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
Copyright (c) 2024, Jannis R | ||
|
||
Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
{ | ||
"name": "nats-consuming-gtfs-rt-server", | ||
"description": "Reads DIFFERENTIAL-mode GTFS Realtime data from NATS message broker, and serves it as FULL_DATASET via HTTP.", | ||
"version": "1.0.0", | ||
"preferGlobal": true, | ||
"type": "module", | ||
"main": "index.js", | ||
"bin": { | ||
"send-vdv-453-data-to-nats": "./cli.js" | ||
}, | ||
"files": [ | ||
"cli.js", | ||
"index.js", | ||
"lib" | ||
], | ||
"keywords": [ | ||
"vdv 453", | ||
"vdv 454", | ||
"realtime", | ||
"public transport", | ||
"transit", | ||
"nats" | ||
], | ||
"author": "Verkehrsverbund Berlin Brandenburg <[email protected]>", | ||
"contributors": [ | ||
"Jannis R <[email protected]>" | ||
], | ||
"homepage": "https://github.com/OpenDataVBB/nats-consuming-gtfs-rt-server", | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/OpenDataVBB/nats-consuming-gtfs-rt-server.git" | ||
}, | ||
"bugs": "https://github.com/OpenDataVBB/nats-consuming-gtfs-rt-server/issues", | ||
"license": "ISC", | ||
"engines": { | ||
"node": ">=22" | ||
}, | ||
"dependencies": { | ||
}, | ||
"devDependencies": { | ||
"@eslint/js": "^9.0.0", | ||
"eslint": "^9.0.0", | ||
"globals": "^15.0.0" | ||
}, | ||
"scripts": { | ||
"test": "./test/index.sh", | ||
"lint": "eslint .", | ||
"prepublishOnly": "npm run lint && npm test" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
# nats-consuming-gtfs-rt-server | ||
|
||
**Reads a continuous stream of [GTFS Realtime (GTFS-RT)](https://developers.google.com/transit/gtfs-realtime/) data with [`DIFFERENTIAL` incrementality](https://gtfs.org/documentation/realtime/reference/#enum-incrementality), converts it into a single [`FULL_DATASET`](https://gtfs.org/documentation/realtime/reference/#enum-incrementality) GTFS-RT feed, and serves it via HTTP.** | ||
|
||
![ISC-licensed](https://img.shields.io/github/license/OpenDataVBB/nats-consuming-gtfs-rt-server.svg) | ||
|
||
|
||
## Installation | ||
|
||
```shell | ||
npm install -g OpenDataVBB/nats-consuming-gtfs-rt-server | ||
``` | ||
|
||
|
||
## Getting Started | ||
|
||
```shell | ||
# todo | ||
``` | ||
|
||
|
||
## Usage | ||
|
||
``` | ||
todo | ||
``` | ||
|
||
|
||
## Related | ||
|
||
- [`gtfs-rt-differential-to-full-dataset`](https://github.com/derhuerst/gtfs-rt-differential-to-full-dataset) – Transform a differential GTFS Realtime feed into a full dataset/dump. | ||
- [`gtfs-rt-bindings`](https://github.com/derhuerst/gtfs-rt-bindings) – Parse and serialize GTFS Realtime data encoded as protocol buffers. (third-party) | ||
- [`gtfs-realtime-bindings`](https://npmjs.com/package/gtfs-realtime-bindings) – Javascript classes generated from the GTFS-realtime protocol buffer specification. (official) | ||
|
||
|
||
## Contributing | ||
|
||
If you have a question or need support using `nats-consuming-gtfs-rt-server`, please double-check your code and setup first. If you think you have found a bug or want to propose a feature, use [the issues page](https://github.com/OpenDataVBB/nats-consuming-gtfs-rt-server/issues). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#!/bin/bash | ||
|
||
set -eu -o pipefail | ||
cd "$(dirname $0)" | ||
set -x | ||
|
||
# todo |