bosco cdn should have a -d argument (like bosco run -d)
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.
So you want it to not run the build but still try and serve the files?
Let me explain my workflow and see if it make sense:
Terminal 1 (TDD):
-
npm run test:watchto automatically re-run tests on each change to code
Terminal 2 (Server):
-
bosco run -dSpin up all deps except the actual project -
npm run devto spin up an auto-reloading version of the project with all the console output and such
Terminal 3 (CDN)
-
bosco cdnin 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:watchto 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)
@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--verbosemode 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
-dcommand proposed asbosco cdnisn't doing anything with the assets at all anymore, it is literally serving whatever is there like a dumb pipe.
If bosco isn't doing anything but serving the files from disk, we don't even need it to watch them.
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.
What I really would like to do is to move to webpack hot reload. But that may be a different issue.