jmapserver-ng-core 1.0.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.
@@ -0,0 +1,4 @@
1
+ > 0.5%
2
+ last 2 versions
3
+ Firefox ESR
4
+ not dead
package/.eslintrc.js ADDED
@@ -0,0 +1,243 @@
1
+ const path = require("path")
2
+ module.exports = {
3
+ env: {
4
+ browser: true
5
+ },
6
+ // TODO: add "eslint:recommended" to extends one day
7
+ extends: ["plugin:@typescript-eslint/recommended-type-checked", "prettier"],
8
+ parser: "@typescript-eslint/parser",
9
+ parserOptions: {
10
+ project: path.join(__dirname, "tsconfig.json"),
11
+ sourceType: "module"
12
+ },
13
+ plugins: ["eslint-plugin-import", "eslint-plugin-jsdoc", "eslint-plugin-prefer-arrow", "@typescript-eslint"],
14
+ root: true,
15
+ rules: {
16
+ "@typescript-eslint/adjacent-overload-signatures": "error",
17
+ "@typescript-eslint/array-type": [
18
+ "error",
19
+ {
20
+ default: "array-simple"
21
+ }
22
+ ],
23
+ "@typescript-eslint/ban-types": [
24
+ "error",
25
+ {
26
+ types: {
27
+ "Object": {
28
+ message: "Avoid using the `Object` type. Did you mean `object`?"
29
+ },
30
+ "Function": {
31
+ message: "Avoid using the `Function` type. Prefer a specific function type, like `() => void`."
32
+ },
33
+ "Boolean": {
34
+ message: "Avoid using the `Boolean` type. Did you mean `boolean`?"
35
+ },
36
+ "Number": {
37
+ message: "Avoid using the `Number` type. Did you mean `number`?"
38
+ },
39
+ "String": {
40
+ message: "Avoid using the `String` type. Did you mean `string`?"
41
+ },
42
+ "Symbol": {
43
+ message: "Avoid using the `Symbol` type. Did you mean `symbol`?"
44
+ },
45
+ "{}": false
46
+ },
47
+ extendDefaults: true
48
+ }
49
+ ],
50
+ "@typescript-eslint/consistent-type-assertions": "error",
51
+ "@typescript-eslint/consistent-type-definitions": "error",
52
+ "@typescript-eslint/dot-notation": "error",
53
+ "@typescript-eslint/explicit-function-return-type": "off",
54
+ "@typescript-eslint/explicit-member-accessibility": [
55
+ "error",
56
+ {
57
+ accessibility: "explicit"
58
+ }
59
+ ],
60
+ "@typescript-eslint/explicit-module-boundary-types": "off",
61
+ "@typescript-eslint/member-delimiter-style": [
62
+ "error",
63
+ {
64
+ multiline: {
65
+ delimiter: "none",
66
+ requireLast: true
67
+ },
68
+ singleline: {
69
+ delimiter: "semi",
70
+ requireLast: false
71
+ }
72
+ }
73
+ ],
74
+ "@typescript-eslint/member-ordering": "error",
75
+ "@typescript-eslint/naming-convention": "off",
76
+ "@typescript-eslint/no-empty-function": "error",
77
+ "@typescript-eslint/no-empty-interface": "error",
78
+ "@typescript-eslint/no-explicit-any": "off",
79
+ "@typescript-eslint/no-misused-new": "error",
80
+ "@typescript-eslint/no-namespace": "error",
81
+ "@typescript-eslint/no-parameter-properties": "off",
82
+ "no-shadow": "off",
83
+ "@typescript-eslint/no-shadow": [
84
+ "error",
85
+ {
86
+ hoist: "never"
87
+ }
88
+ ],
89
+ "@typescript-eslint/no-unused-expressions": "error",
90
+ "@typescript-eslint/no-use-before-define": "off",
91
+ "@typescript-eslint/no-var-requires": "error",
92
+ "@typescript-eslint/prefer-for-of": "error",
93
+ "@typescript-eslint/prefer-function-type": "error",
94
+ "@typescript-eslint/prefer-namespace-keyword": "error",
95
+ "@typescript-eslint/quotes": [
96
+ "error",
97
+ "double",
98
+ {
99
+ avoidEscape: true
100
+ }
101
+ ],
102
+ "@typescript-eslint/semi": ["error", "never"],
103
+ "@typescript-eslint/triple-slash-reference": [
104
+ "error",
105
+ {
106
+ path: "always",
107
+ types: "prefer-import",
108
+ lib: "always"
109
+ }
110
+ ],
111
+ "@typescript-eslint/type-annotation-spacing": "error",
112
+ "@typescript-eslint/typedef": "off",
113
+ "@typescript-eslint/unified-signatures": "error",
114
+ "arrow-body-style": "error",
115
+ "arrow-parens": ["error", "as-needed"],
116
+ "brace-style": ["error", "1tbs"],
117
+ "comma-dangle": "error",
118
+ "complexity": "off",
119
+ "constructor-super": "error",
120
+ "curly": "error",
121
+ "dot-notation": "error",
122
+ "eol-last": "error",
123
+ "eqeqeq": ["error", "smart"],
124
+ "guard-for-in": "error",
125
+ "id-denylist": [
126
+ "off",
127
+ "any",
128
+ "Number",
129
+ "number",
130
+ "String",
131
+ "string",
132
+ "Boolean",
133
+ "boolean",
134
+ "Undefined",
135
+ "undefined"
136
+ ],
137
+ "id-match": "off",
138
+ "import/order": "off",
139
+ "jsdoc/check-alignment": "error",
140
+ "jsdoc/check-indentation": "error",
141
+ "max-classes-per-file": ["error", 10],
142
+ "max-len": [
143
+ "error",
144
+ {
145
+ code: 222
146
+ }
147
+ ],
148
+ "new-parens": "error",
149
+ "no-bitwise": "error",
150
+ "no-caller": "error",
151
+ "no-cond-assign": "error",
152
+ "no-console": [
153
+ "error",
154
+ {
155
+ allow: [
156
+ "warn",
157
+ "dir",
158
+ "time",
159
+ "timeEnd",
160
+ "timeLog",
161
+ "trace",
162
+ "assert",
163
+ "clear",
164
+ "count",
165
+ "countReset",
166
+ "group",
167
+ "groupEnd",
168
+ "table",
169
+ "debug",
170
+ "info",
171
+ "dirxml",
172
+ "error",
173
+ "groupCollapsed",
174
+ "Console",
175
+ "profile",
176
+ "profileEnd",
177
+ "timeStamp",
178
+ "context"
179
+ ]
180
+ }
181
+ ],
182
+ "no-debugger": "error",
183
+ "no-empty": "error",
184
+ "no-empty-function": "error",
185
+ "no-eval": "off",
186
+ "no-fallthrough": "off",
187
+ "no-invalid-this": "off",
188
+ "no-multiple-empty-lines": "error",
189
+ "no-new-wrappers": "error",
190
+ "no-throw-literal": "error",
191
+ "no-trailing-spaces": [
192
+ "error",
193
+ {
194
+ ignoreComments: true
195
+ }
196
+ ],
197
+ "no-undef-init": "error",
198
+ "no-underscore-dangle": "off",
199
+ "no-unreachable": "error",
200
+ "no-unsafe-finally": "error",
201
+ "no-unused-expressions": "error",
202
+ "no-unused-labels": "error",
203
+ "no-use-before-define": "off",
204
+ "no-var": "error",
205
+ "object-shorthand": "error",
206
+ "one-var": ["error", "never"],
207
+ "prefer-const": "error",
208
+ "quote-props": ["error", "consistent-as-needed"],
209
+ "quotes": ["error", "double", "avoid-escape"],
210
+ "radix": "error",
211
+ "semi": ["error", "never"],
212
+ "space-before-function-paren": [
213
+ "error",
214
+ {
215
+ anonymous: "never",
216
+ asyncArrow: "always",
217
+ named: "never"
218
+ }
219
+ ],
220
+ "spaced-comment": [
221
+ "error",
222
+ "always",
223
+ {
224
+ markers: ["/"]
225
+ }
226
+ ],
227
+ "use-isnan": "error",
228
+ "valid-typeof": "off",
229
+ "no-unused-vars": "off",
230
+ "@typescript-eslint/no-unused-vars": "off",
231
+ "@typescript-eslint/no-unsafe-argument": "off",
232
+ "@typescript-eslint/no-inferrable-types": "off",
233
+ "@typescript-eslint/no-unsafe-member-access": "off",
234
+ "@typescript-eslint/restrict-template-expressions": "off",
235
+ "@typescript-eslint/no-unsafe-assignment": "off",
236
+ "@typescript-eslint/no-unsafe-return": "off",
237
+ "@typescript-eslint/no-misused-promises": "off",
238
+ "@typescript-eslint/no-floating-promises": "off",
239
+ "@typescript-eslint/unbound-method": "off",
240
+ "@typescript-eslint/no-unsafe-call": "off",
241
+ "@typescript-eslint/require-await": "off"
242
+ }
243
+ }
package/.prettierrc ADDED
@@ -0,0 +1,10 @@
1
+ {
2
+ "printWidth": 120,
3
+ "semi": false,
4
+ "quoteProps": "consistent",
5
+ "jsxBracketSameLine": true,
6
+ "trailingComma": "none",
7
+ "tabWidth": 2,
8
+ "arrowParens": "avoid",
9
+ "bracketSpacing": true
10
+ }
package/package.json ADDED
@@ -0,0 +1,104 @@
1
+ {
2
+ "name": "jmapserver-ng-core",
3
+ "version": "1.0.0",
4
+ "description": "K2 Geospatial - JMap Server NG Core library implementation",
5
+ "private": false,
6
+ "main": "public/index.js",
7
+ "scripts": {
8
+ "test": "echo \"Error: no test specified\" && exit 1",
9
+ "lint": "export NODE_ENV='production'; node build/buildfile.js lint;",
10
+ "build": "node build/buildfile.js build ",
11
+ "build-vps": "export NODE_ENV='development' SERVER_JS_PATH='/var/www/html/ng/ng-core' WEBPACK_PUBLIC_PATH='/ng-core/'; node build/buildfile.js build-vps;",
12
+ "count-all": "find ./src -name '*.ts*' | xargs wc -l",
13
+ "count-test": "find ./src -name '*.spec.ts' | xargs wc -l",
14
+ "count-all-scss": "find ./src -name '*.scss*' | xargs wc -l",
15
+ "start": "export NODE_ENV='development'; node build/buildfile.js start;"
16
+ },
17
+ "author": "K2 Geospatial developer",
18
+ "license": "ISC",
19
+ "ignore": [
20
+ "**/.*",
21
+ "node_modules"
22
+ ],
23
+ "overrides": {
24
+ "react-pannellum": {
25
+ "react": "$react",
26
+ "react-dom": "$react-dom",
27
+ "postcss": "^8.4.28"
28
+ }
29
+ },
30
+ "dependencies": {
31
+ "@fortawesome/fontawesome-pro": "^6.4.2",
32
+ "@fortawesome/fontawesome-svg-core": "^6.4.2",
33
+ "@fortawesome/pro-duotone-svg-icons": "^6.4.2",
34
+ "@fortawesome/pro-light-svg-icons": "^6.4.2",
35
+ "@fortawesome/pro-regular-svg-icons": "^6.4.2",
36
+ "@fortawesome/pro-solid-svg-icons": "^6.4.2",
37
+ "@fortawesome/react-fontawesome": "^0.2.0",
38
+ "@turf/turf": "^6.5.0",
39
+ "ajv": "^8.12.0",
40
+ "ajv-formats": "^2.1.1",
41
+ "axios": "^1.6.1",
42
+ "core-js": "^3.33.0",
43
+ "date-fns": "^2.30.0",
44
+ "history": "^5.3.0",
45
+ "html2canvas": "^1.4.1",
46
+ "json-logic-js": "^2.0.2",
47
+ "json-pointer": "^0.6.2",
48
+ "maplibre-gl": "^3.3.0",
49
+ "material-design-icons": "^3.0.1",
50
+ "normalize-diacritics": "^4.0.0",
51
+ "proj4": "^2.9.0",
52
+ "react": "^18.2.0",
53
+ "react-dom": "^18.2.0",
54
+ "react-pannellum": "^0.2.6",
55
+ "react-redux": "^8.1.2",
56
+ "react-rnd": "^10.3.4",
57
+ "react-tooltip": "^5.21.1",
58
+ "react-zoom-pan-pinch": "^3.1.0",
59
+ "redux": "^4.2.1",
60
+ "regenerator-runtime": "^0.14.0",
61
+ "uuid": "^9.0.0",
62
+ "wellknown": "^0.5.0"
63
+ },
64
+ "devDependencies": {
65
+ "@babel/core": "^7.22.10",
66
+ "@babel/plugin-proposal-decorators": "^7.22.10",
67
+ "@babel/plugin-transform-arrow-functions": "^7.22.5",
68
+ "@babel/plugin-transform-class-properties": "^7.22.5",
69
+ "@babel/plugin-transform-object-assign": "^7.22.5",
70
+ "@babel/plugin-transform-react-jsx": "^7.22.5",
71
+ "@babel/plugin-transform-runtime": "^7.22.10",
72
+ "@babel/preset-env": "^7.22.10",
73
+ "@babel/preset-react": "^7.22.5",
74
+ "@babel/preset-typescript": "^7.22.5",
75
+ "@babel/runtime": "^7.22.10",
76
+ "@types/json-pointer": "^1.0.31",
77
+ "@types/proj4": "^2.5.2",
78
+ "@types/react": "^18.2.20",
79
+ "@types/react-dom": "^18.2.7",
80
+ "@types/uuid": "^9.0.2",
81
+ "@types/wellknown": "^0.5.5",
82
+ "@typescript-eslint/eslint-plugin": "^6.6.0",
83
+ "@typescript-eslint/parser": "^6.6.0",
84
+ "babel-loader": "^9.1.3",
85
+ "css-loader": "^6.8.1",
86
+ "del": "^6.1.1",
87
+ "eslint": "^8.47.0",
88
+ "eslint-config-prettier": "^9.0.0",
89
+ "eslint-plugin-import": "^2.28.1",
90
+ "eslint-plugin-jsdoc": "^46.5.1",
91
+ "eslint-plugin-prefer-arrow": "^1.2.3",
92
+ "file-loader": "^6.2.0",
93
+ "jmapserver-ng-core-types": "1.0.1",
94
+ "postcss-loader": "^7.3.3",
95
+ "postcss-parent-selector": "^1.0.0",
96
+ "style-loader": "^3.3.3",
97
+ "terser-webpack-plugin": "^5.3.9",
98
+ "ts-loader": "^9.4.4",
99
+ "typescript": "^5.2.2",
100
+ "webpack": "^5.52.0",
101
+ "webpack-bundle-analyzer": "^4.9.0",
102
+ "webpack-dev-server": "^4.15.1"
103
+ }
104
+ }
@@ -0,0 +1,23 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <title>JMap Server NG - Core</title>
5
+ <meta http-equiv="Content-Type" content="text/html;charset=UTF-8" />
6
+ <meta charset="UTF-8" />
7
+ </head>
8
+ <body class="jmap_wrapper">
9
+ <script type="text/javascript">
10
+ window.JMAP_OPTIONS = {
11
+ restBaseUrl: "https://api.dev-<username>.jmapcloud.io",
12
+ map: {
13
+ zoom: 9.757829447748511,
14
+ center: {
15
+ x: -73.66415865898597,
16
+ y: 45.53583011032552
17
+ }
18
+ }
19
+ }
20
+ </script>
21
+ <script defer type="text/javascript" src="/build/index.js"></script>
22
+ </body>
23
+ </html>
package/readme.md ADDED
@@ -0,0 +1,20 @@
1
+ #### The first time, install dependencies :
2
+
3
+ npm i
4
+
5
+ #### To start the Core library :
6
+
7
+ npm start
8
+
9
+ A dev example page is accessible at this location : http://localhost:8085
10
+
11
+ To access a different project : http://localhost:8085?ngProjectId=XXX
12
+
13
+ The JS entry file is accessible at this location : http://localhost:8085/build/index.js
14
+
15
+ When code is changed, it's automatically built and the web page refresh by its own (thanks webpack dev server).
16
+
17
+ #### Install the following vs-code extensions :
18
+
19
+ - https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint
20
+ - "Prettier - Code formatter" extention (Author : Esben Petersen)
@@ -0,0 +1,27 @@
1
+ #!/bin/bash
2
+
3
+ if [[ $# -eq 0 ]] ; then
4
+ echo 'Usage: syncAndBuild.sh <hostname>|build'
5
+ exit 1
6
+ fi
7
+
8
+ SERVICE_NAME="jmapserver-ng-core"
9
+
10
+ if [[ $1 == build ]]; then
11
+ # This part is meant to run on the VPS
12
+ source ~/.nvm/nvm.sh
13
+ nvm install 18
14
+ nvm use 18
15
+ npm install
16
+ npm run build-vps
17
+
18
+ else
19
+ # This part is meant to run on your local dev machine
20
+ SSH_HOST="k2geo@${1}.jmapcloud.io"
21
+
22
+ RSYNC_OPTIONS=(-a -v --delete --exclude="node_modules" --exclude="public" --exclude=".git")
23
+ RSYNC_SOURCE="."
24
+ RSYNC_DESTINATION="${SSH_HOST}:${SERVICE_NAME}"
25
+
26
+ rsync "${RSYNC_OPTIONS[@]}" "$RSYNC_SOURCE" "$RSYNC_DESTINATION" && ssh "$SSH_HOST" "cd $SERVICE_NAME && ./syncAndBuild.sh build"
27
+ fi