labzero / bootleg_phoenix

Provides Phoenix-specific Bootleg tasks.
MIT License
23 stars 7 forks source link

phoenix.digest fails with error #6

Closed rjanja closed 6 years ago

rjanja commented 6 years ago

The digest task does not succeed due to an assumed dev Mix environment.

It is not immediately obvious because errors are being squelched.

To repro:

Expected: a priv/static/manifest.json exists in the build Occurred: no manifest is generated and no assets are minified and compressed

Log output:

[target    ] cd /tmp/bootleg/build && /usr/bin/env [ -f brunch-config.js ] && [ -d node_modules ] && ./node_modules/brunch/bin/brunch b -p || true
[target    ] 02 Aug 08:23:40 - info: compiling
[target    ] 02 Aug 08:23:44 - info: compiled 6 files into 2 files, copied 3 in 7.5 sec
[target    ] cd /tmp/bootleg/build && /usr/bin/env [ -d deps/phoenix ] && mix phoenix.digest || true
Phoenix asset digest generated

To reveal the actual error being raised:

task :phoenix_digest do
  remote :build do
    "npm install"
    "./node_modules/brunch/bin/brunch b -p"
    "mix phoenix.digest"
  end
  UI.info "Phoenix asset digest generated"
end

after_task :compile, :phoenix_digest
[target    ] cd /tmp/bootleg/build && /usr/bin/env mix phoenix.digest
** (SSHError) Command exited on target with non-zero status (1)
     cmd: mix phoenix.digest
  stderr: Unchecked dependencies for environment dev:
          * phoenix_live_reload (Hex package)
  stderr:   the dependency is not available, run "mix deps.get"
  stderr: ** (Mix) Can't continue due to errors on dependencies

Once MIX_ENV is set correctly:

[target    ] cd /tmp/bootleg/build && /usr/bin/env npm install
[target    ] cd /tmp/bootleg/build && /usr/bin/env ./node_modules/brunch/bin/brunch b -p
[target    ] 02 Aug 08:29:44 - info: compiling
[target    ] 02 Aug 08:29:48 - info: compiled 6 files into 2 files, copied 3 in 7.6 sec
[target    ] cd /tmp/bootleg/build && /usr/bin/env MIX_ENV=prod mix phoenix.digest
[target    ] Check your digested files at "priv/static"
Phoenix asset digest generated

Note the additional line above that indicates success: Check your digested files at "priv/static"