Skip to content

Commit

Permalink
Merge pull request #27 from panaaj/v2_api_support
Browse files Browse the repository at this point in the history
feature: Add v2 api support, converto to typescript
  • Loading branch information
tkurki authored Jan 19, 2024
2 parents 649d603 + 5635e20 commit 80bf176
Show file tree
Hide file tree
Showing 23 changed files with 861 additions and 429 deletions.
25 changes: 25 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
// eslint-disable-next-line no-undef
module.exports = {
root: true,
extends: ['eslint:recommended', 'prettier'],
parserOptions: {
ecmaVersion: 2019,
sourceType: 'module'
},
env: {
node: true,
es2019: true
},
overrides: [
{
files: ['**/*.ts'],
extends: [
'eslint:recommended',
'plugin:@typescript-eslint/recommended',
'prettier'
],
parser: '@typescript-eslint/parser',
plugins: ['@typescript-eslint']
}
]
}
2 changes: 1 addition & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: '16.x'
node-version: '18.x'
registry-url: 'https://registry.npmjs.org'
- run: npm publish --access public
env:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:

strategy:
matrix:
node-version: [10.x, 16.x]
node-version: [18.x]

steps:
- uses: actions/checkout@v2
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
node_modules/
.DS_Store
plugin/
package-lock.json
tsconfig.tsbuildinfo
8 changes: 8 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
node_modules/
.DS_Store
test/
package-lock.json
src/
tsconfig.json
.eslintrc.js
.prettierrc.json
.github/
tsconfig.tsbuildinfo
*.tgz
5 changes: 5 additions & 0 deletions .prettierrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"semi": false,
"singleQuote": true,
"trailingComma": "none"
}
34 changes: 27 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,27 +1,47 @@
# Signal K Node server Charts plugin
# Signal K server Charts plugin

Signal K Node server plugin to provide chart metadata, such as name, description and location of the actual chart tile data.

Supports both v1 and v2 Signal K resources api paths.

| Server Version | API | Path |
|--- |--- |--- |
| 1.x.x | v1 | `/signalk/v1/api/resources/charts` |
| 2.x.x | v2 | `/signalk/v2/api/resources/charts` |


_Note: v2 resource paths will only be made available on Signal K server >= v2._

### Usage

1. Install "Signal K Charts" plugin from Signal K Appstore

2. Add "Chart paths" in plugin configuration. Defaults to `${signalk-configuration-path}/charts`
2. Configure plugin in **Plugin Config**

- Add "Chart paths" which are the paths to the folders where chart files are stored. Defaults to `${signalk-configuration-path}/charts`


3. Add "Chart paths" in plugin configuration. Defaults to `${signalk-configuration-path}/charts`

<img src="https://user-images.githubusercontent.com/1435910/39382493-57c1e4dc-4a6e-11e8-93e1-cedb4c7662f4.png" alt="Chart paths configuration" width="450"/>

3. Put charts into selected paths

4. Add optional online chart providers
4. Put charts into selected paths

5. Add optional online chart providers

<img src="https://user-images.githubusercontent.com/1435910/45048136-c65d2e80-b083-11e8-99db-01e8cece9f89.png" alt="Online chart providers configuration" width="450"/>




_WMS example:_
![image](https://user-images.githubusercontent.com/38519157/102832518-90077100-443e-11eb-9a1d-d0806bb2b10b.png)

5. Activate plugin
<img src="https://user-images.githubusercontent.com/38519157/102832518-90077100-443e-11eb-9a1d-d0806bb2b10b.png" alt="server type configuration" width="450"/>

6. Activate plugin

6. Use one of the client apps supporting Signal K charts, for example:
7. Use one of the client apps supporting Signal K charts, for example:
- [Freeboard SK](https://www.npmjs.com/package/@signalk/freeboard-sk)
- [Tuktuk Chart Plotter](https://www.npmjs.com/package/tuktuk-chart-plotter)

Expand Down
1 change: 0 additions & 1 deletion index.js

This file was deleted.

27 changes: 23 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,20 @@
{
"name": "@signalk/charts-plugin",
"version": "2.3.1",
"version": "2.4.0",
"description": "Signal K plugin to provide chart support for Signal K server",
"main": "index.js",
"main": "plugin/index.js",
"scripts": {
"build": "tsc",
"build-declaration": "tsc --declaration --allowJs false",
"watch": "npm run build -- -w",
"start": "npm run build -- -w",
"prepare": "tsc",
"prettier": "prettier -w src/",
"lint": "eslint -c .eslintrc.js --ext .ts --ext .js --fix src/",
"format": "npm run prettier && npm run lint",
"ci-lint": "eslint -c .eslintrc.js --ext .ts --ext .js src/ && prettier --check src/",
"test": "mocha",
"deploy": "npm test && git tag -a v$npm_package_version -m 'Release v$npm_package_version'; git push --tags; npm publish --access public --scope @signalk ."
"deploy": "npm build && npm test && git tag -a v$npm_package_version -m 'Release v$npm_package_version'; git push --tags; npm publish --access public --scope @signalk ."
},
"license": "Apache-2.0",
"keywords": [
Expand All @@ -22,6 +31,7 @@
},
"dependencies": {
"@mapbox/mbtiles": "^0.12.1",
"@signalk/server-api": "^2.0.0-beta.3",
"baconjs": "1.0.1",
"bluebird": "3.5.1",
"lodash": "^4.17.11",
Expand All @@ -32,10 +42,19 @@
"url": "https://github.com/SignalK/charts-plugin"
},
"devDependencies": {
"@types/express": "^4.17.17",
"@types/lodash": "^4.14.191",
"@types/node": "^18.14.4",
"@typescript-eslint/eslint-plugin": "^5.52.0",
"@typescript-eslint/parser": "^5.52.0",
"body-parser": "1.18.2",
"chai": "4.1.2",
"chai-http": "^4.2.1",
"eslint": "^8.34.0",
"eslint-config-prettier": "^8.6.0",
"express": "4.16.2",
"mocha": "5.0.0"
"mocha": "5.0.0",
"prettier": "^2.8.4",
"typescript": "^4.5.4"
}
}
1 change: 1 addition & 0 deletions src/@types/bluebird.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
declare module 'bluebird'
1 change: 1 addition & 0 deletions src/@types/mapbox_mbtiles.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
declare module '@mapbox/mbtiles'
1 change: 1 addition & 0 deletions src/@types/xml2js.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
declare module 'xml2js'
175 changes: 0 additions & 175 deletions src/charts.js

This file was deleted.

Loading

0 comments on commit 80bf176

Please sign in to comment.