mint-metrics / mojito-js-delivery

🧪 Source-controlled JS split testing framework for building and launching A/B tests.
https://mojito.mx/docs/js-delivery-intro
Other
16 stars 30 forks source link

Speed up gulp publish command for interactive usage #73

Closed kingo55 closed 3 years ago

kingo55 commented 4 years ago

When the internet is slow, your container is large or you're publishing large dev containers frequently, then gulp publish can be time consuming:

$ gulp && gulp publish
[10:42:51] Using gulpfile ~/Documents/example/gulpfile.js
[10:42:51] Starting 'default'...
[10:42:53] Finished 'default' after 1.59 s
Mojito container built with 13 tests (20.45 KB):
  Live (2) - w160 w163
  Staging (2) - w143 w164
  Diverted (9) - w139 w141 w142 w147 w152 w154-1 w159 w161 w162b
  Inactive (21)
[10:42:54] Using gulpfile ~/Documents/example/gulpfile.js
[10:42:54] Starting 'publish'...
[10:42:58] [update] example.js
[10:43:02] [update] example.pretty.js
[10:43:02] Finished 'publish' after 7.94 s

How might we speed this process up? @allmywant @dapperdrop

allmywant commented 4 years ago

@kingo55 @dapperdrop I think for the most of time, we use gulp publish to publish tests we're testing in development branch, and we use Request.ly to inject the .js or .pretty.js (for me, always .pretty.js). So we can add a cli parameter to specify which type of file to publish, default is 'both'.

dapperdrop commented 4 years ago

@allmywant

Good suggestion. I might even go further and suggest we default publish to "pretty" only. Not sure about you guys, but I exclusively use gulp && gulp publish in my CLI for dev purposes.

When pushing something to a prod environment for clients to preview, it usually involves a merge in BitBucket or manually copy pasting into optly/convert.

kingo55 commented 4 years ago

@dapperdrop @allmywant - very interesting suggestions.

I think defaulting to just .pretty.js is a pretty usable default.

kingo55 commented 4 years ago

Been using the following pattern recently, to watch the library's files and rebuild/publish the container when anything changes:

find lib/* | entr gulp refresh

Where gulp refresh is just build and publish running in series:

exports.refresh = gulp.series([build, publish]);

Thoughts on the naming and whether we include this in the gulp file?

allmywant commented 4 years ago

@kingo55 I think gulp refresh is fine and we should include this in the gulp file, it's very useful when we need to debug the transformation code online.

kingo55 commented 3 years ago

Done - closing.