-
-
Notifications
You must be signed in to change notification settings - Fork 500
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into patch-xmlns
- Loading branch information
Showing
13 changed files
with
3,455 additions
and
2,767 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
# This workflow will run tests using node and then publish a package to GitHub Packages when a release is created | ||
# For more information see: https://docs.github.com/en/actions/publishing-packages/publishing-nodejs-packages | ||
|
||
name: Node.js Package | ||
|
||
on: | ||
release: | ||
types: [created] | ||
|
||
jobs: | ||
test: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-node@v4 | ||
with: | ||
node-version: "20.x" | ||
- run: npm ci | ||
- run: npm run cspell | ||
- run: npm run prettier | ||
- run: npm run lint | ||
- run: npm run test:ci | ||
|
||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-node@v4 | ||
with: | ||
node-version: "20.x" | ||
- run: npm ci | ||
- run: npm run build | ||
|
||
publish-npm: | ||
needs: [test, build] | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-node@v4 | ||
with: | ||
node-version: "20.x" | ||
registry-url: https://registry.npmjs.org/ | ||
- run: npm ci | ||
- run: npm publish | ||
env: | ||
NODE_AUTH_TOKEN: ${{secrets.npm_token}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
// Patch a document with patches | ||
|
||
import * as fs from "fs"; | ||
import { patchDocument, PatchType, TextRun } from "docx"; | ||
|
||
patchDocument({ | ||
outputType: "nodebuffer", | ||
data: fs.readFileSync("demo/assets/field-trip.docx"), | ||
patches: { | ||
todays_date: { | ||
type: PatchType.PARAGRAPH, | ||
children: [new TextRun({ text: new Date().toLocaleDateString() })], | ||
}, | ||
|
||
school_name: { | ||
type: PatchType.PARAGRAPH, | ||
children: [new TextRun({ text: "test" })], | ||
}, | ||
|
||
address: { | ||
type: PatchType.PARAGRAPH, | ||
children: [new TextRun({ text: "blah blah" })], | ||
}, | ||
|
||
city: { | ||
type: PatchType.PARAGRAPH, | ||
children: [new TextRun({ text: "test" })], | ||
}, | ||
|
||
state: { | ||
type: PatchType.PARAGRAPH, | ||
children: [new TextRun({ text: "test" })], | ||
}, | ||
|
||
zip: { | ||
type: PatchType.PARAGRAPH, | ||
children: [new TextRun({ text: "test" })], | ||
}, | ||
|
||
phone: { | ||
type: PatchType.PARAGRAPH, | ||
children: [new TextRun({ text: "test" })], | ||
}, | ||
|
||
first_name: { | ||
type: PatchType.PARAGRAPH, | ||
children: [new TextRun({ text: "test" })], | ||
}, | ||
|
||
last_name: { | ||
type: PatchType.PARAGRAPH, | ||
children: [new TextRun({ text: "test" })], | ||
}, | ||
|
||
email_address: { | ||
type: PatchType.PARAGRAPH, | ||
children: [new TextRun({ text: "test" })], | ||
}, | ||
|
||
ft_dates: { | ||
type: PatchType.PARAGRAPH, | ||
children: [new TextRun({ text: "test" })], | ||
}, | ||
|
||
grade: { | ||
type: PatchType.PARAGRAPH, | ||
children: [new TextRun({ text: "test" })], | ||
}, | ||
}, | ||
}).then((doc) => { | ||
fs.writeFileSync("My Document.docx", doc); | ||
}); |
Binary file not shown.
Oops, something went wrong.