Skip to content

Commit 20fc47c

Browse files
erikkempermanphated
authored andcommitted
Breaking: Rename option followSymlinks to resolveSymlinks (closes #205)
1 parent 8dfe08b commit 20fc47c

File tree

5 files changed

+16
-10
lines changed

5 files changed

+16
-10
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ Type: `Boolean`
112112

113113
Default: `false`
114114

115-
##### `options.followSymlinks`
115+
##### `options.resolveSymlinks`
116116

117117
Whether or not to recursively resolve symlinks to their targets. Setting to `false` to preserve them as symlinks and make `file.symlink` equal the original symlink's target path.
118118

lib/src/read-contents/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ function readContents(opt) {
1414
return readDir(file, opt, onRead);
1515
}
1616

17-
// Process symbolic links included with `followSymlinks` option
17+
// Process symbolic links included with `resolveSymlinks` option
1818
if (file.stat && file.stat.isSymbolicLink()) {
1919
return readSymbolicLink(file, opt, onRead);
2020
}

lib/src/wrap-with-vinyl-file.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,14 @@ var through2 = require('through2');
44
var fs = require('graceful-fs');
55
var File = require('vinyl');
66

7+
var koalas = require('koalas');
8+
var valueOrFunction = require('value-or-function');
9+
var boolean = valueOrFunction.boolean;
10+
711
function wrapWithVinylFile(options) {
812

13+
var resolveSymlinks = koalas(boolean(options.resolveSymlinks), true);
14+
915
// A stat property is exposed on file objects as a (wanted) side effect
1016
function resolveFile(globFile, enc, callback) {
1117
fs.lstat(globFile.path, onStat);
@@ -17,7 +23,7 @@ function wrapWithVinylFile(options) {
1723

1824
globFile.stat = stat;
1925

20-
if (!stat.isSymbolicLink() || !options.followSymlinks) {
26+
if (!stat.isSymbolicLink() || !resolveSymlinks) {
2127
var vinylFile = new File(globFile);
2228
if (globFile.originalSymlinkPath) {
2329
// If we reach here, it means there is at least one

test/dest.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -582,7 +582,7 @@ describe('.dest()', function() {
582582
contents: null,
583583
});
584584

585-
// `src()` adds this side-effect with `followSymlinks` option set to false
585+
// `src()` adds this side-effect with `resolveSymlinks` option set to false
586586
file.symlink = inputRelativeSymlinkPath;
587587

588588
function assert(files) {

test/src-symlinks.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ describe('.src() with symlinks', function() {
3939
done();
4040
});
4141

42-
it('follows symlinks correctly', function(done) {
42+
it('resolves symlinks correctly', function(done) {
4343
function assert(files) {
4444
expect(files.length).toEqual(1);
4545
// The path should be the symlink itself
@@ -57,7 +57,7 @@ describe('.src() with symlinks', function() {
5757
], done);
5858
});
5959

60-
it('follows directory symlinks correctly', function(done) {
60+
it('resolves directory symlinks correctly', function(done) {
6161
function assert(files) {
6262
expect(files.length).toEqual(1);
6363
// The path should be the symlink itself
@@ -75,7 +75,7 @@ describe('.src() with symlinks', function() {
7575
], done);
7676
});
7777

78-
it('preserves file symlinks with followSymlinks option set to false', function(done) {
78+
it('preserves file symlinks with resolveSymlinks option set to false', function(done) {
7979
var expectedRelativeSymlinkPath = fs.readlinkSync(symlinkPath);
8080

8181
function assert(files) {
@@ -85,12 +85,12 @@ describe('.src() with symlinks', function() {
8585
}
8686

8787
pipe([
88-
vfs.src(symlinkPath, { followSymlinks: false }),
88+
vfs.src(symlinkPath, { resolveSymlinks: false }),
8989
concat(assert),
9090
], done);
9191
});
9292

93-
it('preserves directory symlinks with followSymlinks option set to false', function(done) {
93+
it('preserves directory symlinks with resolveSymlinks option set to false', function(done) {
9494
var expectedRelativeSymlinkPath = fs.readlinkSync(symlinkDirpath);
9595

9696
function assert(files) {
@@ -100,7 +100,7 @@ describe('.src() with symlinks', function() {
100100
}
101101

102102
pipe([
103-
vfs.src(symlinkDirpath, { followSymlinks: false }),
103+
vfs.src(symlinkDirpath, { resolveSymlinks: false }),
104104
concat(assert),
105105
], done);
106106
});

0 commit comments

Comments
 (0)