From 991b9646f529953f3f98291904c34660b69859f0 Mon Sep 17 00:00:00 2001 From: Gergely Juhasz Date: Thu, 14 Nov 2024 16:35:36 +0100 Subject: [PATCH] chore(webapps): use HeroDev libraries (#4734) related to: #4549 --- Jenkinsfile | 6 ++-- webapps/README.md | 40 ++++++++++++++++++------ webapps/frontend/package.json | 31 +++++++++++-------- webapps/frontend/scripts/xlts.js | 53 +++++++++++++++++++++++--------- webapps/pom.xml | 2 +- 5 files changed, 92 insertions(+), 40 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index e05722de3b2..df6b22d753d 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -51,10 +51,10 @@ pipeline { withVault([vaultSecrets: [ [ - path : 'secret/products/cambpm/ci/xlts.dev', + path : 'secret/products/cambpm/ci/hero-devs', secretValues: [ - [envVar: 'XLTS_REGISTRY', vaultKey: 'registry'], - [envVar: 'XLTS_AUTH_TOKEN', vaultKey: 'authToken']] + [envVar: 'HERODEVS_REGISTRY', vaultKey: 'registry'], + [envVar: 'HERODEVS_AUTH_TOKEN', vaultKey: 'authToken']] ]]]) { cambpmRunMaven('.', 'clean source:jar deploy source:test-jar com.mycila:license-maven-plugin:check -Pdistro,distro-ce,distro-wildfly,distro-webjar,h2-in-memory -DaltStagingDirectory=${WORKSPACE}/staging -DskipRemoteStaging=true '+ skipTests, diff --git a/webapps/README.md b/webapps/README.md index 0a92b873b39..8b92b59d69a 100644 --- a/webapps/README.md +++ b/webapps/README.md @@ -92,26 +92,48 @@ mvn jetty:run -Pdevelop npm run start ``` -#### AngularJS libraries from XLTS.dev +#### Extended Support libraries from HeroDevs -Since December 31, 2021, AngularJS is no longer officially supported by the original maintainers (Google). We replaced the official AngularJS libraries with the ones from [XLTS.dev](https://XLTS.dev) to ensure that our used libraries stay secure and supported. We include the AngularJS libraries from XLTS.dev in our Community Edition releases from 7.18.0-alpha2 on. +##### AngularJS +Since December 31, 2021, AngularJS is no longer officially supported by the original maintainers (Google). We replaced the official AngularJS libraries with the ones from [HeroDevs](https://www.herodevs.com/) to ensure that our used libraries stay secure and supported. We include the AngularJS libraries from HeroDevs in our Community Edition releases from 7.18.0-alpha2 on. -**Heads-up:** If you build the Webapps from source code, the build includes the no longer maintained AngularJS libraries in version 1.8.2 unless you have access to the XLTS.dev registry and configure it as shown below. +**Heads-up:** If you build the Webapps from source code, the build includes the no longer maintained AngularJS libraries in version 1.8.2 unless you have access to the HeroDevs registry and configure it as shown below. -To enable pulling the XLTS.dev AngularJS libraries while building the Webapps, please configure the npm registry. Add the XLTS.dev npm registry by replacing the variables `${XLTS_REGISTRY}` and `${XLTS_AUTH_TOKEN}` in the following commands and execute the commands in your terminal. +##### Bootstrap +Since December 31, 2021, the legacy Bootstrap 3 library is no longer officially supported by the original maintainers (twbs Bootstrap). We replaced the official Bootstrap 3 libraries with the ones from [HeroDevs](https://www.herodevs.com/) to ensure that our used libraries stay secure and supported. We include the Bootstrap 3 libraries from HeroDevs in our Community Edition releases from 7.23.0-alpha2 on. -Commands to configure the XLTS.dev npm registry: +**Heads-up:** If you build the Webapps from source code, the build includes the no longer maintained Bootstrap 3 libraries in version 3.4.1 unless you have access to the HeroDevs registry and configure it as shown below. + +#### angular-ui-bootstrap +The angular-ui-bootstrap project is no longer being maintained. We replaced the official angular-ui-bootstrap libraries with the ones from [HeroDevs](https://www.herodevs.com/) to ensure that our used libraries stay secure and supported. We include the angular-ui-bootstrap libraries from HeroDevs in our Community Edition releases from 7.23.0-alpha2 on. + +**Heads-up:** If you build the Webapps from source code, the build includes the no longer maintained angular-ui-bootstrap libraries in version 2.5.6 unless you have access to the HeroDevs registry and configure it as shown below. + +#### angular-translate +Since 2024-01-15 the angular-translate project has been archived. We replaced the official angular-translate libraries with the ones from [HeroDevs](https://www.herodevs.com/) to ensure that our used libraries stay secure and supported. We include the angular-translate libraries from HeroDevs in our Community Edition releases from 7.23.0-alpha2 on. + +**Heads-up:** If you build the Webapps from source code, the build includes the no longer maintained angular-translate libraries in version 2.19.0 unless you have access to the HeroDevs registry and configure it as shown below. + +#### angular-moment +The angular-moment project has been archived on Nov 30, 2021. We replaced the official angular-moment libraries with the ones from [HeroDevs](https://www.herodevs.com/) to ensure that our used libraries stay secure and supported. We include the angular-moment libraries from HeroDevs in our Community Edition releases from 7.23.0-alpha2 on. + +**Heads-up:** If you build the Webapps from source code, the build includes the no longer maintained angular-moment libraries in version 1.3.0 unless you have access to the HeroDevs registry and configure it as shown below. + +##### Configure the HeroDevs registry +To enable pulling the HeroDevs extended support libraries while building the Webapps, please configure the npm registry. Add the HeroDevs npm registry by replacing the variables `${HERODEVS_REGISTRY}` and `${HERODEVS_AUTH_TOKEN}` in the following commands and execute the commands in your terminal. + +Commands to configure the HeroDevs npm registry: ``` -npm set @xlts.dev:registry https://${XLTS_REGISTRY}/ -npm set //${XLTS_REGISTRY}/:_authToken ${XLTS_AUTH_TOKEN} +npm set @neverendingsupport:registry=https://${HERODEVS_REGISTRY}/ +npm set //${HERODEVS_REGISTRY}/:_authToken ${HERODEVS_AUTH_TOKEN} ``` Alternatively, you can set the following environment variables: ```sh -export XLTS_REGISTRY = "example.com" # Hostname without protocol (e.g., "https://"), leading or trailing slashes -export XLTS_AUTH_TOKEN = "abc..." # Token to authenticate against the registry +export HERODEVS_REGISTRY = "example.com" # Hostname without protocol (e.g., "https://"), leading or trailing slashes +export HERODEVS_AUTH_TOKEN = "abc..." # Token to authenticate against the registry ``` You receive the information about the registry and the auth token directly from XLTS.dev. diff --git a/webapps/frontend/package.json b/webapps/frontend/package.json index 100de91cae8..e5533b6ed24 100644 --- a/webapps/frontend/package.json +++ b/webapps/frontend/package.json @@ -100,17 +100,24 @@ "webpack-merge": "5.10.0" }, "xlts": { - "xltsVersion": "1.9.3", - "dependencies": [ - "angular", - "angular-animate", - "angular-cookies", - "angular-loader", - "angular-resource", - "angular-route", - "angular-sanitize", - "angular-touch", - "angular-mocks" - ] + "angular": { + "angular": "1.9.7", + "angular-animate": "1.9.7", + "angular-cookies": "1.9.7", + "angular-loader": "1.9.7", + "angular-resource": "1.9.7", + "angular-route": "1.9.7", + "angular-sanitize": "1.9.7", + "angular-touch": "1.9.7", + "angular-mocks": "1.9.7" + }, + "bootstrap": { + "bootstrap": "3.4.5" + }, + "angularjs-essentials": { + "angular-ui-bootstrap": "2.5.7", + "angular-translate": "2.20.3", + "angular-moment": "1.3.2" + } } } diff --git a/webapps/frontend/scripts/xlts.js b/webapps/frontend/scripts/xlts.js index c603ad9715e..903e1e985d3 100755 --- a/webapps/frontend/scripts/xlts.js +++ b/webapps/frontend/scripts/xlts.js @@ -15,7 +15,7 @@ * limitations under the License. */ -const scope = 'xlts.dev'; +const scope = 'neverendingsupport'; const {execSync} = require('child_process'); @@ -33,36 +33,59 @@ const exec = (cmd, successMsg) => { }).toString(); }; +const lastOpenSourceVersions = { + 'angular-translate': '2.19.1', + 'angular-moment': '1.3.0', + 'angular-ui-bootstrap': '2.5.6' +}; + +const getVersionPostFix = angularPackage => + angularPackage === 'angular' ? '' : '-' + angularPackage.split('-')[1]; + +const getDependencyVersion = (nameSpace, npmPackage, xltsVersion) => { + switch (nameSpace) { + case 'angularjs-essentials': + return `${npmPackage}@npm:@${scope}/${nameSpace}@${lastOpenSourceVersions[npmPackage]}-${npmPackage}-${xltsVersion}`; + case 'angular': + return `${npmPackage}@npm:@${scope}/angularjs@${xltsVersion}${getVersionPostFix( + npmPackage + )}`; + default: + return `${npmPackage}@npm:@${scope}/${npmPackage}@${xltsVersion}`; + } +}; + const registryConfigured = exec(`npm get @${scope}:registry`) !== 'undefined\n'; -const {XLTS_REGISTRY, XLTS_AUTH_TOKEN} = process.env; +const {HERODEVS_REGISTRY, HERODEVS_AUTH_TOKEN} = process.env; -if (!registryConfigured && XLTS_REGISTRY && XLTS_AUTH_TOKEN) { +if (!registryConfigured && HERODEVS_REGISTRY && HERODEVS_AUTH_TOKEN) { exec( - `npm set @${scope}:registry https://${XLTS_REGISTRY}/`, - 'XLTS.dev registry configured.' + `npm set @${scope}:registry https://${HERODEVS_REGISTRY}/`, + 'XLTS registry configured.' ); exec( - `npm set //${XLTS_REGISTRY}/:_authToken ${XLTS_AUTH_TOKEN}`, - 'XLTS.dev auth token configured.' + `npm set //${HERODEVS_REGISTRY}/:_authToken ${HERODEVS_AUTH_TOKEN}`, + 'XLTS auth token configured.' ); } if ( - (registryConfigured || (XLTS_REGISTRY && XLTS_AUTH_TOKEN)) && + (registryConfigured || (HERODEVS_REGISTRY && HERODEVS_AUTH_TOKEN)) && process.argv[2] === 'install' ) { - const {xltsVersion, dependencies} = require('../package.json').xlts; + const xlts = require('../package.json').xlts; - const getNpmPackages = dependencies => - dependencies - .map( - npmPackage => `${npmPackage}@npm:@${scope}/${npmPackage}@${xltsVersion}` + const npmPackages = Object.entries(xlts) + .flatMap(([nameSpace, settings]) => + Object.entries(settings).map(([npmPackage, version]) => + getDependencyVersion(nameSpace, npmPackage, version) ) - .join(' '); + ) + .join(' '); - exec(`npm i --save-exact ${getNpmPackages(dependencies)}`); + exec(`npm i --save-exact ${npmPackages}`); } else { console.log('XLTS installation skipped.'); // eslint-disable-line } diff --git a/webapps/pom.xml b/webapps/pom.xml index 315e940f161..81ffe98d8e4 100644 --- a/webapps/pom.xml +++ b/webapps/pom.xml @@ -173,7 +173,7 @@ - Install XLTS.dev dependencies + Install HeroDevs XLTS dependencies npm