-
Notifications
You must be signed in to change notification settings - Fork 37
feat(cli): add skip-cleanup parameter #251
base: master
Are you sure you want to change the base?
feat(cli): add skip-cleanup parameter #251
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Your PR needs to be updated since I merged several PR on master. Plus I'm not convinced about migrating to async/await here. I feel it makes the codebase harder to read and lots of the code is synchronous so it doesn't make sense to me to wrap everything in a big async function.
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. |
bdd0491
to
37ff09a
Compare
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. |
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? |
Introduces
skip-cleanup
param to be able to skip the initial cleanup.The default value is false.
resolves #250