From 6de275e6da760133fe9abb51b69d011cd633d6d9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michel=20Br=C3=B6ker?= Date: Thu, 13 Jun 2024 14:40:29 +0200 Subject: [PATCH] DN-34: Update to map.apps 4.18.1 --- .eslintrc | 8 +- .gitignore | 1 + README.md | 28 +++--- RELEASE.md | 2 +- gulpfile.js | 7 +- package.json | 41 +++++---- pom.xml | 89 ++++++++++++------- src/main/js/apps/sample/app.js | 16 ---- src/main/js/apps/sample/app.json | 3 - .../dn_printingenhanced/LayoutWidget.vue | 4 +- .../dn_printingenhanced/MapOnlyWidget.vue | 4 +- .../PrintingPreviewController.js | 2 +- .../js/bundles/dn_printingenhanced/main.js | 16 ---- .../bundles/dn_printingenhanced/manifest.json | 3 + .../js/bundles/dn_printingenhanced/module.js | 1 - src/main/types/mocha-global.d.ts | 1 + src/main/types/thirdparty.d.ts | 7 ++ src/main/types/vue-shim.d.ts | 4 + .../{check-licenses.js => check-licenses.ts} | 16 ++-- src/test/resources/application.properties | 2 - src/test/webapp/WEB-INF/web.xml | 6 +- src/test/webapp/index.html | 2 +- src/test/webapp/js/tests/test-init.js | 12 +-- src/test/webapp/login.css | 2 +- tsconfig.json | 8 +- 25 files changed, 157 insertions(+), 128 deletions(-) delete mode 100644 src/main/js/apps/sample/app.js delete mode 100644 src/main/js/bundles/dn_printingenhanced/main.js create mode 100644 src/main/types/mocha-global.d.ts create mode 100644 src/main/types/thirdparty.d.ts create mode 100644 src/main/types/vue-shim.d.ts rename src/support/js/{check-licenses.js => check-licenses.ts} (84%) diff --git a/.eslintrc b/.eslintrc index c20bc85..ae8ae61 100644 --- a/.eslintrc +++ b/.eslintrc @@ -1,6 +1,6 @@ { - "extends": "eslint-config-ct-prodeng", - "plugins": [ - "vue" - ] + "extends": "eslint-config-ct-prodeng", + "plugins": [ + "vue" + ] } diff --git a/.gitignore b/.gitignore index cc762e4..e41ab5f 100644 --- a/.gitignore +++ b/.gitignore @@ -14,3 +14,4 @@ /.vscode/settings.json /.externalToolBuilders/ /package-lock.json +/gulpfile.overrides.js diff --git a/README.md b/README.md index 9373675..273d65e 100644 --- a/README.md +++ b/README.md @@ -20,15 +20,19 @@ Simply add the bundle "dn_printingenhanced" to your app. [dn_printingenhanced Documentation](https://github.com/conterra/mapapps-printing-enhanced/tree/master/src/main/js/bundles/dn_printingenhanced) -## Development Guide -### Define the mapapps remote base -Before you can run the project you have to define the mapapps.remote.base property in the pom.xml-file: -`http://%YOURSERVER%/ct-mapapps-webapp-%VERSION%` - -### Other methods to to define the mapapps.remote.base property. -1. Goal parameters -`mvn install -Dmapapps.remote.base=http://%YOURSERVER%/ct-mapapps-webapp-%VERSION%` - -2. Build properties -Change the mapapps.remote.base in the build.properties file and run: -`mvn install -Denv=dev -Dlocal.configfile=%ABSOLUTEPATHTOPROJECTROOT%/build.properties` +## Quick start + +Clone this project and ensure that you have all required dependencies installed correctly (see [Documentation](https://docs.conterra.de/en/mapapps/latest/developersguide/getting-started/set-up-development-environment.html)). + +Then run the following commands from the project root directory to start a local development server: + +```bash +# install all required node modules +$ mvn initialize + +# start dev server +$ mvn compile -Denv=dev -Pinclude-mapapps-deps + +# run unit tests +$ mvn test -P run-js-tests,include-mapapps-deps +``` diff --git a/RELEASE.md b/RELEASE.md index 7951b33..b14d54e 100644 --- a/RELEASE.md +++ b/RELEASE.md @@ -1,4 +1,4 @@ -✅ Tested for map.apps 4.15.1 / Linie 4 +✅ Tested for map.apps 4.18.1 / Linie 4 #### Release Notes - autogenerated SNAPSHOT-Release diff --git a/gulpfile.js b/gulpfile.js index 4891036..b106b78 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -64,15 +64,13 @@ mapapps.registerTasks({ }, /* a list of themes inside this project */ - themes: [/*"sample-theme"*/], + themes: [], /* state that the custom theme will be dependant from map.apps everlasting theme that provides the base styles */ hasBaseThemes: true, /* state that we want to support vuetify components and therefore need the vuetify core styles*/ hasVuetify: true, themeChangeTargets: { - "vuetify": [ - // "sample_theme" - ] + "vuetify": [] }, /* A list oft target browser versions. This should be streamlined with Esri JS API requirements. */ transpileTargets: { @@ -139,7 +137,6 @@ gulp.task("lint", gulp.task("preview", gulp.series( "build", - "lint", gulp.parallel( "watch", "browser-sync" diff --git a/package.json b/package.json index 899af04..6c71dea 100644 --- a/package.json +++ b/package.json @@ -4,22 +4,33 @@ "version": "0.0.1", "license": "CC0-1.0", "scripts": { - "check-licenses": "node ./src/support/js/check-licenses.js" + "check-licenses": "tsx ./src/support/js/check-licenses.ts", + "check-types": "tsc --noEmit", + "watch-types": "tsc -w --noEmit" }, "devDependencies": { - "@conterra/ct-mapapps-typings": "4.15.1", - "@conterra/mapapps-mocha-runner": "^1.1.1", - "@types/arcgis-js-api": "4.26.0", - "chai": "^4.3.7", - "ct-mapapps-browser-sync": "0.0.30", - "ct-mapapps-gulp-js": "0.9.4", - "eslint-config-ct-prodeng": "1.3.0-next-2", - "license-checker": "^25.0.1", - "mocha": "^10.2.0", - "puppeteer": "^19.11.1", - "vue-template-compiler": "2.7.8", - "stylelint-config-ct-prodeng": "1.0.4", - "stylelint-config-recommended": "5.0.0", - "stylelint": "^13.13.1" + "@conterra/ct-mapapps-typings": "~4.18.1", + "@conterra/mapapps-mocha-runner": "1.1.1", + "@conterra/reactivity-core": "^0.4.0", + "@types/chai": "4.3.10", + "@types/license-checker": "^25.0.6", + "@types/mocha": "10.0.4", + "arcgis-js-api": "4.29.10", + "chai": "4.3.10", + "ct-mapapps-browser-sync": "0.0.39", + "ct-mapapps-gulp-js": "0.10.3", + "eslint-config-ct-prodeng": "1.4.0", + "license-checker": "25.0.1", + "mocha": "10.2.0", + "puppeteer": "21.5.2", + "stylelint": "15.11.0", + "stylelint-config-ct-prodeng": "2.0.0", + "stylelint-config-recommended": "13.0.0", + "stylelint-config-recommended-less": "2.0.0", + "ts-node": "^10.9.1", + "tsx": "^4.6.0", + "typescript": "5.4.5", + "vue": "2.7.15", + "vue-template-compiler": "2.7.15" } } diff --git a/pom.xml b/pom.xml index 3673abf..6a8ce62 100644 --- a/pom.xml +++ b/pom.xml @@ -16,7 +16,8 @@ limitations under the License. --> - 4.0.0 de.conterra.devnet @@ -46,11 +47,6 @@ pom import - - de.conterra.mapapps - ct-mapapps-js - ${mapapps.version} - @@ -81,12 +77,11 @@ ${ct.jsrt-test.version} test - - + de.conterra.mapapps mapapps-maven-plugin ${mapapps.version} @@ -96,6 +91,10 @@ ct-jsregistry-maven-plugin ${ct.jsregistry.version} + + maven-deploy-plugin + 2.8.2 + org.apache.maven.plugins maven-resources-plugin @@ -143,10 +142,9 @@ com.github.eirslett frontend-maven-plugin - 1.12.1 + 1.14.2 - v18.13.0 - 8.19.3 + v20.9.0 @@ -172,11 +170,6 @@ setproperties-maven-plugin 1.0.2 - - de.conterra.jsrt - ct-jsrt-test-maven-plugin - ${ct.jsrt-test.version} - src/main/js @@ -202,6 +195,29 @@ + + org.apache.maven.plugins + maven-enforcer-plugin + 3.4.1 + + + enforce-versions + + enforce + + + + + [3.8.0,) + + + [17,) + + + + + + de.conterra.maven setproperties-maven-plugin @@ -214,9 +230,7 @@ - - . @@ -224,7 +238,7 @@ org.apache.maven.plugins maven-compiler-plugin - 3.8.0 + 3.11.0 true @@ -232,7 +246,7 @@ org.apache.maven.plugins maven-javadoc-plugin - 3.1.0 + 3.5.0 true @@ -240,6 +254,7 @@ org.apache.maven.plugins maven-dependency-plugin + 3.5.0 unpack-themes-src @@ -342,6 +357,9 @@ **/gulpfile.js **/pom.xml + + src/main/js/**/*.min.js + XML_STYLE @@ -408,6 +426,13 @@ de.conterra.mapapps mapapps-maven-plugin + + + true + false + ${js.build.outputPath}/apps + ${project.build.directory} + @@ -435,13 +460,6 @@ - - - true - false - ${js.build.outputPath}/apps - ${project.build.directory} - maven-assembly-plugin @@ -495,11 +513,12 @@ ${project.build.directory}/webapp ${root.build.outputPath}/js - 4.15.1 + 4.18.1 + 1.5.30 ${mapapps.version} - 1.5.10 + 2.1.1 2.0.2 @@ -529,7 +548,7 @@ required --> true - true + false false @@ -562,6 +581,11 @@ ags-js-api4 test + + com.esri + terraformer-js + test + moment-js moment-js @@ -572,6 +596,11 @@ apprt-polyfill test + + de.conterra.js + reactivity + test + diff --git a/src/main/js/apps/sample/app.js b/src/main/js/apps/sample/app.js deleted file mode 100644 index 63b0846..0000000 --- a/src/main/js/apps/sample/app.js +++ /dev/null @@ -1,16 +0,0 @@ -/* - * Copyright (C) 2023 con terra GmbH (info@conterra.de) - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -import i18n from "dojo/i18n!./nls/bundle"; diff --git a/src/main/js/apps/sample/app.json b/src/main/js/apps/sample/app.json index a3ecdbc..6e23203 100644 --- a/src/main/js/apps/sample/app.json +++ b/src/main/js/apps/sample/app.json @@ -33,9 +33,6 @@ "authentication", "dn_printingenhanced" ], - "require": [ - "${app}.app" - ], "i18n": [ "bundle" ] diff --git a/src/main/js/bundles/dn_printingenhanced/LayoutWidget.vue b/src/main/js/bundles/dn_printingenhanced/LayoutWidget.vue index 4268bc3..589c401 100644 --- a/src/main/js/bundles/dn_printingenhanced/LayoutWidget.vue +++ b/src/main/js/bundles/dn_printingenhanced/LayoutWidget.vue @@ -103,7 +103,9 @@ class="infoButton" @click="showInfo=!showInfo" > - info + + info +
- info + + info +
{ + this.watch("drawPrintPreview", () => { this._handleDrawTemplateDimensions(); }); }, diff --git a/src/main/js/bundles/dn_printingenhanced/main.js b/src/main/js/bundles/dn_printingenhanced/main.js deleted file mode 100644 index 44be8f2..0000000 --- a/src/main/js/bundles/dn_printingenhanced/main.js +++ /dev/null @@ -1,16 +0,0 @@ -/* - * Copyright (C) 2023 con terra GmbH (info@conterra.de) - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -import "dojo/i18n!./nls/bundle"; diff --git a/src/main/js/bundles/dn_printingenhanced/manifest.json b/src/main/js/bundles/dn_printingenhanced/manifest.json index 55669ed..d9d574a 100644 --- a/src/main/js/bundles/dn_printingenhanced/manifest.json +++ b/src/main/js/bundles/dn_printingenhanced/manifest.json @@ -9,6 +9,9 @@ "AGS" ], "icon": {}, + "i18n": [ + "bundle" + ], "license": {}, "productName": "devnet-mapapps-printing-enhanced", "dependencies": { diff --git a/src/main/js/bundles/dn_printingenhanced/module.js b/src/main/js/bundles/dn_printingenhanced/module.js index 73d37e4..36e1f6b 100644 --- a/src/main/js/bundles/dn_printingenhanced/module.js +++ b/src/main/js/bundles/dn_printingenhanced/module.js @@ -13,7 +13,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import "."; import "ct/tools/Tool"; import "./PrintingPreviewController"; import "./PrintingInfosAnalyzer"; diff --git a/src/main/types/mocha-global.d.ts b/src/main/types/mocha-global.d.ts new file mode 100644 index 0000000..7ae74ef --- /dev/null +++ b/src/main/types/mocha-global.d.ts @@ -0,0 +1 @@ +declare const testConfig: (opts?: Record) => void; diff --git a/src/main/types/thirdparty.d.ts b/src/main/types/thirdparty.d.ts new file mode 100644 index 0000000..476971b --- /dev/null +++ b/src/main/types/thirdparty.d.ts @@ -0,0 +1,7 @@ +/* + * Copyright (C) con terra GmbH + */ + +declare module "dojo/*"; +declare module "dijit/*"; +declare module "dojox/*"; diff --git a/src/main/types/vue-shim.d.ts b/src/main/types/vue-shim.d.ts new file mode 100644 index 0000000..d6e6b86 --- /dev/null +++ b/src/main/types/vue-shim.d.ts @@ -0,0 +1,4 @@ +declare module "*.vue" { + import Vue from "vue"; + export default Vue; +} diff --git a/src/support/js/check-licenses.js b/src/support/js/check-licenses.ts similarity index 84% rename from src/support/js/check-licenses.js rename to src/support/js/check-licenses.ts index 8ce6054..9eda7f4 100644 --- a/src/support/js/check-licenses.js +++ b/src/support/js/check-licenses.ts @@ -3,7 +3,7 @@ Fails with exit code != 0 and an error message if a disallowed license is encountered. The script should be executed from the project root directory after dependencies have been installed: - $ ./node/node ./src/support/js/check-licenses.js + $ tsx ./src/support/js/check-licenses.ts To run checks yourself (e.g. to update the allow list or to get details), install license-checker yourself and run it from the project root directory: @@ -15,8 +15,8 @@ See also https://www.npmjs.com/package/license-checker */ -const checker = require("license-checker"); -const process = require("process"); +import { init as initChecker } from "license-checker"; +import { cwd, exit} from "node:process"; // Licenses known to be OK. const ACCEPTED_LICENSES = [ @@ -41,17 +41,19 @@ const SKIP_PACKAGES = [ "taffydb@2.6.2" // BSD-1-Clause License in source code ]; -checker.init( +initChecker( { - start: process.cwd(), + start: cwd(), onlyAllow: ACCEPTED_LICENSES.join(";"), excludePackages: SKIP_PACKAGES.join(";") }, (error, packages) => { + void packages; // currently unused + if (error) { console.error("Error: ", error); - process.exit(1); + exit(1); } - process.exit(0); + exit(0); } ); diff --git a/src/test/resources/application.properties b/src/test/resources/application.properties index f02ea61..5342c09 100644 --- a/src/test/resources/application.properties +++ b/src/test/resources/application.properties @@ -87,5 +87,3 @@ security.identity.self.service.url=$\{security.self.service.url\} #security.login.base=http://localhost:8080 #esri.api.arcgisPortalUrl=https://myhost.example.com/portal #proxy.allowedServerUrls=http://localhost:8080/**,trusted:true; - -printtask.service.url=https://services.conterra.de/arcgis/rest/services/Utilities/PrintingTools/GPServer/Export%20Web%20Map%20Task diff --git a/src/test/webapp/WEB-INF/web.xml b/src/test/webapp/WEB-INF/web.xml index 47a22e5..fc35e73 100644 --- a/src/test/webapp/WEB-INF/web.xml +++ b/src/test/webapp/WEB-INF/web.xml @@ -5,7 +5,7 @@ version="3.0"> map.apps sample - + @@ -18,7 +18,7 @@ ProxyServlet /proxy - +