-
-
Notifications
You must be signed in to change notification settings - Fork 20
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
fix: compatible with Node.js 14 #60
Conversation
@@ -190,7 +193,7 @@ async function _copyDir(src, dest, options, parent) { | |||
return _copyDir(childSrc, childDest, options, currentPath); | |||
} | |||
|
|||
return copyFile(childSrc, childDest, options).thenReturn(currentPath); | |||
return copyFile(childSrc, childDest).thenReturn(currentPath); |
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.
The options
here is for copyDir
({ ignoreHidden, ignorePattern }
) which is not related with copyFile
, so I just simply remove it.
@@ -127,6 +129,7 @@ function copyFile(src, dest, flags, callback) { | |||
if (!dest) throw new TypeError('dest is required!'); | |||
if (typeof flags === 'function') { | |||
callback = flags; | |||
flags = undefined; |
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.
Node.js 14 implemented a type check (nodejs/node@a13500f) so flags
won't accept function any more.
@@ -89,6 +89,8 @@ function checkParentSync(path) { | |||
function writeFile(path, data, options, callback) { | |||
if (!path) throw new TypeError('path is required!'); | |||
|
|||
if (!data) data = ''; |
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.
In the test cases we use writeFile(path)
to create an empty file (leave data
as an undefined value) will no longer be accepted by Node.js 14.
@curbengh Done. |
This PR makes some fixes to make
hexo-fs
compatible with Node.js 14.Related issue: hexojs/hexo#4260 hexojs/hexo#4263