From cb4431c1a088311a722d6c4b0a6bf3ce9c715b5e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thibault=20=E2=80=9CAd=C3=A6dra=E2=80=9D=20Hamel?= Date: Thu, 27 Jun 2024 20:32:51 +0200 Subject: [PATCH] Make the complete file complete --- articles/gulp-to-rxjs/gulp-to-rxjs.asciidoc | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/articles/gulp-to-rxjs/gulp-to-rxjs.asciidoc b/articles/gulp-to-rxjs/gulp-to-rxjs.asciidoc index 27b84c4..15b9c61 100644 --- a/articles/gulp-to-rxjs/gulp-to-rxjs.asciidoc +++ b/articles/gulp-to-rxjs/gulp-to-rxjs.asciidoc @@ -146,9 +146,17 @@ You can then use `+mergeMap+` to inject this function into our pipeline. Here is [source,ts] ---- import { VFile } from "https://esm.sh/vfile@^6.0.1"; +import { Glob } from "https://esm.sh/glob@^10.4.2"; import { read } from "https://esm.sh/to-vfile@^8.0.0"; +import { from, mergeMap, tap } from "https://esm.sh/rxjs@^7.8.1"; import { dirname, relative, resolve } from "jsr:@std/path@^0.225.2"; +const src = (globs: string | string[]) => + from(new Glob(globs, {})).pipe( + mergeMap((file) => read(resolve(file))), + tap((file) => file.cwd = Deno.cwd()), + ); + const dest = (prefix: string) => async (file: VFile) => { const relativePath = relative(file.cwd, file.path); const finalPath = resolve(prefix, relativePath);