swimlane / systemjs-route-bundler

SystemJS Route-Driven Bundler
MIT License
41 stars 8 forks source link

async gulp fails #9

Closed lookfirst closed 9 years ago

lookfirst commented 9 years ago

In the seed project, I'm trying to runSequence() the route bundler (the build task) and then call a minify task, but due to the way that the bundler is async, the promise returned from the build() method from the route bundler doesn't seem to be the final (first?) promise, so gulp has no idea when build() finishes and tries to run the minify task before the build task is done.

amcdnl commented 9 years ago

@marjan-georgiev probably need to make build return a promise

lookfirst commented 9 years ago

It does return a promise. It feels more like the gulp lines in builder.buildTrees (around building app...) haven't finished.

amcdnl commented 9 years ago

@lookfirst - we just hit this on prod, will be fixed shortly

lookfirst commented 9 years ago

:+1:

marjan-georgiev commented 9 years ago

I pushed a fix for this.

Edit: the fix is in the seed project. Will update this project too.

lookfirst commented 9 years ago

By the way, if you want to avoid 'Merge branch 'master' of github.com:Swimlane/angular-systemjs-seed" commits, then just git pull --rebase.... ;-)

lookfirst commented 9 years ago

Also, please try to strive to make cleaner commits. A single commit should only have the changes associated with the commit message. Using a tool like SourceTree makes that really easy cause you can easily pick and choose which individual lines get included in a commit. The benefit is that it then becomes super easy to cherry pick commits as well as back out any commits if necessary.

lookfirst commented 9 years ago

I'm still seeing this issue in my project using the latest version of this code that is in master (1.0.6). Any ideas?

marjan-georgiev commented 9 years ago

I just tried running gulp prod on the latest master of your project, and it seems to be working fine?

Here's the output

[01:58:52] Starting 'prod'...
[01:58:52] Starting 'release'...
[01:58:52] Starting 'clean'...
[01:58:52] Finished 'clean' after 17 ms
[01:58:52] Starting 'compile'...
[01:58:52] Starting 'less'...
[01:58:52] Starting 'less-themes'...
[01:58:52] Starting 'html'...
[01:58:52] Starting 'es6'...
[01:58:52] Starting 'es6-coffee'...
[01:58:52] Starting 'json'...
[01:58:52] Starting 'move'...
[01:58:52] Finished 'json' after 303 ms
[01:58:52] Finished 'move' after 305 ms
[01:58:52] Finished 'es6-coffee' after 390 ms
[01:58:52] Finished 'less-themes' after 454 ms
[01:58:52] Finished 'less' after 467 ms
[01:58:52] Finished 'html' after 511 ms
[01:58:52] Finished 'es6' after 537 ms
[01:58:52] Finished 'compile' after 560 ms
[01:58:52] Starting 'cache-bust'...
[01:58:52] Finished 'cache-bust' after 7.08 ms
[01:58:52] Starting 'build'...
tracing source files...
generating bundles...
building...
building bundles...
building routes...
building app...
build succeeded
[01:58:57] Finished 'build' after 4.3 s
[01:58:57] Finished 'release' after 4.89 s
[01:58:57] Starting 'minify'...
[01:59:00] Finished 'minify' after 3.08 s
[01:59:00] Starting 'serve'...
[BS] Access URLs:
 -----------------------------------
    Local: http://localhost:9000
 External: http://192.168.0.101:9000
 -----------------------------------
[BS] Serving files from: dist/
[01:59:00] Finished 'serve' after 72 ms
[01:59:00] Finished 'prod' after 8.04 s
lookfirst commented 9 years ago

try again. i just pushed some big updates. note i have minify commented out. you'll also need to torch the local node_modules folder.

the problem is weird... it doesn't always happen. =( i think it has to do with some sort of buffering of the data.

marjan-georgiev commented 9 years ago

Ran it 3 times, always the same output. Can you show me what it outputs when you run it?

[02:52:03] Requiring external module coffee-script/register
[02:52:04] Running as: production
[02:52:06] Using gulpfile ~/Projects/Playground/systemjs-seed/gulpfile.coffee
[02:52:06] Starting 'run'...
[02:52:06] Starting 'release'...
[02:52:06] Starting 'recompile'...
[02:52:06] Starting 'clean'...
[02:52:06] Finished 'clean' after 15 ms
[02:52:06] Starting 'compile'...
[02:52:06] Starting 'less'...
[02:52:06] Starting 'less-themes'...
[02:52:06] Starting 'html'...
[02:52:06] Starting 'es6'...
[02:52:06] Starting 'es6-coffee'...
[02:52:06] Starting 'json'...
[02:52:06] Starting 'copy'...
[02:52:06] Starting 'index.html'...
[02:52:06] Finished 'index.html' after 244 ms
[02:52:06] Finished 'json' after 306 ms
[02:52:06] Finished 'copy' after 341 ms
[02:52:07] Finished 'es6-coffee' after 445 ms
[02:52:07] Finished 'less-themes' after 476 ms
[02:52:07] Finished 'less' after 485 ms
[02:52:07] Finished 'html' after 551 ms
[02:52:07] Finished 'es6' after 607 ms
[02:52:07] Finished 'compile' after 625 ms
[02:52:07] Finished 'recompile' after 640 ms
[02:52:07] Starting 'cache-bust'...
[02:52:07] Finished 'cache-bust' after 12 ms
[02:52:07] Starting 'routeBundler'...
tracing source files...
generating bundles...
building...
building bundles...
building routes...
building app...
build succeeded
[02:52:11] Finished 'routeBundler' after 4.32 s
[02:52:11] Finished 'release' after 4.98 s
[02:52:11] Starting 'serve'...
[02:52:11] Finished 'serve' after 15 ms
[02:52:11] Finished 'run' after 4.99 s
[BS] Access URLs:
 -----------------------------------
    Local: http://localhost:9000
 External: http://192.168.0.101:9000
 -----------------------------------
[BS] Serving files from: dist/
lookfirst commented 9 years ago

Sure, the output is fine, but the error is that there is nothing in dist/app/app.js

lookfirst commented 9 years ago

You'll also need to uncomment the minify line in the gulpfile.

I just tried it and it worked fine, app.js was generated. But the issue is that it doesn't always work. There is some race condition of the routeBundler not fully finishing before minify runs.