Add back types absolute fixer

This commit is contained in:
Dolan Miu
2021-09-28 19:56:29 +01:00
parent 1f078e0687
commit 536204e5ef
4 changed files with 7 additions and 9 deletions

View File

@ -10,7 +10,7 @@
"test.watch": "npm test -- --watch", "test.watch": "npm test -- --watch",
"prepublishOnly": "npm run build --production", "prepublishOnly": "npm run build --production",
"lint": "tslint --project .", "lint": "tslint --project .",
"build": "npm run webpack", "build": "npm run webpack && npm run fix-types",
"webpack": "rimraf ./build && webpack --config ./webpack.config.ts", "webpack": "rimraf ./build && webpack --config ./webpack.config.ts",
"demo": "npm run build && npm run ts-node --skip-project ./demo", "demo": "npm run build && npm run ts-node --skip-project ./demo",
"typedoc": "rimraf ./build && typedoc src/index.ts --tsconfig tsconfig.typedoc.json", "typedoc": "rimraf ./build && typedoc src/index.ts --tsconfig tsconfig.typedoc.json",

View File

@ -1,18 +1,16 @@
import * as glob from "glob"; import * as glob from "glob";
import * as replace from "replace-in-file"; import { replaceInFile } from "replace-in-file";
const files = glob.sync("build/**/*.d.ts"); const files = glob.sync("build/**/*.d.ts");
for (const file of files) { for (const file of files) {
replace({ replaceInFile({
files: file, files: file,
from: /"file[a-z/-]*"/gi, from: /"file[a-z/-]*"/gi,
to: (match) => { to: (match) => {
const matchSlug = match.replace(/['"]+/g, "").trim(); const matchSlug = match.replace(/['"]+/g, "").trim();
const levelCount = file.split("/").length - 2; const levelCount = file.split("/").length - 2;
const backLevels = Array(levelCount) const backLevels = Array(levelCount).fill("../").join("");
.fill("../")
.join("");
return `"${backLevels}${matchSlug}"`; return `"${backLevels}${matchSlug}"`;
}, },

View File

@ -1,7 +1,7 @@
// http://officeopenxml.com/WPparagraph-textFrames.php // http://officeopenxml.com/WPparagraph-textFrames.php
import { HeightRule } from "file";
import { HorizontalPositionAlign, VerticalPositionAlign } from "file/shared/alignment"; import { HorizontalPositionAlign, VerticalPositionAlign } from "file/shared/alignment";
import { XmlAttributeComponent, XmlComponent } from "file/xml-components"; import { XmlAttributeComponent, XmlComponent } from "file/xml-components";
import { HeightRule } from "/file";
export enum DropCapType { export enum DropCapType {
NONE = "none", NONE = "none",

View File

@ -13,9 +13,9 @@
"noUnusedParameters": true, "noUnusedParameters": true,
"baseUrl": "./src", "baseUrl": "./src",
"paths": { "paths": {
"/*": ["./*"],
"convenience-functions": ["./convenience-functions"], "convenience-functions": ["./convenience-functions"],
"@export/*": ["./export/*"] "@export/*": ["./export/*"],
"file/*": ["./file/*"]
} }
}, },
"include": ["src"] "include": ["src"]