diff --git a/.gitignore b/.gitignore index f7f71070..0725b2ab 100644 --- a/.gitignore +++ b/.gitignore @@ -31,5 +31,5 @@ leaflet.css package-lock.json !frontend/server/bin -/frontend/server/public/javascripts/bundle.js /mock-dcs +/frontend/setup \ No newline at end of file diff --git a/frontend/check_setup.bat b/frontend/check_setup.bat new file mode 100644 index 00000000..05ab21ef --- /dev/null +++ b/frontend/check_setup.bat @@ -0,0 +1,8 @@ +@echo off + +if exist "setup" ( + echo setup.bat has already been called, skipping... +) else ( + echo setup.bat has not been called yet, installing! + call .\setup.bat +) \ No newline at end of file diff --git a/frontend/server/.vscode/launch.json b/frontend/server/.vscode/launch.json index 75379a94..7b401894 100644 --- a/frontend/server/.vscode/launch.json +++ b/frontend/server/.vscode/launch.json @@ -12,8 +12,7 @@ "/**" ], "args": ["--config", "${input:enterDir}/Config/olympus.json"], - "program": "./bin/www", - "preLaunchTask": "prepare-dcs" + "program": "./bin/www" }, { "type": "node", diff --git a/frontend/server/.vscode/tasks.json b/frontend/server/.vscode/tasks.json index 3e9c6a18..aa920e40 100644 --- a/frontend/server/.vscode/tasks.json +++ b/frontend/server/.vscode/tasks.json @@ -3,12 +3,6 @@ // for the documentation about the tasks.json format "version": "2.0.0", "tasks": [ - { - "label": "copy-website", - "type": "shell", - "command": "./scripts/copy.bat", - "isBackground": false - }, { "label": "demo-server", "type": "shell", diff --git a/frontend/server/scripts/build-release.bat b/frontend/server/scripts/build-release.bat index 20268668..d415239d 100644 --- a/frontend/server/scripts/build-release.bat +++ b/frontend/server/scripts/build-release.bat @@ -1,4 +1,4 @@ -call ./scripts/copy.bat +call .\scripts\copy.bat echo D|xcopy /Y /S /E .\bin ..\..\build\frontend\bin echo D|xcopy /Y /S /E .\public ..\..\build\frontend\public diff --git a/frontend/server/scripts/copy.bat b/frontend/server/scripts/copy.bat index cb25a194..170cff94 100644 --- a/frontend/server/scripts/copy.bat +++ b/frontend/server/scripts/copy.bat @@ -1,5 +1,2 @@ echo F|xcopy /Y ..\website\node_modules\leaflet\dist\leaflet.css .\public\stylesheets\leaflet\leaflet.css echo F|xcopy /Y ..\website\node_modules\leaflet-gesture-handling\dist\leaflet-gesture-handling.css .\public\stylesheets\leaflet\leaflet-gesture-handling.css -echo F|xcopy /Y ..\website\node_modules\leaflet.nauticscale\dist\leaflet.nauticscale.js .\public\javascripts\leaflet.nauticscale.js -echo F|xcopy /Y ..\website\node_modules\leaflet-path-drag\dist\L.Path.Drag.js .\public\javascripts\L.Path.Drag.js - diff --git a/frontend/server/scripts/demo-server.bat b/frontend/server/scripts/demo-server.bat index 1f88fb51..88807d6b 100644 --- a/frontend/server/scripts/demo-server.bat +++ b/frontend/server/scripts/demo-server.bat @@ -1,3 +1,7 @@ -call ./scripts/copy.bat -call ./scripts/create-mock-dcs.bat -node ./bin/demo --config %1 \ No newline at end of file +cd .. +call .\check_setup.bat +cd server + +call .\scripts\copy.bat +call .\scripts\create-mock-dcs.bat +node .\bin\demo --config %1 \ No newline at end of file diff --git a/frontend/setup.bat b/frontend/setup.bat new file mode 100644 index 00000000..5f242996 --- /dev/null +++ b/frontend/setup.bat @@ -0,0 +1,14 @@ +cd website + +call npm install +call npm install -g watchify babelify tsify + +cd .. + +cd server + +call npm install + +cd .. + +cd . > setup \ No newline at end of file diff --git a/frontend/website/scripts/build-release.bat b/frontend/website/scripts/build-release.bat index a816d116..fba1cedc 100644 --- a/frontend/website/scripts/build-release.bat +++ b/frontend/website/scripts/build-release.bat @@ -1 +1 @@ -call browserify ./src/index.ts -o ../../build/frontend/public/javascripts/bundle.js -t [ babelify --global true --presets [ @babel/preset-env ] --extensions '.js'] -p [ tsify --noImplicitAny ] +call browserify .\src\index.ts -o ..\..\build\frontend\public\javascripts\bundle.js -t [ babelify --global true --presets [ @babel\preset-env ] --extensions '.js'] -p [ tsify --noImplicitAny ] diff --git a/frontend/website/scripts/emit-declarations.bat b/frontend/website/scripts/emit-declarations.bat index 4e1d2ee3..a324c677 100644 --- a/frontend/website/scripts/emit-declarations.bat +++ b/frontend/website/scripts/emit-declarations.bat @@ -1 +1 @@ -tsc --project tsconfig.json --declaration --emitDeclarationOnly --outfile ./@types/olympus/index.d.ts \ No newline at end of file +tsc --project tsconfig.json --declaration --emitDeclarationOnly --outfile .\@types\olympus\index.d.ts \ No newline at end of file diff --git a/frontend/website/scripts/watch.bat b/frontend/website/scripts/watch.bat index f72f4d75..43a50e1d 100644 --- a/frontend/website/scripts/watch.bat +++ b/frontend/website/scripts/watch.bat @@ -1 +1,5 @@ -watchify ./src/index.ts --debug -o ../server/public/javascripts/bundle.js -t [ babelify --global true --presets [ @babel/preset-env ] --extensions '.js'] -p [ tsify --noImplicitAny ] \ No newline at end of file +cd .. +call .\check_setup.bat +cd website + +watchify .\src\index.ts --debug -o ..\server\public\javascripts\bundle.js -t [ babelify --global true --presets [ @babel/preset-env ] --extensions '.js'] -p [ tsify --noImplicitAny ] \ No newline at end of file diff --git a/frontend/website/src/map/map.ts b/frontend/website/src/map/map.ts index 063dc4b7..f2af5ce7 100644 --- a/frontend/website/src/map/map.ts +++ b/frontend/website/src/map/map.ts @@ -35,7 +35,7 @@ L.Map.addInitHook("addHandler", "gestureHandling", GestureHandling); // TODO would be nice to convert to ts - yes require("../../node_modules/leaflet.nauticscale/dist/leaflet.nauticscale.js") -require("../../node_modules/leaflet-path-drag/dist/L.Path.Drag.js") +require("../../node_modules/leaflet-path-drag/dist/index.js") export type MapMarkerVisibilityControl = { "category"?: string;