bosco icon indicating copy to clipboard operation
bosco copied to clipboard

bosco cdn should have a -d argument (like bosco run -d)

Open bettiolo opened this issue 8 years ago • 6 comments

Bosco should just serve the files generated by webpack in that folder as specified by bosco-service.json. It should not run the build. This would allow us to have a better integration with webpack.

bettiolo avatar Jul 28 '16 23:07 bettiolo

So you want it to not run the build but still try and serve the files?

cliftonc avatar Aug 02 '16 13:08 cliftonc

Let me explain my workflow and see if it make sense:

Terminal 1 (TDD):

  • npm run test:watch to automatically re-run tests on each change to code

Terminal 2 (Server):

  • bosco run -d Spin up all deps except the actual project
  • npm run dev to spin up an auto-reloading version of the project with all the console output and such

Terminal 3 (CDN)

  • bosco cdn in the current folder to serve all assets and watch for changes (usually the build would fail because it would exceed the timeout)

Terminal 4 (ASSETS)

  • npm run build:watch to automatically rebuild the client-side bundle and see the output so I can refresh the browser only after the build has been completed. This should be improved to include hot-reloading of the modules automatically.

I wish that bosco cdn -d would be just serving all my dependencies' assets and watch for changes to the files recorded in bosco-service.json's assets section. The output of bosco cdn is currently inferior to the output from webpack.

I need to see when the files are finished being built and the size of the bundle. The output from bosco "Reloaded ...." is not explicit enough to know when the build is finished.... Testing the wrong assets is a waste of time.

My builds take around 7 seconds in development mode, and 13 seconds in production mode (which breaks the bosco cdn's timeout)

screen shot 2016-08-02 at 12 11 44

bettiolo avatar Aug 02 '16 19:08 bettiolo

@geophree can you pick up solutions to this?

Some points:

  • We have chosen to limit the output of build commands in bosco cdn - so we could introduce a --verbose mode if you really want to see all of it.
  • You can configure what text in the output of the build command triggers the fact that the build is done, to avoid early refreshes - do you have it looking for the right text?
  • Due to historic reasons (e.g. Bosco doing the minification via uglify), the cdn mode currently creates all the bundles and serves them from memory vs write them all to disk and serve them from there - mostly because I didn't see any value in writing the bundles to disk.
  • I can't see why in the mode where we skip minification in bosco that it couldn't just always serve the asset directly from disk and bypass the in memory cache, seems like the simplest solution to the problem, then you don't even need the -d command proposed as bosco cdn isn't doing anything with the assets at all anymore, it is literally serving whatever is there like a dumb pipe.

cliftonc avatar Aug 03 '16 08:08 cliftonc

If bosco isn't doing anything but serving the files from disk, we don't even need it to watch them.

geophree avatar Aug 03 '16 15:08 geophree

Agree, but this only applies in the case that bosco isn't minifying them as there is a guaranteed 1-1 mapping of source > bundle.

cliftonc avatar Aug 03 '16 15:08 cliftonc

What I really would like to do is to move to webpack hot reload. But that may be a different issue.

bettiolo avatar Aug 03 '16 17:08 bettiolo