Skip to content

Commit

Permalink
WebUI: use python3-rjsmin to minify JavaScript files
Browse files Browse the repository at this point in the history
Fedora 33+ deprecated uglify-js. There are other alternatives which seem
to be fine for the minify task. Use python-rjsmin instead.

Fixes: https://pagure.io/freeipa/issue/8300
Signed-off-by: Alexander Bokovoy <[email protected]>
Reviewed-By: Christian Heimes <[email protected]>
  • Loading branch information
abbra authored and tiran committed May 12, 2020
1 parent aa34102 commit d986e84
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 12 deletions.
4 changes: 2 additions & 2 deletions .lgtm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ extraction:
- python3-setuptools
- python3-wheel
- nodejs
- uglifyjs
- python3-rjsmin
- systemd
- 389-ds-base-dev
- libssl-dev
Expand Down Expand Up @@ -79,7 +79,7 @@ extraction:
- python3-setuptools
- python3-wheel
- nodejs
- uglifyjs
- python3-rjsmin
- systemd
- 389-ds-base-dev
- libssl-dev
Expand Down
2 changes: 1 addition & 1 deletion freeipa.spec.in
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ BuildRequires: libsss_idmap-devel
BuildRequires: libsss_certmap-devel
BuildRequires: libsss_nss_idmap-devel >= %{sssd_version}
BuildRequires: nodejs(abi)
BuildRequires: uglify-js
BuildRequires: python3-rjsmin
BuildRequires: libverto-devel
BuildRequires: libunistring-devel
# 0.13.0: https://bugzilla.redhat.com/show_bug.cgi?id=1584773
Expand Down
2 changes: 1 addition & 1 deletion install/ui/build/freeipa/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,6 @@ widgets := $(wildcard ../../src/freeipa/widgets/*.js)
nav := $(wildcard ../../src/freeipa/navigation/*.js)

app.js: $(core) $(base) $(widgets) $(nav)
$(srcdir)/../../util/make-ui.sh
PYTHON=$(PYTHON) $(srcdir)/../../util/make-ui.sh

core.js: app.js
4 changes: 2 additions & 2 deletions install/ui/src/webui.profile.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ var profile = (function(){
releaseName: "lib",
action: "release",

// optimization done separately by uglify.js
// optimization done separately by python3-rjsmin
layerOptimize: false,
optimize: false,
cssOptimize: false,
Expand Down Expand Up @@ -123,4 +123,4 @@ var profile = (function(){
}
}
};
})();
})();
4 changes: 2 additions & 2 deletions install/ui/util/build/README
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
build.js is builded dojo builder, with applied patches from 'patches' folder, by
itself and compiled using uglify.js
itself and compiled using python3-rjsmin

_base/configRhino.js is unmodifed file from dojo/dojo. Required for a build to work.

Expand All @@ -9,4 +9,4 @@ Available via Academic Free License >= 2.1 OR the modified BSD license.
see: http://dojotoolkit.org/license for details

= License =
Full Dojo license is in LICENSE file.
Full Dojo license is in LICENSE file.
8 changes: 4 additions & 4 deletions install/ui/util/compile.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,14 @@ RDIR=$DIR/../release
usage() {
cat <<-__EOF__;
NAME
compile.sh - Compiles layer file of Dojo build using uglify.js.
compile.sh - Compiles layer file of Dojo build using Python rjsmin.
Deletes all other files.
SYNOPSIS
path/to/compile.sh [--help] --release RELEASE --layer NAME/NAME
DESCRIPTION
Compiles layer file of Dojo build output using uglify.js.
Compiles layer file of Dojo build output using Python rjsmin.
Deletes all other files.
OPTIONS
Expand Down Expand Up @@ -105,7 +105,7 @@ if [[ ! $OUTPUT_FILE ]] ; then
OUTPUT_FILE=$RDIR/$RELEASE/$LAYER.js
fi

# compile using uglifyjs
# compile using python rjsmin
echo "Minimizing: $RDIR/$RELEASE/$LAYER.js"
echo "Target file: $OUTPUT_FILE"
uglifyjs $RDIR/$RELEASE/$LAYER.js > $OUTPUT_FILE
${PYTHON:-python3} -m rjsmin < $RDIR/$RELEASE/$LAYER.js > $OUTPUT_FILE

0 comments on commit d986e84

Please sign in to comment.