fix(core): update

This commit is contained in:
2023-11-25 18:11:31 +01:00
parent a2dd2ab6f0
commit e00eaca362
10 changed files with 2573 additions and 12729 deletions

View File

@@ -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;
};