smartgulp/ts/smartgulp.gulpapi.ts

36 lines
1.0 KiB
TypeScript
Raw Normal View History

2017-04-29 22:25:31 +00:00
// this file contains the implementation of the standard gulp api
import * as plugins from './smartgulp.plugins'
import { GulpStream } from './smartgulp.classes.gulpstream'
import { Transform } from 'stream'
import { Smartfile } from 'smartfile'
export let src = (minimatchPathArrayArg: string[]): Transform => {
let gulpStream = new GulpStream()
let handleFiles = async () => {
let smartfileArray: Smartfile[] = []
for (let minimatchPath of minimatchPathArrayArg) {
let localSmartfileArray = await plugins.smartfile.fs.fileTreeToObject(process.cwd(), minimatchPath)
smartfileArray = plugins.lodash.concat(smartfileArray, localSmartfileArray)
}
gulpStream.pipeSmartfileArray(smartfileArray)
}
handleFiles().catch(err => {
console.log(err)
})
return gulpStream.stream
}
2018-02-15 23:46:55 +00:00
export let dest = (dirArg: string) => {
2017-04-29 22:25:31 +00:00
}
2018-02-15 23:46:55 +00:00
export let replace = () => {
return plugins.through2.obj(async (file: Smartfile, enc, cb) => {
await file.write()
cb(file)
}, (cb) => {
cb()
})
}