fix path to template when installed via npm

I'm not sure why, buy app-root-path was not picking up the correct
path for this module when installed via NPM. Since we're already using
relative paths for imports, I don't think we gain much from using it
anyway, so I've changed to using path.resolve instead
This commit is contained in:
felipe
2017-03-13 20:35:42 +01:00
parent 0c128ae4a5
commit c7b7b585be
2 changed files with 5 additions and 5 deletions

View File

@ -1,5 +1,5 @@
import * as appRoot from "app-root-path";
import * as archiver from "archiver";
import * as path from "path";
import * as xml from "xml";
import { Document } from "../../docx";
import { Numbering } from "../../numbering";
@ -8,6 +8,8 @@ import { Styles } from "../../styles";
import { DefaultStylesFactory } from "../../styles/factory";
import { Formatter } from "../formatter";
const templatePath = path.resolve(__dirname, "../../../template");
export abstract class Packer {
protected archive: any;
protected document: Document;
@ -53,12 +55,12 @@ export abstract class Packer {
this.archive.pipe(output);
this.archive.glob("**", {
expand: true,
cwd: appRoot.path + "/template",
cwd: templatePath,
});
this.archive.glob("**/.rels", {
expand: true,
cwd: appRoot.path + "/template",
cwd: templatePath,
});
const xmlDocument = xml(this.formatter.format(this.document));