Fix exported type definitions

This commit is contained in:
Dolan
2018-02-02 01:56:08 +00:00
parent 680f2325a3
commit ee958dc351
6 changed files with 32 additions and 8 deletions

20
types-absolute-fixer.js Normal file
View File

@ -0,0 +1,20 @@
const glob = require("glob");
const replace = require("replace-in-file");
const files = glob.sync("build/**/*.d.ts");
for (const file of files) {
replace({
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}"`;
},
});
}