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

View File

@ -9,12 +9,13 @@
"test-watch": "mocha-webpack \"src/**/*.ts\" --watch",
"prepublishOnly": "npm run build",
"lint": "tslint --project .",
"build": "npm run webpack",
"build": "npm run webpack && npm run fix-types",
"tsc": "rimraf ./build && tsc -p .",
"webpack": "rimraf ./build && webpack",
"demo": "npm run build && node ./demo",
"typedoc": "npm run build && typedoc --out docs/ src/ --module commonjs --target ES6 --disableOutputCheck",
"style": "prettier -l --trailing-comma all --print-width 140 --arrow-parens always \"src/**/*.ts\""
"style": "prettier -l --trailing-comma all --print-width 140 --arrow-parens always \"src/**/*.ts\"",
"fix-types": "node types-absolute-fixer.js"
},
"files": [
"src",
@ -42,8 +43,7 @@
"@types/archiver": "^2.1.0",
"@types/express": "^4.0.35",
"@types/image-size": "0.0.29",
"@types/request": "^2.0.3",
"@types/request-promise": "^4.1.39",
"@types/request-promise": "^4.1.41",
"archiver": "^2.1.1",
"image-size": "^0.6.2",
"request": "^2.83.0",
@ -61,10 +61,12 @@
"@types/mocha": "^2.2.39",
"awesome-typescript-loader": "^3.4.1",
"chai": "^3.5.0",
"glob": "^7.1.2",
"mocha": "^3.2.0",
"mocha-webpack": "^1.0.1",
"prettier": "^1.10.2",
"prompt": "^1.0.0",
"replace-in-file": "^3.1.0",
"rimraf": "^2.5.2",
"shelljs": "^0.7.7",
"tslint": "^5.1.0",

View File

@ -1,5 +1,4 @@
import { BaseXmlComponent } from "file/xml-components";
import { IXmlableObject } from "file/xml-components/xmlable-object";
import { BaseXmlComponent, IXmlableObject } from "file/xml-components";
export class Formatter {
public format(input: BaseXmlComponent): IXmlableObject {

View File

@ -1,5 +1,4 @@
import { XmlComponent } from "file/xml-components";
import { IXmlableObject } from "file/xml-components/xmlable-object";
import { IXmlableObject, XmlComponent } from "file/xml-components";
import { Paragraph } from "../paragraph";
import { TableGrid } from "./grid";
import { TableProperties, WidthTypes } from "./properties";

View File

@ -1,3 +1,4 @@
export * from "./xml-component";
export * from "./attributes";
export * from "./default-attributes";
export * from "./xmlable-object";

View File

@ -1,3 +1,6 @@
export interface IXmlableObject extends Object {
_attr?: { [key: string]: string | number | boolean };
}
// Needed because of: https://github.com/s-panferov/awesome-typescript-loader/issues/432
export const WORKAROUND3 = "workaround";

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}"`;
},
});
}