@ -13,7 +13,8 @@
|
|||||||
},
|
},
|
||||||
"files": [
|
"files": [
|
||||||
"ts",
|
"ts",
|
||||||
"build"
|
"build",
|
||||||
|
"template"
|
||||||
],
|
],
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
@ -28,10 +29,8 @@
|
|||||||
"clippy"
|
"clippy"
|
||||||
],
|
],
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@types/app-root-path": "^1.2.4",
|
|
||||||
"@types/archiver": "^0.15.37",
|
"@types/archiver": "^0.15.37",
|
||||||
"@types/express": "^4.0.35",
|
"@types/express": "^4.0.35",
|
||||||
"app-root-path": "^2.0.1",
|
|
||||||
"archiver": "^1.3.0",
|
"archiver": "^1.3.0",
|
||||||
"xml": "^1.0.1"
|
"xml": "^1.0.1"
|
||||||
},
|
},
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import * as appRoot from "app-root-path";
|
|
||||||
import * as archiver from "archiver";
|
import * as archiver from "archiver";
|
||||||
|
import * as path from "path";
|
||||||
import * as xml from "xml";
|
import * as xml from "xml";
|
||||||
import { Document } from "../../docx";
|
import { Document } from "../../docx";
|
||||||
import { Numbering } from "../../numbering";
|
import { Numbering } from "../../numbering";
|
||||||
@ -8,6 +8,8 @@ import { Styles } from "../../styles";
|
|||||||
import { DefaultStylesFactory } from "../../styles/factory";
|
import { DefaultStylesFactory } from "../../styles/factory";
|
||||||
import { Formatter } from "../formatter";
|
import { Formatter } from "../formatter";
|
||||||
|
|
||||||
|
const templatePath = path.resolve(__dirname, "../../../template");
|
||||||
|
|
||||||
export abstract class Packer {
|
export abstract class Packer {
|
||||||
protected archive: any;
|
protected archive: any;
|
||||||
protected document: Document;
|
protected document: Document;
|
||||||
@ -53,12 +55,12 @@ export abstract class Packer {
|
|||||||
this.archive.pipe(output);
|
this.archive.pipe(output);
|
||||||
this.archive.glob("**", {
|
this.archive.glob("**", {
|
||||||
expand: true,
|
expand: true,
|
||||||
cwd: appRoot.path + "/template",
|
cwd: templatePath,
|
||||||
});
|
});
|
||||||
|
|
||||||
this.archive.glob("**/.rels", {
|
this.archive.glob("**/.rels", {
|
||||||
expand: true,
|
expand: true,
|
||||||
cwd: appRoot.path + "/template",
|
cwd: templatePath,
|
||||||
});
|
});
|
||||||
|
|
||||||
const xmlDocument = xml(this.formatter.format(this.document));
|
const xmlDocument = xml(this.formatter.format(this.document));
|
||||||
|
Reference in New Issue
Block a user