fix(core): update
This commit is contained in:
@@ -3,12 +3,12 @@ import * as plugins from './smartgulp.plugins.js';
|
||||
import { GulpStream } from './smartgulp.classes.gulpstream.js';
|
||||
import { Transform } from 'stream';
|
||||
|
||||
import { Smartfile } from '@pushrocks/smartfile';
|
||||
import { SmartFile } from '@push.rocks/smartfile';
|
||||
|
||||
export let src = (minimatchPathArrayArg: string[]): Transform => {
|
||||
let gulpStream = new GulpStream();
|
||||
let handleFiles = async () => {
|
||||
let smartfileArray: Smartfile[] = [];
|
||||
let smartfileArray: SmartFile[] = [];
|
||||
for (let minimatchPath of minimatchPathArrayArg) {
|
||||
let localSmartfileArray = await plugins.smartfile.fs.fileTreeToObject(
|
||||
process.cwd(),
|
||||
@@ -24,16 +24,25 @@ export let src = (minimatchPathArrayArg: string[]): Transform => {
|
||||
return gulpStream.stream;
|
||||
};
|
||||
|
||||
export let dest = (dirArg: string) => {};
|
||||
export let dest = (dirArg: string) => {
|
||||
const stream = new plugins.smartstream.SmartDuplex({
|
||||
objectMode: true,
|
||||
writeFunction: async (fileArg: SmartFile) => {
|
||||
const filePath = plugins.path.join(dirArg, fileArg.relative);
|
||||
const dirPath = plugins.path.dirname(filePath);
|
||||
await plugins.smartfile.fs.ensureDir(dirPath);
|
||||
await plugins.smartfile.memory.toFs(fileArg.contentBuffer, filePath);
|
||||
}
|
||||
});
|
||||
return stream;
|
||||
};
|
||||
|
||||
export let replace = () => {
|
||||
return plugins.through2.obj(
|
||||
async (file: Smartfile, enc, cb) => {
|
||||
await file.write();
|
||||
cb(null, file);
|
||||
},
|
||||
(cb) => {
|
||||
cb();
|
||||
const stream = new plugins.smartstream.SmartDuplex({
|
||||
objectMode: true,
|
||||
writeFunction: async (fileArg: SmartFile) => {
|
||||
await fileArg.write();
|
||||
}
|
||||
);
|
||||
});
|
||||
return stream;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user