Something went wrong. Try again.
[READ-ONLY] Mirror of https://github.com/okikio/native. An initiative which aims to make it easy to create complex, light-weight, and perfor okikio.github.io/native
Something went wrong. Try again.
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172import _gulp from "gulp";
export const { src, dest, parallel, task, series, watch } = _gulp;export const gulp = _gulp;
// Streamline Gulp Tasksexport const stream = (_src, _opt = {}) => { return new Promise((resolve) => { let _end = _opt.end; let host = typeof _src !== "string" && !Array.isArray(_src) ? _src : src(_src, _opt.opts), _pipes = _opt.pipes || [], _dest = _opt.dest === undefined ? "." : _opt.dest, _log = _opt.log || (() => { });
_pipes.forEach((val) => { if (val !== undefined && val !== null) { host = host.pipe(val); } });
if (_dest !== null) host = host.pipe(dest(_dest)); host.on("data", _log); host = host.on("end", (...args) => { if (typeof _end === "function") _end(...args); resolve(host); }); // Output
if (Array.isArray(_end)) { _end.forEach((val) => { if (val !== undefined && val !== null) { host = host.pipe(val); } }); }
return host; });};
// A list of streamsexport const streamList = (...args) => { return Promise.all( (Array.isArray(args[0]) ? args[0] : args).map((_stream) => { return Array.isArray(_stream) ? stream(..._stream) : _stream; }) );};
// A list of gulp tasksexport const tasks = (list) => { let entries = Object.entries(list); for (let [name, fn] of entries) { task(name, (...args) => fn(...args)); }};
export const parallelFn = (...args) => { let tasks = args.filter((x) => x !== undefined && x !== null); return function parallelrun(done) { return parallel(...tasks)(done); };};
export const seriesFn = (...args) => { let tasks = args.filter((x) => x !== undefined && x !== null); return function seriesrun(done) { return series(...tasks)(done); };};