forked from public-transport/hafas-client
-
Notifications
You must be signed in to change notification settings - Fork 1
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
1 parent
66d9fb5
commit 35dd0c2
Showing
97 changed files
with
21,272 additions
and
91 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,24 @@ | ||
{ | ||
"typescript": { | ||
}, | ||
"json": { | ||
}, | ||
"markdown": { | ||
}, | ||
"toml": { | ||
}, | ||
"excludes": [ | ||
"**/node_modules", | ||
"**/*.js", | ||
"**/*.md", | ||
"**/*.json" | ||
], | ||
"indentWidth": 4, | ||
"lineWidth": 120, | ||
"plugins": [ | ||
"https://plugins.dprint.dev/typescript-0.89.0.wasm", | ||
"https://plugins.dprint.dev/json-0.19.1.wasm", | ||
"https://plugins.dprint.dev/markdown-0.16.3.wasm", | ||
"https://plugins.dprint.dev/toml-0.6.0.wasm" | ||
] | ||
} |
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
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,29 @@ | ||
name: test types | ||
|
||
on: | ||
push: | ||
branches: [ add-types-in-jsdoc ] | ||
|
||
jobs: | ||
|
||
build: | ||
|
||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
|
||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
with: | ||
ref: add-types-in-jsdoc | ||
|
||
- name: setup node | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: 16 | ||
|
||
- run: npm install | ||
|
||
- run: npm run tsc | ||
- run: npm run lint | ||
- run: npm run test-unit |
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 |
---|---|---|
|
@@ -8,3 +8,4 @@ npm-debug.log | |
package-lock.json | ||
|
||
/.tap | ||
/build |
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,17 @@ | ||
{ | ||
// Use IntelliSense to learn about possible attributes. | ||
// Hover to view descriptions of existing attributes. | ||
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 | ||
"version": "0.2.0", | ||
"configurations": [ | ||
{ | ||
"type": "node", | ||
"request": "launch", | ||
"name": "Launch Program", | ||
"skipFiles": [ | ||
"<node_internals>/**" | ||
], | ||
"program": "${workspaceFolder}/test/index.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,3 @@ | ||
{ | ||
"editor.insertSpaces": 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,6 @@ | ||
{ | ||
"[typescript]": { | ||
"editor.defaultFormatter": "dprint.dprint", | ||
"editor.formatOnSave": true | ||
} | ||
} |
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 @@ | ||
.gitignore create-declaration-file.sh export-defaultProfile.js format/ index.d.ts index.js lib/ p/ package.json parse/ tsconfig.json types-private.ts types.ts typescript-readme.md |
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 @@ | ||
#!/bin/bash | ||
# create a TypeScript declaration file for DefinitelyTyped ./build/index.d.ts are included | ||
|
||
if [ ! -f "./tsconfig.json" ]; then | ||
echo "please run from project directory" | ||
exit 1 | ||
fi | ||
|
||
npx tsc --emitDeclarationOnly true --noEmit false | ||
|
||
if [ $? -ne 0 ] | ||
then | ||
exit 1 | ||
fi | ||
|
||
VERSION=$(grep "version" package.json | sed -E 's/.*([0-9]+\.[0-9]+)\..*/\1/') | ||
|
||
cat ./build/types.d.ts > ./index.d.ts | ||
|
||
cat >> ./index.d.ts << EOF | ||
export function createClient(commonProfile: Profile, userAgent: string, opt?: any): HafasClient; | ||
EOF | ||
|
||
sed -i 's/export declare type/export type/' index.d.ts | ||
|
||
dprint fmt index.d.ts |
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,48 @@ | ||
#!/bin/bash | ||
# create a TypeScript file from test fixture js and json files and tools/debug-cli/cli.js results | ||
|
||
if [ ! -f "./tsconfig.json" ]; then | ||
echo "please run from project directory" | ||
exit 1 | ||
fi | ||
|
||
DATE=$(date) | ||
OUTFILE="types-test-generated.ts" | ||
|
||
echo "// created with script './create-types-test-file.sh' at ${DATE}" > ${OUTFILE} | ||
echo "" >> ${OUTFILE} | ||
echo "import { Journeys, Journey, Alternative, Station, Stop, Location, Departures, Arrivals } from './types'" >> ${OUTFILE} | ||
echo "import { RawResult, RawResponse } from './types-raw-api'" >> ${OUTFILE} | ||
|
||
echo "const r1 : RawResult = " >> ${OUTFILE} | ||
cat test/fixtures/db-journey.json >> ${OUTFILE} | ||
|
||
echo "const r2 : RawResult = " >> ${OUTFILE} | ||
cat test/fixtures/db-journey-2.json >> ${OUTFILE} | ||
|
||
echo "const r3 : RawResult = " >> ${OUTFILE} | ||
cat test/fixtures/db-journey-polyline.json >> ${OUTFILE} | ||
|
||
sed -e '/use strict/d' -e 's/const dbJourney/const dbJourney: Journey/' test/fixtures/db-journey.js >> ${OUTFILE} | ||
|
||
sed -e '/use strict/d' -e 's/const dbJourneyPolyline/const dbJourneyPolyline: Journey/' test/fixtures/db-journey-polyline.js >> ${OUTFILE} | ||
|
||
sed -e '/use strict/d' -e 's/const dbArrivals/const dbArrivals: Alternative[]/' test/fixtures/db-arrivals.js >> ${OUTFILE} | ||
|
||
sed -e '/use strict/d' -e 's/const bvgRadar/const bvgRadar: Alternative[]/' test/fixtures/bvg-radar.js >> ${OUTFILE} | ||
|
||
echo "const journeys : Journeys = " >> ${OUTFILE} | ||
DEBUG=hafas-client node tools/debug-cli/cli.js db journeys 8000149 8000152 '{"results": 10, "transfers": 0, "stopovers": true}' >> ${OUTFILE} 2>x.txt | ||
|
||
echo "const rawResponse : RawResponse = " >> ${OUTFILE} | ||
tail -1 x.txt >> ${OUTFILE} | ||
rm x.txt | ||
|
||
echo "const locations : (Station | Stop | Location)[] = " >> ${OUTFILE} | ||
node tools/debug-cli/cli.js db locations Hannover >> ${OUTFILE} | ||
|
||
echo "const departures : Departures = " >> ${OUTFILE} | ||
node tools/debug-cli/cli.js db departures 8000152 >> ${OUTFILE} | ||
|
||
echo "const arrivals : Arrivals = " >> ${OUTFILE} | ||
node tools/debug-cli/cli.js db arrivals 8000152 >> ${OUTFILE} |
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
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
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
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
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
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
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
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
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
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
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
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
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
Oops, something went wrong.