diff --git a/README.md b/README.md index d711f58c..dcd5e78a 100644 --- a/README.md +++ b/README.md @@ -164,14 +164,6 @@ Type: `String` Default: `process.cwd()` -##### `options.base` - -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. - -Type: `String` or `Function` - -Default: The `cwd` resolved to the folder path. - ##### `options.mode` The mode the files should be created with. @@ -254,14 +246,6 @@ Type: `String` Default: `process.cwd()` -##### `options.base` - -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. - -Type: `String` or `Function` - -Default: The `cwd` resolved to the folder path. - ##### `options.dirMode` The mode the directory should be created with. diff --git a/lib/prepare-write.js b/lib/prepare-write.js index eafacd4f..d1ffb09a 100644 --- a/lib/prepare-write.js +++ b/lib/prepare-write.js @@ -20,7 +20,6 @@ function prepareWrite(outFolder, file, opt, cb) { var defaultMode = file.stat ? file.stat.mode : null; var options = assign({}, opt, { cwd: defaultValue(process.cwd(), string(opt.cwd, file)), - base: string(opt.base, file), mode: defaultValue(defaultMode, number(opt.mode, file)), dirMode: number(opt.dirMode, file), overwrite: defaultValue(true, boolean(opt.overwrite, file)), @@ -32,7 +31,7 @@ function prepareWrite(outFolder, file, opt, cb) { if (!outFolderPath) { throw new Error('Invalid output folder'); } - var basePath = options.base || path.resolve(cwd, outFolderPath); + var basePath = path.resolve(cwd, outFolderPath); if (!basePath) { throw new Error('Invalid base option'); } diff --git a/test/dest.js b/test/dest.js index 427c50f0..ccb1619d 100644 --- a/test/dest.js +++ b/test/dest.js @@ -513,68 +513,6 @@ describe('dest stream', function() { stream.end(); }); - it('should change to the specified base as string', function(done) { - var inputBase = path.join(__dirname, './fixtures'); - var inputPath = path.join(__dirname, './fixtures/wow/suchempty'); - - var firstFile = new File({ - cwd: __dirname, - path: inputPath, - stat: fs.statSync(inputPath), - }); - - var buffered = []; - - var onEnd = function() { - buffered[0].base.should.equal(inputBase); - done(); - }; - - var stream = vfs.dest('./out-fixtures/', { - cwd: __dirname, - base: inputBase, - }); - - var bufferStream = through.obj(dataWrap(buffered.push.bind(buffered)), onEnd); - - stream.pipe(bufferStream); - stream.write(firstFile); - stream.end(); - }); - - it('should change to the specified base as function', function(done) { - var inputBase = path.join(__dirname, './fixtures'); - var inputPath = path.join(__dirname, './fixtures/wow/suchempty'); - - var firstFile = new File({ - cwd: __dirname, - path: inputPath, - stat: fs.statSync(inputPath), - }); - - var buffered = []; - - var onEnd = function() { - buffered[0].base.should.equal(inputBase); - done(); - }; - - var stream = vfs.dest('./out-fixtures/', { - cwd: __dirname, - base: function(file) { - should.exist(file); - file.path.should.equal(inputPath); - return inputBase; - }, - }); - - var bufferStream = through.obj(dataWrap(buffered.push.bind(buffered)), onEnd); - - stream.pipe(bufferStream); - stream.write(firstFile); - stream.end(); - }); - it('should report IO errors', function(done) { var inputPath = path.join(__dirname, './fixtures/test.coffee'); var inputBase = path.join(__dirname, './fixtures/'); diff --git a/test/symlink.js b/test/symlink.js index 02a9b37e..740bdd91 100644 --- a/test/symlink.js +++ b/test/symlink.js @@ -351,36 +351,6 @@ describe('symlink stream', function() { stream.end(); }); - it('should change to the specified base', function(done) { - var inputBase = path.join(__dirname, './fixtures'); - var inputPath = path.join(__dirname, './fixtures/wow/suchempty'); - - var firstFile = new File({ - base: inputBase, - cwd: __dirname, - path: inputPath, - stat: fs.statSync(inputPath), - }); - - var buffered = []; - - var onEnd = function() { - buffered[0].base.should.equal(inputBase); - done(); - }; - - var stream = vfs.symlink('./out-fixtures/', { - cwd: __dirname, - base: inputBase, - }); - - var bufferStream = through.obj(dataWrap(buffered.push.bind(buffered)), onEnd); - - stream.pipe(bufferStream); - stream.write(firstFile); - stream.end(); - }); - it('should report IO errors', function(done) { if (isWindows) { console.log('Changing the mode of a file is not supported by node.js in Windows.');