From b5413ea1a8c9f25bf291e61ea4524fc8c2a96a38 Mon Sep 17 00:00:00 2001
From: Tassilo Weidner <3015690+tasso94@users.noreply.github.com>
Date: Wed, 20 Apr 2022 15:37:34 +0200
Subject: [PATCH] chore(webapps): use angularjs from xlts.dev
related to CAM-14395, closes #1842
---
Jenkinsfile | 22 +++++--
webapps/README.md | 24 +++++++
.../grunt/tasks/ensureLibs.js | 1 -
webapps/camunda-commons-ui/index.js | 3 -
webapps/package-lock.json | 3 +-
webapps/package.json | 16 ++++-
webapps/pom.xml | 34 ++++++----
webapps/scripts/xlts.js | 66 +++++++++++++++++++
8 files changed, 143 insertions(+), 26 deletions(-)
create mode 100755 webapps/scripts/xlts.js
diff --git a/Jenkinsfile b/Jenkinsfile
index 35f41fed617..2da4b760777 100644
--- a/Jenkinsfile
+++ b/Jenkinsfile
@@ -41,13 +41,21 @@ pipeline {
agentLabel: 'h2_perf32',
suppressErrors: false,
runSteps: {
- 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',
- withCatch: false,
- withNpm: true,
- // we use JDK 11 to build the artifacts, as it is required by the Quarkus extension
- // the compiler source and target is set to JDK 8 in the release parents
- jdkVersion: 'jdk-11-latest')
+ withVault([vaultSecrets: [
+ [
+ path : 'secret/common/ci-cambpm/xlts.dev',
+ secretValues: [
+ [envVar: 'XLTS_REGISTRY', vaultKey: 'registry'],
+ [envVar: 'XLTS_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',
+ withCatch: false,
+ withNpm: true,
+ // we use JDK 11 to build the artifacts, as it is required by the Quarkus extension
+ // the compiler source and target is set to JDK 8 in the release parents
+ jdkVersion: 'jdk-11-latest')
+ }
// archive all .jar, .pom, .xml, .txt runtime artifacts + required .war/.zip/.tar.gz for EE pipeline
// add a new line for each group of artifacts
diff --git a/webapps/README.md b/webapps/README.md
index e818ef5f5f1..614d9c43365 100644
--- a/webapps/README.md
+++ b/webapps/README.md
@@ -103,6 +103,30 @@ describe.only('Cockpit Dashboard Spec', function() {
}
```
+#### AngularJS libraries from XLTS.dev
+
+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-alpha1 on.
+
+**Heads-up:** If you build the Webapps from our source code, the build includes the no longer maintained AngularJS libraries unless you have access to the XLTS.dev registry and configure it with the help of environment variables.
+
+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.
+
+Commands to configure the XLTS.dev npm registry:
+
+```
+npm set @xlts.dev:registry https://${XLTS_REGISTRY}/
+npm set //${XLTS_REGISTRY}/:_authToken ${XLTS_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
+```
+
+You receive the information about the registry and the auth token directly from XLTS.dev.
+
## Browsers support
The supported browsers are:
diff --git a/webapps/camunda-commons-ui/grunt/tasks/ensureLibs.js b/webapps/camunda-commons-ui/grunt/tasks/ensureLibs.js
index 647bc2edc86..82f7762c9e7 100644
--- a/webapps/camunda-commons-ui/grunt/tasks/ensureLibs.js
+++ b/webapps/camunda-commons-ui/grunt/tasks/ensureLibs.js
@@ -33,7 +33,6 @@ var included = [
'angular-resource',
'angular-route',
'angular-sanitize',
- 'angular-scenario',
'angular-touch',
'angular-translate',
'bootstrap',
diff --git a/webapps/camunda-commons-ui/index.js b/webapps/camunda-commons-ui/index.js
index 5fa692abb06..d26911c655c 100644
--- a/webapps/camunda-commons-ui/index.js
+++ b/webapps/camunda-commons-ui/index.js
@@ -67,11 +67,9 @@ function requirejsConf(options) {
'angular-animate': 'node_modules/angular-animate/angular-animate',
'angular-cookies': 'node_modules/angular-cookies/angular-cookies',
'angular-loader': 'node_modules/angular-loader/angular-loader',
- 'angular-mocks': 'node_modules/angular-mocks/angular-mocks',
'angular-resource': 'node_modules/angular-resource/angular-resource',
'angular-route': 'node_modules/angular-route/angular-route',
'angular-sanitize': 'node_modules/angular-sanitize/angular-sanitize',
- 'angular-scenario': 'node_modules/angular-scenario/angular-scenario',
'angular-touch': 'node_modules/angular-touch/angular-touch',
// #### vendor dependencies
@@ -104,7 +102,6 @@ function requirejsConf(options) {
'angular-resource': ['angular'],
'angular-route': ['angular'],
'angular-sanitize': ['angular'],
- 'angular-scenario': ['angular'],
'angular-touch': ['angular'],
'angular-bootstrap': ['angular'],
'angular-translate': ['angular']
diff --git a/webapps/package-lock.json b/webapps/package-lock.json
index ffed720d2c5..583123cd52c 100644
--- a/webapps/package-lock.json
+++ b/webapps/package-lock.json
@@ -1484,7 +1484,8 @@
"angular-mocks": {
"version": "1.8.2",
"resolved": "https://registry.npmjs.org/angular-mocks/-/angular-mocks-1.8.2.tgz",
- "integrity": "sha512-I5L3P0l21HPdVsP4A4qWmENt4ePjjbkDFdAzOaM7QiibFySbt14DptPbt2IjeG4vFBr4vSLbhIz8Fk03DISl8Q=="
+ "integrity": "sha512-I5L3P0l21HPdVsP4A4qWmENt4ePjjbkDFdAzOaM7QiibFySbt14DptPbt2IjeG4vFBr4vSLbhIz8Fk03DISl8Q==",
+ "dev": true
},
"angular-moment": {
"version": "1.3.0",
diff --git a/webapps/package.json b/webapps/package.json
index 701fb8e2492..27aac34c1bd 100644
--- a/webapps/package.json
+++ b/webapps/package.json
@@ -30,12 +30,10 @@
"angular-cookies": "1.8.2",
"angular-data-depend": "https://github.com/camunda-third-party/angular-data-depend.git#8e3b66914c611069e3698fd5d4275e6cf8055d01",
"angular-loader": "1.8.2",
- "angular-mocks": "1.8.2",
"angular-moment": "1.3.0",
"angular-resource": "1.8.2",
"angular-route": "1.8.2",
"angular-sanitize": "1.8.2",
- "angular-scenario": "1.8.2",
"angular-touch": "1.8.2",
"angular-translate": "2.18.4",
"bootstrap": "3.4.1",
@@ -114,5 +112,19 @@
"terser": "5.7.0",
"watchify": "4.0.0",
"xunit-file": "1.0.0"
+ },
+ "xlts": {
+ "version": "1.8.8",
+ "dependencies": [
+ "angular",
+ "angular-animate",
+ "angular-cookies",
+ "angular-loader",
+ "angular-resource",
+ "angular-route",
+ "angular-sanitize",
+ "angular-touch",
+ "angular-mocks"
+ ]
}
}
diff --git a/webapps/pom.xml b/webapps/pom.xml
index 07ebb1f252c..657b3ce0594 100644
--- a/webapps/pom.xml
+++ b/webapps/pom.xml
@@ -966,7 +966,7 @@
maven-antrun-plugin
- generate-zip
+ build-frontend
generate-resources
run
@@ -977,15 +977,21 @@
-
-
-
+
+
+
-
-
-
-
+
+
+
+
+
+
+
+
+
+
@@ -1010,7 +1016,7 @@
maven-antrun-plugin
- generate-zip
+ build-frontend
generate-resources
run
@@ -1021,11 +1027,15 @@
-
+
+
+
+
+
-
-
+
+
diff --git a/webapps/scripts/xlts.js b/webapps/scripts/xlts.js
new file mode 100755
index 00000000000..fe7e3e408a0
--- /dev/null
+++ b/webapps/scripts/xlts.js
@@ -0,0 +1,66 @@
+/*
+ * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH
+ * under one or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information regarding copyright
+ * ownership. Camunda licenses this file to you under the Apache License,
+ * Version 2.0; 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.
+ */
+
+const scope = 'xlts.dev';
+
+const {execSync} = require('child_process');
+
+const exec = (cmd, successMsg) => {
+ return execSync(cmd, (error, stdout, stderr) => {
+ if (error) {
+ console.err(`error: ${error.message}`);
+ return;
+ }
+ if (stderr) {
+ console.err(`stderr: ${stderr}`);
+ return;
+ }
+ console.log(successMsg ? successMsg : `stdout: ${stdout}`);
+ }).toString();
+};
+
+const registryConfigured = exec(`npm get @${scope}:registry`) !== 'undefined\n';
+
+const {XLTS_REGISTRY, XLTS_AUTH_TOKEN} = process.env;
+
+if (!registryConfigured && (!XLTS_REGISTRY || !XLTS_AUTH_TOKEN)) {
+ console.log('XLTS installation skipped.');
+ return;
+}
+
+if (!registryConfigured) {
+ exec(
+ `npm set @${scope}:registry https://${XLTS_REGISTRY}/`,
+ 'XLTS.dev registry configured.'
+ );
+
+ exec(
+ `npm set //${XLTS_REGISTRY}/:_authToken ${XLTS_AUTH_TOKEN}`,
+ 'XLTS.dev auth token configured.'
+ );
+}
+
+if (process.argv[2] === 'install') {
+ const {version, dependencies} = require('../package.json').xlts;
+
+ const getNpmPackages = dependencies =>
+ dependencies
+ .map(npmPackage => `${npmPackage}@npm:@${scope}/${npmPackage}@${version}`)
+ .join(' ');
+
+ exec(`npm i --no-save ${getNpmPackages(dependencies)}`);
+}