Skip to main content
Module

x/docx/scripts/types-absolute-fixer.ts

Easily generate .docx files with JS/TS with a nice declarative API. Works for Node and on the Browser.
Go to Latest
File
import * as glob from "glob";import { replaceInFile } from "replace-in-file";
const files = glob.sync("build/**/*.d.ts");
for (const file of files) { replaceInFile({ files: file, from: /"file[a-z/-]*"/gi, to: (match) => { const matchSlug = match.replace(/['"]+/g, "").trim(); const levelCount = file.split("/").length - 2; const backLevels = Array(levelCount).fill("../").join("");
return `"${backLevels}${matchSlug}"`; }, });}