Skip to content

Commit 7abaf4d

Browse files
committed
Breaking: Remove base option from dest/symlink options, use functions for folder instead (closes #141)
1 parent 12f92f8 commit 7abaf4d

File tree

4 files changed

+1
-110
lines changed

4 files changed

+1
-110
lines changed

README.md

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -164,14 +164,6 @@ Type: `String`
164164

165165
Default: `process.cwd()`
166166

167-
##### `options.base`
168-
169-
The folder relative to the cwd. This is used to determine the file names when saving in `.dest()`. Can also be a function that takes in a file and returns a folder path.
170-
171-
Type: `String` or `Function`
172-
173-
Default: The `cwd` resolved to the folder path.
174-
175167
##### `options.mode`
176168

177169
The mode the files should be created with.
@@ -254,14 +246,6 @@ Type: `String`
254246

255247
Default: `process.cwd()`
256248

257-
##### `options.base`
258-
259-
The folder relative to the cwd. This is used to determine the file names when saving in `.symlink()`. Can also be a function that takes in a file and returns a folder path.
260-
261-
Type: `String` or `Function`
262-
263-
Default: The `cwd` resolved to the folder path.
264-
265249
##### `options.dirMode`
266250

267251
The mode the directory should be created with.

lib/prepare-write.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ function prepareWrite(outFolder, file, opt, cb) {
2020
var defaultMode = file.stat ? file.stat.mode : null;
2121
var options = assign({}, opt, {
2222
cwd: defaultValue(process.cwd(), string(opt.cwd, file)),
23-
base: string(opt.base, file),
2423
mode: defaultValue(defaultMode, number(opt.mode, file)),
2524
dirMode: number(opt.dirMode, file),
2625
overwrite: defaultValue(true, boolean(opt.overwrite, file)),
@@ -32,7 +31,7 @@ function prepareWrite(outFolder, file, opt, cb) {
3231
if (!outFolderPath) {
3332
throw new Error('Invalid output folder');
3433
}
35-
var basePath = options.base || path.resolve(cwd, outFolderPath);
34+
var basePath = path.resolve(cwd, outFolderPath);
3635
if (!basePath) {
3736
throw new Error('Invalid base option');
3837
}

test/dest.js

Lines changed: 0 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -513,68 +513,6 @@ describe('dest stream', function() {
513513
stream.end();
514514
});
515515

516-
it('should change to the specified base as string', function(done) {
517-
var inputBase = path.join(__dirname, './fixtures');
518-
var inputPath = path.join(__dirname, './fixtures/wow/suchempty');
519-
520-
var firstFile = new File({
521-
cwd: __dirname,
522-
path: inputPath,
523-
stat: fs.statSync(inputPath),
524-
});
525-
526-
var buffered = [];
527-
528-
var onEnd = function() {
529-
buffered[0].base.should.equal(inputBase);
530-
done();
531-
};
532-
533-
var stream = vfs.dest('./out-fixtures/', {
534-
cwd: __dirname,
535-
base: inputBase,
536-
});
537-
538-
var bufferStream = through.obj(dataWrap(buffered.push.bind(buffered)), onEnd);
539-
540-
stream.pipe(bufferStream);
541-
stream.write(firstFile);
542-
stream.end();
543-
});
544-
545-
it('should change to the specified base as function', function(done) {
546-
var inputBase = path.join(__dirname, './fixtures');
547-
var inputPath = path.join(__dirname, './fixtures/wow/suchempty');
548-
549-
var firstFile = new File({
550-
cwd: __dirname,
551-
path: inputPath,
552-
stat: fs.statSync(inputPath),
553-
});
554-
555-
var buffered = [];
556-
557-
var onEnd = function() {
558-
buffered[0].base.should.equal(inputBase);
559-
done();
560-
};
561-
562-
var stream = vfs.dest('./out-fixtures/', {
563-
cwd: __dirname,
564-
base: function(file) {
565-
should.exist(file);
566-
file.path.should.equal(inputPath);
567-
return inputBase;
568-
},
569-
});
570-
571-
var bufferStream = through.obj(dataWrap(buffered.push.bind(buffered)), onEnd);
572-
573-
stream.pipe(bufferStream);
574-
stream.write(firstFile);
575-
stream.end();
576-
});
577-
578516
it('should report IO errors', function(done) {
579517
var inputPath = path.join(__dirname, './fixtures/test.coffee');
580518
var inputBase = path.join(__dirname, './fixtures/');

test/symlink.js

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -351,36 +351,6 @@ describe('symlink stream', function() {
351351
stream.end();
352352
});
353353

354-
it('should change to the specified base', function(done) {
355-
var inputBase = path.join(__dirname, './fixtures');
356-
var inputPath = path.join(__dirname, './fixtures/wow/suchempty');
357-
358-
var firstFile = new File({
359-
base: inputBase,
360-
cwd: __dirname,
361-
path: inputPath,
362-
stat: fs.statSync(inputPath),
363-
});
364-
365-
var buffered = [];
366-
367-
var onEnd = function() {
368-
buffered[0].base.should.equal(inputBase);
369-
done();
370-
};
371-
372-
var stream = vfs.symlink('./out-fixtures/', {
373-
cwd: __dirname,
374-
base: inputBase,
375-
});
376-
377-
var bufferStream = through.obj(dataWrap(buffered.push.bind(buffered)), onEnd);
378-
379-
stream.pipe(bufferStream);
380-
stream.write(firstFile);
381-
stream.end();
382-
});
383-
384354
it('should report IO errors', function(done) {
385355
if (isWindows) {
386356
console.log('Changing the mode of a file is not supported by node.js in Windows.');

0 commit comments

Comments
 (0)