fix(core): update
This commit is contained in:
@ -2,7 +2,7 @@
|
||||
* autocreated commitinfo by @pushrocks/commitinfo
|
||||
*/
|
||||
export const commitinfo = {
|
||||
name: '@pushrocks/smartgulp',
|
||||
version: '3.0.0',
|
||||
name: '@push.rocks/smartgulp',
|
||||
version: '3.0.1',
|
||||
description: 'lightweight gulp replacement'
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
// this file contains the code to generate and handle the stream
|
||||
|
||||
import * as plugins from './smartgulp.plugins.js';
|
||||
import { Smartfile } from '@pushrocks/smartfile';
|
||||
import { SmartFile } from '@push.rocks/smartfile';
|
||||
|
||||
import { Transform } from 'stream';
|
||||
|
||||
@ -11,7 +11,7 @@ export class GulpStream {
|
||||
/**
|
||||
* allows you to pipe a SmartfileArray into the stream
|
||||
*/
|
||||
async pipeSmartfileArray(smartfileArray: Smartfile[]) {
|
||||
async pipeSmartfileArray(smartfileArray: SmartFile[]) {
|
||||
// ensure what we get is an array
|
||||
if (!Array.isArray(smartfileArray)) {
|
||||
throw new Error('fileArg has unknown format');
|
||||
@ -20,8 +20,6 @@ export class GulpStream {
|
||||
let hasWritten = this.stream.push(smartfile);
|
||||
if (!hasWritten) {
|
||||
await plugins.smartevent.once(this.stream, 'drain');
|
||||
} else {
|
||||
// iterate
|
||||
}
|
||||
}
|
||||
// signal end of stream;
|
||||
|
@ -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;
|
||||
};
|
||||
|
@ -1,6 +1,14 @@
|
||||
import * as smartevent from '@pushrocks/smartevent';
|
||||
import * as smartfile from '@pushrocks/smartfile';
|
||||
import * as smartstream from '@pushrocks/smartstream';
|
||||
// node native scope
|
||||
import * as path from 'path';
|
||||
|
||||
export {
|
||||
path
|
||||
};
|
||||
|
||||
// @push.rocks scope
|
||||
import * as smartevent from '@push.rocks/smartevent';
|
||||
import * as smartfile from '@push.rocks/smartfile';
|
||||
import * as smartstream from '@push.rocks/smartstream';
|
||||
import * as through2 from 'through2';
|
||||
|
||||
export { smartevent, smartfile, smartstream, through2 };
|
||||
|
Reference in New Issue
Block a user