Skip to content

Commit

Permalink
chore(webapps): use angularjs from xlts.dev
Browse files Browse the repository at this point in the history
related to CAM-14395, closes camunda#1842
  • Loading branch information
tasso94 authored Apr 20, 2022
1 parent 6b30af9 commit b5413ea
Show file tree
Hide file tree
Showing 8 changed files with 143 additions and 26 deletions.
22 changes: 15 additions & 7 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
24 changes: 24 additions & 0 deletions webapps/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
1 change: 0 additions & 1 deletion webapps/camunda-commons-ui/grunt/tasks/ensureLibs.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ var included = [
'angular-resource',
'angular-route',
'angular-sanitize',
'angular-scenario',
'angular-touch',
'angular-translate',
'bootstrap',
Expand Down
3 changes: 0 additions & 3 deletions webapps/camunda-commons-ui/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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']
Expand Down
3 changes: 2 additions & 1 deletion webapps/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 14 additions & 2 deletions webapps/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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"
]
}
}
34 changes: 22 additions & 12 deletions webapps/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -966,7 +966,7 @@
<artifactId>maven-antrun-plugin</artifactId>
<executions>
<execution>
<id>generate-zip</id>
<id>build-frontend</id>
<phase>generate-resources</phase>
<goals>
<goal>run</goal>
Expand All @@ -977,15 +977,21 @@
<target>
<!-- run node build -->
<exec executable="cmd" failonerror="true">
<arg value="/c" />
<arg value="npm" />
<arg value="install" />
<arg value="/c"/>
<arg value="npm"/>
<arg value="ci"/>
</exec>
<exec executable="cmd" failonerror="true">
<arg value="/c" />
<arg value="node_modules\.bin\grunt.cmd" />
<arg value="build" />
<arg value="--color=false" />
<arg value="/c"/>
<arg value="node"/>
<arg value="scripts/xlts"/>
<arg value="install"/>
</exec>
<exec executable="cmd" failonerror="true">
<arg value="/c"/>
<arg value="node_modules\.bin\grunt.cmd"/>
<arg value="build"/>
<arg value="--color=false"/>
</exec>
</target>
</configuration>
Expand All @@ -1010,7 +1016,7 @@
<artifactId>maven-antrun-plugin</artifactId>
<executions>
<execution>
<id>generate-zip</id>
<id>build-frontend</id>
<phase>generate-resources</phase>
<goals>
<goal>run</goal>
Expand All @@ -1021,11 +1027,15 @@
<target>
<!-- run node build -->
<exec executable="npm" failonerror="true">
<arg value="install" />
<arg value="ci"/>
</exec>
<exec executable="node" failonerror="true">
<arg value="scripts/xlts"/>
<arg value="install"/>
</exec>
<exec executable="./node_modules/grunt-cli/bin/grunt" failonerror="true">
<arg value="build" />
<arg value="--color=false" />
<arg value="build"/>
<arg value="--color=false"/>
</exec>
</target>
</configuration>
Expand Down
66 changes: 66 additions & 0 deletions webapps/scripts/xlts.js
Original file line number Diff line number Diff line change
@@ -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)}`);
}

0 comments on commit b5413ea

Please sign in to comment.