Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(webapps): use HeroDev libraries #4734

Merged
merged 9 commits into from
Nov 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
40 changes: 31 additions & 9 deletions webapps/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
31 changes: 19 additions & 12 deletions webapps/frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
}
}
53 changes: 38 additions & 15 deletions webapps/frontend/scripts/xlts.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* limitations under the License.
*/

const scope = 'xlts.dev';
const scope = 'neverendingsupport';

const {execSync} = require('child_process');

Expand All @@ -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
}
2 changes: 1 addition & 1 deletion webapps/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@
</configuration>
</execution>
<execution>
<id>Install XLTS.dev dependencies</id>
<id>Install HeroDevs XLTS dependencies</id>
<goals>
<goal>npm</goal>
</goals>
Expand Down
Loading