-
Notifications
You must be signed in to change notification settings - Fork 24
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
Fixes #21136: Minify js produced by elm - plugins #473
Merged
amousset
merged 1 commit into
Normation:master
from
amousset:arch_21136/minify_js_produced_by_elm_plugins
May 30, 2022
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#!/bin/bash | ||
|
||
# we want that all elm-stuff stay in src/main/elm | ||
# whatever the path from which this script is called | ||
export ELM_DIR="$( cd "$( dirname "$0" )" && pwd )" | ||
|
||
. ../../../../plugins-common/elm.sh SupervisedTargets "$@" | ||
. ../../../../plugins-common/elm.sh WorkflowUsers "$@" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#!/bin/bash | ||
|
||
# we want that all elm-stuff stay in src/main/elm | ||
# whatever the path from which this script is called | ||
export ELM_DIR="$( cd "$( dirname "$0" )" && pwd )" | ||
|
||
. ../../../../plugins-common/elm.sh AuthBackends "$@" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#!/bin/bash | ||
|
||
# we want that all elm-stuff stay in src/main/elm | ||
# whatever the path from which this script is called | ||
export ELM_DIR="$( cd "$( dirname "$0" )" && pwd )" | ||
|
||
. ../../../../plugins-common/elm.sh Branding "$@" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#!/bin/bash | ||
|
||
# we want that all elm-stuff stay in src/main/elm | ||
# whatever the path from which this script is called | ||
export ELM_DIR="$( cd "$( dirname "$0" )" && pwd )" | ||
|
||
. ../../../../plugins-common/elm.sh SupervisedTargets "$@" | ||
. ../../../../plugins-common/elm.sh WorkflowUsers "$@" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
#!/bin/bash | ||
|
||
# Lib for building elm projects | ||
|
||
# Similar to https://github.com/Normation/rudder/blob/master/webapp/sources/rudder/rudder-web/src/main/elm/build.sh | ||
# Should be kept in sync | ||
|
||
# Call without option for a dev build | ||
# Call with --release for an optimized and minified build | ||
|
||
# The argument is the name of the elm source to compile | ||
app="$1" | ||
app_l=$(echo "${app}" | tr '[:upper:]' '[:lower:]') | ||
|
||
set -e | ||
|
||
ELM="elm-0.19.1" | ||
|
||
# ELM_DIR is set in every app build script before calling elm.sh | ||
if [ -z $ELM_DIR ]; then | ||
echo "Missing ELM_DIR variable" | ||
exit 1 | ||
fi | ||
|
||
if ! command -v ${ELM} &> /dev/null | ||
then | ||
echo "# ERROR: missing ${ELM} binary" | ||
echo "# To install the right compiler version:" | ||
echo "" | ||
echo "$ curl -L -o ${ELM}.gz https://github.com/elm/compiler/releases/download/${ELM}/binary-for-linux-64-bit.gz" | ||
echo "$ gzip -d ${ELM}.gz" | ||
echo "$ chmod +x ${ELM}" | ||
echo "# then put it somewhere in your PATH" | ||
exit 1 | ||
fi | ||
|
||
build_release() { | ||
${ELM} make --optimize sources/${app}.elm --output=generated/rudder-${app_l}.js | ||
terser generated/rudder-${app_l}.js --compress 'pure_funcs="F2,F3,F4,F5,F6,F7,F8,F9,A2,A3,A4,A5,A6,A7,A8,A9",pure_getters,keep_fargs=false,unsafe_comps,unsafe' | terser --mangle --output=generated/rudder-${app_l}.min.js | ||
# we use the same path for dev and prod so we can't really use .min.js | ||
cp generated/rudder-${app_l}.min.js generated/rudder-${app_l}.js | ||
} | ||
|
||
build_dev() { | ||
${ELM} make sources/${app}.elm --output=generated/rudder-${app_l}.js | ||
} | ||
|
||
# Warning: the current fs scheme does not allow multiple elm app in a plugin | ||
cd ${ELM_DIR}/ | ||
if [ "$2" = "--release" ]; then | ||
(set -x; build_release) | ||
else | ||
(set -x; build_dev) | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#!/bin/bash | ||
|
||
# we want that all elm-stuff stay in src/main/elm | ||
# whatever the path from which this script is called | ||
export ELM_DIR="$( cd "$( dirname "$0" )" && pwd )" | ||
|
||
exec ../../../../plugins-common/elm.sh UserManagement "$@" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this includes a dependency to terser that needs to be documented