@@ -74,16 +74,20 @@ in rec {
76 compressedJs = frontend: optimizationLevel: pkgs.runCommand "compressedJs" {} ''
76 compressedJs = frontend: optimizationLevel: pkgs.runCommand "compressedJs" {} ''
77− mkdir $out
77+ set -euo pipefail
79− # TODO profiling + static shouldn't break and need an ad-hoc workaround like that
80− ln -s "${haskellLib.justStaticExecutables frontend}/bin/frontend.jsexe/all.js" all.unminified.js
78+ cd '${haskellLib.justStaticExecutables frontend}'
80+ for f in **/all.js; do
81+ dir="$out/$(basename "$(dirname "$f")")"
83+ ln -s "$(realpath "$f")" "$dir/all.unminified.js"
81− ${if optimizationLevel == null then ''
84+ ${if optimizationLevel == null then ''
82− ln -s all.unminified.js all.js
85+ ln -s "$dir/all.unminified.js" "$dir/all.js"
83− '' else ''
86+ '' else ''
84− ${pkgs.closurecompiler}/bin/closure-compiler --externs "${reflex-platform.ghcjsExternsJs}" -O ${optimizationLevel} --jscomp_warning=checkVars --create_source_map="all.js.map" --source_map_format=V3 --js_output_file="all.js" all.unminified.js
87+ '${pkgs.closurecompiler}/bin/closure-compiler' --externs '${reflex-platform.ghcjsExternsJs}' -O '${optimizationLevel}' --jscomp_warning=checkVars --create_source_map="$dir/all.js.map" --source_map_format=V3 --js_output_file="$dir/all.js" "$dir/all.unminified.js"
85− echo "//# sourceMappingURL=all.js.map" >> all.js
88+ echo '//# sourceMappingURL=all.js.map' >> "$dir/all.js"
89 serverModules = {
93 serverModules = {
@@ -173,9 +177,9 @@ in rec {
173 pkgs.runCommand "serverExe" {} ''
177 pkgs.runCommand "serverExe" {} ''
174 mkdir $out
178 mkdir $out
176− ln -s "${if profiling then backend else haskellLib.justStaticExecutables backend}"/bin/* $out/
180+ ln -s '${if profiling then backend else haskellLib.justStaticExecutables backend}'/bin/* $out/
177− ln -s "${mkAssets assets}" $out/static.assets
181+ ln -s '${mkAssets assets}' $out/static.assets
178− ln -s ${mkAssets (compressedJs frontend optimizationLevel)} $out/frontend.jsexe.assets
182+ ln -s '${mkAssets (compressedJs frontend optimizationLevel)}'/* $out
179 echo ${version} > $out/version
183 echo ${version} > $out/version