1 | const src = require('vinyl-fs/lib/src');
|
2 | const symlink = require('vinyl-fs/lib/symlink');
|
3 | const through2 = require('through2');
|
4 | const { basename, resolve } = require('path');
|
5 |
|
6 | function dest(target, { cwd = process.cwd() } = {}) {
|
7 | return through2.obj(function through2Obj(file, encoding, cb) {
|
8 | try {
|
9 | file.path = resolve(cwd, target, basename(file.path));
|
10 | this.push(file);
|
11 | } catch (err) {
|
12 | this.emit('error', new Error(err));
|
13 | }
|
14 | cb();
|
15 | });
|
16 | }
|
17 | module.exports = {
|
18 | src,
|
19 | dest,
|
20 | symlink
|
21 | };
|