diff --git a/ts/export/packer/packer.ts b/ts/export/packer/packer.ts index 17b9453332..44f7954019 100644 --- a/ts/export/packer/packer.ts +++ b/ts/export/packer/packer.ts @@ -28,22 +28,29 @@ export abstract class Packer { pack(output: any): void { this.archive.pipe(output); -console.log(appRoot.path); + console.log(appRoot.path + "/template"); this.archive.bulk([ { expand: true, - cwd: appRoot.path + '/template', + cwd: appRoot.path + "/template", src: ['**', '**/.rels'] } ]); - //this.archive.directory(__dirname + "/template", "/"); + //this.archive.file(appRoot.path + "/template/[Content_Types].xml", { name: "[Content_Types].xml" }); + //console.log(__dirname + "/packer.js"); + //this.archive.file(__dirname + "/packer.js", { name: "/[Content_Types].xml" }); + + /*this.archive.directory(appRoot.path + "/template", { + name: "/root/g.txt", + prefix: "root" + });*/ var xmlDocument = xml(this.formatter.format(this.document)); var xmlStyle = xml(this.style); var xmlProperties = xml(this.formatter.format(this.properties)); - console.log(JSON.stringify(this.formatter.format(this.document), null, " ")); - console.log(xmlDocument); + //console.log(JSON.stringify(this.formatter.format(this.document), null, " ")); + //console.log(xmlDocument); this.archive.append(xmlDocument, { name: 'word/document.xml' @@ -58,5 +65,6 @@ console.log(appRoot.path); }); this.archive.finalize(); + console.log("done"); } } \ No newline at end of file diff --git a/ts/tests/localPackerTest.ts b/ts/tests/localPackerTest.ts index edda074198..e8656042a9 100644 --- a/ts/tests/localPackerTest.ts +++ b/ts/tests/localPackerTest.ts @@ -8,12 +8,15 @@ import {assert} from "chai"; import {Document} from "../docx/document" import {Properties} from "../properties" import {DefaultStyle} from "../style/default" +import {Paragraph} from "../docx/paragraph" describe.only("Packer", () => { var packer: LocalPacker; beforeEach(() => { var document = new Document(); + var paragraph = new Paragraph("test text"); + document.addParagraph(paragraph); var properties = new Properties({ title: "test document" }); @@ -22,8 +25,9 @@ describe.only("Packer", () => { describe('#pack()', () => { - it("should create a standard docx file", () => { + it("should create a standard docx file", (done) => { packer.pack(); + setTimeout(done, 3000); }); }); }); \ No newline at end of file