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

Add relative symlink support #187

Merged
merged 6 commits into from
Jul 6, 2016
Merged

Add relative symlink support #187

merged 6 commits into from
Jul 6, 2016

Conversation

perrin4869
Copy link
Contributor

Adds support for creating symlinks which point to a file relatively

function linkFile(file, enc, cb) {
var srcPath = file.path;
var symType = (file.isDirectory() ? 'dir' : 'file');
prepareWrite(outFolder, file, opt, function(err) {
if (err) {
return cb(err);
}

if (rel) {
var dstDir = (fs.existsSync(file.path) && symType === 'dir')
Copy link
Member

Choose a reason for hiding this comment

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

Probably shouldn't use existsSync here. It is deprecated, a sync method and I think we just assume the files exist with everything else.

@phated
Copy link
Member

phated commented Jul 5, 2016

@perrin4869 awesome work. I just had a few comments/suggestions

opt = {};
}

var rel = defaultValue(false, boolean(opt.relative));
Copy link
Member

Choose a reason for hiding this comment

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

this should be inside the linkFile function and boolean should be passed file as the 2nd argument.

@perrin4869
Copy link
Contributor Author

pushed some improvements to the implementation!
There is a bit of code duplication with prepareWrite. The code that calculates the output directory I took mostly from there. Might be worth to look into factoring it out into helper functions.

@phated phated merged commit b76accc into gulpjs:master Jul 6, 2016
@mfeltscher
Copy link

This is a very useful feature - love it! Are there any plans to release a new version of vinyl-fs including this feature?

@phated
Copy link
Member

phated commented Aug 8, 2016

It will land in 3.0 due to other breaking changes.

@mfeltscher
Copy link

Sounds good. Is there an ETA for 3.0?

@phated
Copy link
Member

phated commented Aug 8, 2016

As soon as the outstanding issues are resolved. We all do this in our free time. Feel free to submit a PR if you can.

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.

3 participants