Skip to content

Commit

Permalink
interpret ELM_FLAGS correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
BrianHicks committed May 14, 2020
1 parent 48f4f4b commit 9e9e1ba
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 8 deletions.
2 changes: 1 addition & 1 deletion default.nix
Expand Up @@ -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/";
Expand Down
4 changes: 2 additions & 2 deletions 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/** {
Expand Down
4 changes: 2 additions & 2 deletions script/elm-make-module.sh
Expand Up @@ -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"
Expand Down
4 changes: 1 addition & 3 deletions script/ninja.sh
Expand Up @@ -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
Expand Down

0 comments on commit 9e9e1ba

Please sign in to comment.