Browse Source

interpret ELM_FLAGS correctly

master
Brian Hicks 1 year ago
parent
commit
9e9e1ba22e
  1. 2
      default.nix
  2. 4
      modd.conf
  3. 4
      script/elm-make-module.sh
  4. 4
      script/ninja.sh

2
default.nix

@ -11,7 +11,7 @@ stdenv.mkDerivation {
buildInputs = [ elmPackages.elm ninja nodePackages.uglify-js ];
buildPhase = ''
./script/ninja.sh > build.ninja
env ELM_HOME=.elm ninja
env ELM_HOME=.elm ELM_FLAGS= ninja
'';
installPhase = "cp -r dist/ $out/";

4
modd.conf

@ -1,9 +1,9 @@
script/ninja.sh {
prep: ./script/ninja.sh > build.ninja && ninja
prep: ./script/ninja.sh > build.ninja && env ELM_FLAGS=--debug ninja
}
src/** vendor/** {
prep: ninja
prep: env ELM_FLAGS=--debug ninja
}
dist/** {

4
script/elm-make-module.sh

@ -4,14 +4,14 @@ set -euo pipefail
IN="${1:-}"
OUT="${2:-}"
FLAGS="${@:3}"
ELM_FLAGS="${ELM_FLAGS:-}"
if test -z "$IN" || test -z "$OUT"; then
echo "usage: ${0:-} src/Main.elm dist/elm.js --optimize"
exit 1
fi
elm make "$FLAGS" --output="$OUT" "$IN"
elm make $ELM_FLAGS --output="$OUT" "$IN"
# change the cmpiled elm file to not immediately call the compiled function
sed -i 's/(function(scope/function init(scope/g' "$OUT"

4
script/ninja.sh

@ -4,10 +4,8 @@ set -eou pipefail
ELM_FILES="$(find src -name '*.elm')"
cat <<EOF
elmFlags=--debug
rule elm
command = ./script/elm-make-module.sh \$in \$out \$elmFlags
command = ./script/elm-make-module.sh \$in \$out
rule es6ify
command = ./script/es6ify.sh \$in \$export > \$out

Loading…
Cancel
Save