cra-build-watch icon indicating copy to clipboard operation
cra-build-watch copied to clipboard

feat(cli): add skip-cleanup parameter

Open umutcanbolat opened this issue 5 years ago • 7 comments
trafficstars

Introduces skip-cleanup param to be able to skip the initial cleanup. The default value is false. resolves #250

umutcanbolat avatar Oct 25 '20 02:10 umutcanbolat

I recommend hiding the whitespace changes while reviewing. Otherwise, the change of indentation makes it look like the whole file is edited. image

umutcanbolat avatar Oct 25 '20 02:10 umutcanbolat

It seems that my other comment on the code didn't go through. I had a question: what were the reasons behind the rewrite to async/await?

That's something I'd be happy to discuss but rather on its own PR and not mixed up with the feature you initially suggested.

Nargonath avatar Nov 01 '20 20:11 Nargonath

Hi,

I think using async-await here makes it more readable. But we can consider this in another PR as you suggested.

So, with Promise chaining, it would look like this:

Promise.resolve()
  .then(() => skipCleanup || fs.emptyDir(paths.appBuild))
  .then(() => {
    return new Promise((resolve, reject) => {
        // webpack related code here
        return resolve();
    });
  })
  .then(() => copyPublicFolder())
  .then(() => runHook('after initial build hook', spinner, afterInitialBuildHook));

With async-await, could be like this:

skipCleanup || (await fs.emptyDir(paths.appBuild));

await new Promise((resolve, reject) => {
    // webpack related code here
    return resolve();
});

await copyPublicFolder();

runHook('after initial build hook', spinner, afterInitialBuildHook)

umutcanbolat avatar Nov 01 '20 22:11 umutcanbolat

I didn't have time this weekend, but I will resolve conflicts and do the changes during the next week. Best!

umutcanbolat avatar Nov 01 '20 22:11 umutcanbolat

Hi again. Rebased into master and converted the async-await logic back to the promise chaining as you asked to discuss this in a separate PR. Have a nice week!

umutcanbolat avatar Nov 02 '20 22:11 umutcanbolat

Hi @umutcanbolat! Thanks for updating your PR, I should be able to have a look at it during the week. No worries about the previous week-end. There is no rush. 😉

Nargonath avatar Nov 03 '20 09:11 Nargonath

Hi! Any update on this?

umutcanbolat avatar Nov 16 '20 16:11 umutcanbolat