-
Notifications
You must be signed in to change notification settings - Fork 93
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support mkdirp to create dest path if it doesn't exists #16
Conversation
fs.statSync(name); | ||
} catch (e) { | ||
mkdirp.sync(path.dirname(name)); | ||
} |
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.
You can do better
mkdirp(path.dirname(name), function (err) {
if (err) {
fn(err);
} else {
fs.writeFile(name, content, fn);
}
});
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.
I mean even without precheck with fs.stat
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.
Seems nice! Let me update it to the above you wrote.
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.
Thanks for your comment! Updated codes like you said @TrySound
Can you provide test case? |
Isn't this test I added enough to cover this patch? Makefile#L95-L97 |
Oh, okay. Didn't understand it's test. |
Yeah actually we can rewrite tests to js from |
Fixes #15