Skip to content
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

Merged
merged 6 commits into from
Jan 11, 2018
Merged

followSymlinks option #124

merged 6 commits into from
Jan 11, 2018

Conversation

blond
Copy link
Collaborator

@blond blond commented Jan 11, 2018

  • Major change: now symlinks will not be changed into files or directories.
  • Added followSymlinks: follow symlinked files and directories. If symlink is broken, tartifacts falls with error.

@blond blond force-pushed the issue-123 branch 3 times, most recently from 1471486 to 2812e44 Compare January 11, 2018 11:24

copySymlink(file.path, dest, { fs })
.then(() => callback())
.catch(callback);
Copy link
Contributor

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?

Copy link
Collaborator Author

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))

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👌

Copy link
Contributor

@emelyanovtv emelyanovtv left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

const nativeFs = require('fs');
const path = require('path');

const promisify = require('es6-promisify');
Copy link

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 utilhttps://github.com/sindresorhus/pify/blob/master/optimization-test.js.

const destDir = path.dirname(destPath);

const fs = opts.fs || nativeFs;
const readlink = promisify(fs.readlink);
Copy link

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
Copy link

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

@blond blond merged commit c96c7a1 into master Jan 11, 2018
@blond blond deleted the issue-123 branch January 11, 2018 12:28
@blond blond mentioned this pull request Jan 11, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants