cra-build-watch
cra-build-watch copied to clipboard
feat(cli): add skip-cleanup parameter
Introduces skip-cleanup param to be able to skip the initial cleanup.
The default value is false.
resolves #250
I recommend hiding the whitespace changes while reviewing. Otherwise, the change of indentation makes it look like the whole file is edited.

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.
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)
I didn't have time this weekend, but I will resolve conflicts and do the changes during the next week. Best!
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!
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. 😉
Hi! Any update on this?