lukeed / taskr

A fast, concurrency-focused task automation tool.
MIT License
2.53k stars 74 forks source link

`fly.unwrap` fires before fully initialized #204

Closed lukeed closed 7 years ago

lukeed commented 7 years ago

Within PR #189, the source globs are expanded once saved to the Fly instance (as fly._.files) for further use.

However, plugins that make use of unwrap are executing that command before the source's logic has finished, thus breaking fly.unwrap. Here is relevant diff.

The end result is cannot read 'then' of undefined..

lukeed commented 7 years ago

Immediately throws if unwrap is used within an plugin. Stack:

stack:
  - TypeError: Cannot read property 'then' of undefined
  -     at Fly.unwrap (./node_modules/fly/lib/fly.js 186:21)
  -     at Fly.compile (./node_modules/fly-browserify/index.js 4:15)
  -     at ./node_modules/fly/lib/utils/defer.js 13:4
  -     at ./node_modules/fly/lib/utils/defer.js 8:10
  -     at Fly.<anonymous> (./node_modules/fly-browserify/index.js 28:42)
  -     at ./node_modules/fly/lib/fly.js 324:48
  -     at next (native)
  -     at onFulfilled (./node_modules/co/index.js 65:19)
message: Cannot read property 'then' of undefined
[16:40:18] scripts failed due to TypeError: Cannot read property 'then' of undefined