Make the complete file complete

This commit is contained in:
Thibault “Adædra” Hamel 2024-06-27 20:32:51 +02:00
parent 66c4e1ce4b
commit cb4431c1a0

View File

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