Fix exported type definitions
This commit is contained in:
10
package.json
10
package.json
@ -9,12 +9,13 @@
|
|||||||
"test-watch": "mocha-webpack \"src/**/*.ts\" --watch",
|
"test-watch": "mocha-webpack \"src/**/*.ts\" --watch",
|
||||||
"prepublishOnly": "npm run build",
|
"prepublishOnly": "npm run build",
|
||||||
"lint": "tslint --project .",
|
"lint": "tslint --project .",
|
||||||
"build": "npm run webpack",
|
"build": "npm run webpack && npm run fix-types",
|
||||||
"tsc": "rimraf ./build && tsc -p .",
|
"tsc": "rimraf ./build && tsc -p .",
|
||||||
"webpack": "rimraf ./build && webpack",
|
"webpack": "rimraf ./build && webpack",
|
||||||
"demo": "npm run build && node ./demo",
|
"demo": "npm run build && node ./demo",
|
||||||
"typedoc": "npm run build && typedoc --out docs/ src/ --module commonjs --target ES6 --disableOutputCheck",
|
"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": [
|
"files": [
|
||||||
"src",
|
"src",
|
||||||
@ -42,8 +43,7 @@
|
|||||||
"@types/archiver": "^2.1.0",
|
"@types/archiver": "^2.1.0",
|
||||||
"@types/express": "^4.0.35",
|
"@types/express": "^4.0.35",
|
||||||
"@types/image-size": "0.0.29",
|
"@types/image-size": "0.0.29",
|
||||||
"@types/request": "^2.0.3",
|
"@types/request-promise": "^4.1.41",
|
||||||
"@types/request-promise": "^4.1.39",
|
|
||||||
"archiver": "^2.1.1",
|
"archiver": "^2.1.1",
|
||||||
"image-size": "^0.6.2",
|
"image-size": "^0.6.2",
|
||||||
"request": "^2.83.0",
|
"request": "^2.83.0",
|
||||||
@ -61,10 +61,12 @@
|
|||||||
"@types/mocha": "^2.2.39",
|
"@types/mocha": "^2.2.39",
|
||||||
"awesome-typescript-loader": "^3.4.1",
|
"awesome-typescript-loader": "^3.4.1",
|
||||||
"chai": "^3.5.0",
|
"chai": "^3.5.0",
|
||||||
|
"glob": "^7.1.2",
|
||||||
"mocha": "^3.2.0",
|
"mocha": "^3.2.0",
|
||||||
"mocha-webpack": "^1.0.1",
|
"mocha-webpack": "^1.0.1",
|
||||||
"prettier": "^1.10.2",
|
"prettier": "^1.10.2",
|
||||||
"prompt": "^1.0.0",
|
"prompt": "^1.0.0",
|
||||||
|
"replace-in-file": "^3.1.0",
|
||||||
"rimraf": "^2.5.2",
|
"rimraf": "^2.5.2",
|
||||||
"shelljs": "^0.7.7",
|
"shelljs": "^0.7.7",
|
||||||
"tslint": "^5.1.0",
|
"tslint": "^5.1.0",
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
import { BaseXmlComponent } from "file/xml-components";
|
import { BaseXmlComponent, IXmlableObject } from "file/xml-components";
|
||||||
import { IXmlableObject } from "file/xml-components/xmlable-object";
|
|
||||||
|
|
||||||
export class Formatter {
|
export class Formatter {
|
||||||
public format(input: BaseXmlComponent): IXmlableObject {
|
public format(input: BaseXmlComponent): IXmlableObject {
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
import { XmlComponent } from "file/xml-components";
|
import { IXmlableObject, XmlComponent } from "file/xml-components";
|
||||||
import { IXmlableObject } from "file/xml-components/xmlable-object";
|
|
||||||
import { Paragraph } from "../paragraph";
|
import { Paragraph } from "../paragraph";
|
||||||
import { TableGrid } from "./grid";
|
import { TableGrid } from "./grid";
|
||||||
import { TableProperties, WidthTypes } from "./properties";
|
import { TableProperties, WidthTypes } from "./properties";
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
export * from "./xml-component";
|
export * from "./xml-component";
|
||||||
export * from "./attributes";
|
export * from "./attributes";
|
||||||
export * from "./default-attributes";
|
export * from "./default-attributes";
|
||||||
|
export * from "./xmlable-object";
|
||||||
|
@ -1,3 +1,6 @@
|
|||||||
export interface IXmlableObject extends Object {
|
export interface IXmlableObject extends Object {
|
||||||
_attr?: { [key: string]: string | number | boolean };
|
_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
20
types-absolute-fixer.js
Normal 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}"`;
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
Reference in New Issue
Block a user