Skip to content

Commit

Permalink
init
Browse files Browse the repository at this point in the history
  • Loading branch information
derhuerst committed Apr 16, 2024
0 parents commit a3398e9
Show file tree
Hide file tree
Showing 11 changed files with 217 additions and 0 deletions.
16 changes: 16 additions & 0 deletions .editorconfig
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
11 changes: 11 additions & 0 deletions .github/dependabot.yml
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"]
28 changes: 28 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: test

on:
push:
branches:
- '*'
pull_request:
branches:
- '*'

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
8 changes: 8 additions & 0 deletions .gitignore
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
43 changes: 43 additions & 0 deletions cli.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
#!/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,
} = parseArgs({
options: {
'help': {
type: 'boolean',
short: 'h',
},
'version': {
type: 'boolean',
short: 'v',
},
},
allowPositionals: true,
})

if (flags.help) {
process.stdout.write(`
Usage:
send-vdv-453-data-to-nats [options]
Examples:
send-vdv-453-data-to-nats
\n`)
process.exit(0)
}

if (flags.version) {
process.stdout.write(`${pkg.name} v${pkg.version}\n`)
process.exit(0)
}

// todo
22 changes: 22 additions & 0 deletions eslint.config.mjs
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
},
],
},
},
]
5 changes: 5 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
// todo

export {
// todo
}
5 changes: 5 additions & 0 deletions license.md
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.
46 changes: 46 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
{
"name": "vdv-453-nats-adapter",
"description": "Sends realtime public transport data from a VDV-453/VDV-454 API to a NATS message broker.",
"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"
],
"keywords": [
"vdv 453",
"vdv 454",
"realtime",
"public transport",
"transit",
"nats"
],
"author": "Jannis R <[email protected]>",
"homepage": "https://github.com/derhuerst/vdv-453-nats-adapter",
"repository": {
"type": "git",
"url": "git+https://github.com/derhuerst/vdv-453-nats-adapter.git"
},
"bugs": "https://github.com/derhuerst/vdv-453-nats-adapter/issues",
"license": "ISC",
"engines": {
"node": ">=20"
},
"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"
}
}
26 changes: 26 additions & 0 deletions readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# vdv-453-nats-adapter

**Sends realtime public transport data from a [VDV-453/VDV-454 API](https://www.vdv.de/i-d-s-downloads.aspx) to a [NATS message broker](https://docs.nats.io/)**, so that it can be easily consumed by other applications. Uses [`vdv-453-client`](https://github.com/derhuerst/vdv-453-client) underneath.

[![npm version](https://img.shields.io/npm/v/vdv-453-nats-adapter.svg)](https://www.npmjs.com/package/vdv-453-nats-adapter)
![ISC-licensed](https://img.shields.io/github/license/derhuerst/vdv-453-nats-adapter.svg)
![minimum Node.js version](https://img.shields.io/node/v/vdv-453-nats-adapter.svg)


## Installation

```shell
npm install -g vdv-453-nats-adapter
```


## Usage

```sh
# todo
```


## Contributing

If you have a question or need support using `vdv-453-nats-adapter`, 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/derhuerst/vdv-453-nats-adapter/issues).
7 changes: 7 additions & 0 deletions test/index.sh
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

0 comments on commit a3398e9

Please sign in to comment.