jmapserver-ng 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.
- package/.browserslistrc +4 -0
- package/.eslintrc.js +243 -0
- package/.prettierrc +10 -0
- package/package.json +114 -0
- package/public/index.html +44 -0
- package/readme.md +37 -0
- package/syncAndBuild.sh +27 -0
package/.browserslistrc
ADDED
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
package/package.json
ADDED
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "jmapserver-ng",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "K2 Geospatial Web Client",
|
|
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' WEBPACK_PUBLIC_PATH='/ng/' CORE_INDEX_FILE_URL='./ng-core/index.js'; 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
|
+
"start": "export NODE_ENV='development'; node build/buildfile.js start;"
|
|
15
|
+
},
|
|
16
|
+
"author": "K2 Geospatial",
|
|
17
|
+
"license": "ISC",
|
|
18
|
+
"ignore": [
|
|
19
|
+
"**/.*",
|
|
20
|
+
"node_modules"
|
|
21
|
+
],
|
|
22
|
+
"overrides": {
|
|
23
|
+
"react-pannellum": {
|
|
24
|
+
"react": "$react",
|
|
25
|
+
"react-dom": "$react-dom",
|
|
26
|
+
"postcss": "^8.4.28"
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
"dependencies": {
|
|
30
|
+
"@fortawesome/fontawesome-pro": "6.4.2",
|
|
31
|
+
"@fortawesome/fontawesome-svg-core": "^6.4.2",
|
|
32
|
+
"@fortawesome/pro-duotone-svg-icons": "^6.4.2",
|
|
33
|
+
"@fortawesome/pro-light-svg-icons": "^6.4.2",
|
|
34
|
+
"@fortawesome/pro-regular-svg-icons": "^6.4.2",
|
|
35
|
+
"@fortawesome/pro-solid-svg-icons": "^6.4.2",
|
|
36
|
+
"@fortawesome/react-fontawesome": "^0.2.0",
|
|
37
|
+
"@mapbox/mapbox-gl-draw": "^1.4.2",
|
|
38
|
+
"@mui/material": "^5.14.17",
|
|
39
|
+
"@mui/x-date-pickers": "^6.12.1",
|
|
40
|
+
"@mui/x-tree-view": "6.17.0",
|
|
41
|
+
"@turf/circle": "^6.5.0",
|
|
42
|
+
"@turf/helpers": "6.5.0",
|
|
43
|
+
"color": "^4.2.3",
|
|
44
|
+
"core-js": "^3.33.0",
|
|
45
|
+
"date-fns": "^2.23.0",
|
|
46
|
+
"formik": "^2.4.3",
|
|
47
|
+
"geometric": "^2.5.4",
|
|
48
|
+
"hast-util-to-html": "^9.0.0",
|
|
49
|
+
"jmapserver-ng-core": "1.0.1",
|
|
50
|
+
"json-pointer": "^0.6.2",
|
|
51
|
+
"jspdf": "^2.5.1",
|
|
52
|
+
"maplibre-gl": "^3.3.1",
|
|
53
|
+
"normalize-diacritics": "^4.0.0",
|
|
54
|
+
"react": "^18.2.0",
|
|
55
|
+
"react-color": "^2.19.3",
|
|
56
|
+
"react-dom": "^18.2.0",
|
|
57
|
+
"react-redux": "^8.1.2",
|
|
58
|
+
"react-window": "^1.8.9",
|
|
59
|
+
"redux": "^4.2.1",
|
|
60
|
+
"regenerator-runtime": "^0.14.0",
|
|
61
|
+
"svg-parser": "^2.0.4",
|
|
62
|
+
"swiper": "11.0.4",
|
|
63
|
+
"uuid": "^9.0.0",
|
|
64
|
+
"xlsx": "^0.18.5"
|
|
65
|
+
},
|
|
66
|
+
"devDependencies": {
|
|
67
|
+
"@babel/core": "^7.22.15",
|
|
68
|
+
"@babel/plugin-proposal-decorators": "^7.22.15",
|
|
69
|
+
"@babel/plugin-transform-arrow-functions": "^7.22.5",
|
|
70
|
+
"@babel/plugin-transform-class-properties": "^7.22.5",
|
|
71
|
+
"@babel/plugin-transform-object-assign": "^7.22.5",
|
|
72
|
+
"@babel/plugin-transform-react-jsx": "^7.22.15",
|
|
73
|
+
"@babel/plugin-transform-runtime": "^7.22.15",
|
|
74
|
+
"@babel/preset-env": "^7.22.15",
|
|
75
|
+
"@babel/preset-react": "^7.22.15",
|
|
76
|
+
"@babel/preset-typescript": "^7.22.15",
|
|
77
|
+
"@babel/runtime": "^7.22.15",
|
|
78
|
+
"@types/chai": "^4.3.6",
|
|
79
|
+
"@types/color": "^3.0.4",
|
|
80
|
+
"@types/geometric": "^2.5.0",
|
|
81
|
+
"@types/json-pointer": "^1.0.31",
|
|
82
|
+
"@types/mocha": "^10.0.1",
|
|
83
|
+
"@types/react-color": "^3.0.6",
|
|
84
|
+
"@types/react-dom": "^18.2.7",
|
|
85
|
+
"@types/react-redux": "^7.1.26",
|
|
86
|
+
"@types/react-window": "^1.8.5",
|
|
87
|
+
"@types/svg-parser": "^2.0.3",
|
|
88
|
+
"@types/uuid": "^9.0.3",
|
|
89
|
+
"@types/webpack-env": "^1.18.1",
|
|
90
|
+
"@typescript-eslint/eslint-plugin": "^6.6.0",
|
|
91
|
+
"@typescript-eslint/parser": "^6.6.0",
|
|
92
|
+
"babel-loader": "^9.1.3",
|
|
93
|
+
"chai": "^4.3.8",
|
|
94
|
+
"chai-http": "^4.4.0",
|
|
95
|
+
"css-loader": "^6.8.1",
|
|
96
|
+
"del": "^6.0.0",
|
|
97
|
+
"eslint": "^8.48.0",
|
|
98
|
+
"eslint-config-prettier": "^9.0.0",
|
|
99
|
+
"eslint-plugin-import": "^2.28.1",
|
|
100
|
+
"eslint-plugin-jsdoc": "^46.5.1",
|
|
101
|
+
"eslint-plugin-prefer-arrow": "^1.2.3",
|
|
102
|
+
"jmapserver-ng-core-types": "1.0.1",
|
|
103
|
+
"jmapserver-ng-types": "1.0.1",
|
|
104
|
+
"postcss-loader": "^7.3.3",
|
|
105
|
+
"postcss-parent-selector": "^1.0.0",
|
|
106
|
+
"style-loader": "^3.3.3",
|
|
107
|
+
"terser-webpack-plugin": "^5.3.9",
|
|
108
|
+
"ts-loader": "^9.4.4",
|
|
109
|
+
"typescript": "^5.2.2",
|
|
110
|
+
"webpack": "^5.88.2",
|
|
111
|
+
"webpack-bundle-analyzer": "^4.9.1",
|
|
112
|
+
"webpack-dev-server": "^4.15.1"
|
|
113
|
+
}
|
|
114
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<title>JMap Server NG</title>
|
|
5
|
+
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8" />
|
|
6
|
+
<meta charset="UTF-8" />
|
|
7
|
+
<style>
|
|
8
|
+
html,
|
|
9
|
+
body {
|
|
10
|
+
padding: 0px;
|
|
11
|
+
margin: 0px;
|
|
12
|
+
height: 100%;
|
|
13
|
+
width: 100%;
|
|
14
|
+
overflow: hidden;
|
|
15
|
+
}
|
|
16
|
+
#my-custom-appz {
|
|
17
|
+
position: relative;
|
|
18
|
+
overflow: hidden;
|
|
19
|
+
margin-left: 50px;
|
|
20
|
+
margin-top: 50px;
|
|
21
|
+
width: 1100px;
|
|
22
|
+
height: 850px;
|
|
23
|
+
border: 0.0625rem solid grey;
|
|
24
|
+
}
|
|
25
|
+
</style>
|
|
26
|
+
</head>
|
|
27
|
+
|
|
28
|
+
<body>
|
|
29
|
+
<script type="text/javascript">
|
|
30
|
+
window.JMAP_OPTIONS = {
|
|
31
|
+
// restBaseUrl: "http://localhost:8080/services/rest/v2.0",
|
|
32
|
+
// restBaseUrl: "https://jmap7test1.jmaponline.net/services/rest/v2.0",
|
|
33
|
+
// restBaseUrl: "https://jmap7dev-jakarta.jmaponline.net/services/rest/v2.0",
|
|
34
|
+
restBaseUrl: "https://jmap7dev-kathmandu.jmaponline.net/services/rest/v2.0",
|
|
35
|
+
map: {},
|
|
36
|
+
application: {
|
|
37
|
+
containerId: "my-custom-app"
|
|
38
|
+
},
|
|
39
|
+
hideMainLayout: true
|
|
40
|
+
}
|
|
41
|
+
</script>
|
|
42
|
+
<script defer type="text/javascript" src="/build/index.js"></script>
|
|
43
|
+
</body>
|
|
44
|
+
</html>
|
package/readme.md
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
#### The first time, install dependencies :
|
|
2
|
+
|
|
3
|
+
npm i
|
|
4
|
+
|
|
5
|
+
#### To start the application :
|
|
6
|
+
|
|
7
|
+
npm start
|
|
8
|
+
|
|
9
|
+
The application is accessible at this location : http://localhost:8082
|
|
10
|
+
|
|
11
|
+
When code is changed, it's automatically built and the web page refresh by its own (thanks webpack dev server).
|
|
12
|
+
|
|
13
|
+
#### Install the following vs-code extensions :
|
|
14
|
+
|
|
15
|
+
- https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint
|
|
16
|
+
- "Prettier - Code formatter" extention (Author : Esben Petersen)
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
#### VPS publishing
|
|
20
|
+
|
|
21
|
+
When working in a VPS environment, your personal VPS expect to find the Portal compiled sources in a local diretory inside the web hosting VPS infrascructure.
|
|
22
|
+
|
|
23
|
+
IMPORTANT: To be able to serve NG onn your VPS you need to "syncAndBuild" both jmapserver-ng and jmapserver-ng-core
|
|
24
|
+
|
|
25
|
+
To achieve this you must run this command inside the root of your local checkout of jmapserver-ng, and jmapserver-ng-core, in turn (build order is not important):
|
|
26
|
+
|
|
27
|
+
// inside jmapserver-ng:
|
|
28
|
+
./syncAndBuild.sh <vps-prefix>
|
|
29
|
+
|
|
30
|
+
// and then inside jmapserver-ng-core:
|
|
31
|
+
./syncAndBuild.sh <vps-prefix>
|
|
32
|
+
|
|
33
|
+
If your vps is "dev-jdoe.jmapserver.io" then you should run:
|
|
34
|
+
|
|
35
|
+
./syncAndBuild.sh dev-jdoe
|
|
36
|
+
|
|
37
|
+
after build, your compiled portal would be accessible at https://ng.dev-jdoe.jmapcloud.io/
|
package/syncAndBuild.sh
ADDED
|
@@ -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"
|
|
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
|