-
Notifications
You must be signed in to change notification settings - Fork 9
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
followSymlinks option #124
Conversation
1471486
to
2812e44
Compare
|
||
copySymlink(file.path, dest, { fs }) | ||
.then(() => callback()) | ||
.catch(callback); |
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.
Why not () => callback()
as a line above?
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.
because .catch(err => callback(err))
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.
👌
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.
LGTM
lib/fs/copy-symlink.js
Outdated
const nativeFs = require('fs'); | ||
const path = require('path'); | ||
|
||
const promisify = require('es6-promisify'); |
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.
Why not pify? The pify has optimizations for v8 like native promisify
from util
– https://github.com/sindresorhus/pify/blob/master/optimization-test.js.
lib/fs/copy-symlink.js
Outdated
const destDir = path.dirname(destPath); | ||
|
||
const fs = opts.fs || nativeFs; | ||
const readlink = promisify(fs.readlink); |
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.
May be we can move it to top of this module? Now the promisify
function will be called for each call of fs/copy-symlink
. This is less than ms but it's free ms.
* @abstract | ||
*/ | ||
// eslint-disable-next-line class-methods-use-this | ||
addSymbolicLink(file, callback) { // eslint-disable-line no-unused-vars |
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.
Haha! TypeScript is better here :D
followSymlinks
: follow symlinked files and directories. If symlink is broken, tartifacts falls with error.