Skip to content

Commit fabed6f

Browse files
authored
Merge branch 'master' into dependabot/npm_and_yarn/vitest/ui-2.1.2
2 parents deb3a35 + 1b9b815 commit fabed6f

13 files changed

+1954
-1240
lines changed

.github/workflows/default.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@ jobs:
1313
runs-on: ubuntu-latest
1414
steps:
1515
- name: Checkout Repo
16-
uses: actions/checkout@master
16+
uses: actions/checkout@v4
1717
- uses: "./.github/actions/install-and-build"
1818
- name: Archive Production Artifact
19-
uses: actions/upload-artifact@master
19+
uses: actions/upload-artifact@v4
2020
with:
2121
name: build
2222
path: build
@@ -25,7 +25,7 @@ jobs:
2525
runs-on: ubuntu-latest
2626
steps:
2727
- name: Checkout Repo
28-
uses: actions/checkout@master
28+
uses: actions/checkout@v4
2929
- name: Install Dependencies
3030
run: npm ci --force
3131
- name: Test
@@ -42,7 +42,7 @@ jobs:
4242
runs-on: ubuntu-latest
4343
steps:
4444
- name: Checkout Repo
45-
uses: actions/checkout@master
45+
uses: actions/checkout@v4
4646
- name: Install Dependencies
4747
run: npm ci --force
4848
- name: Lint
@@ -52,7 +52,7 @@ jobs:
5252
runs-on: ubuntu-latest
5353
steps:
5454
- name: Checkout Repo
55-
uses: actions/checkout@master
55+
uses: actions/checkout@v4
5656
- name: Install Dependencies
5757
run: npm ci --force
5858
- name: Prettier
@@ -62,7 +62,7 @@ jobs:
6262
runs-on: ubuntu-latest
6363
steps:
6464
- name: Checkout Repo
65-
uses: actions/checkout@master
65+
uses: actions/checkout@v4
6666
- name: Install Dependencies
6767
run: npm ci --force
6868
- name: Prettier

.github/workflows/demos.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212
name: Demos
1313
runs-on: ubuntu-latest
1414
steps:
15-
- uses: actions/checkout@master
15+
- uses: actions/checkout@v4
1616
- uses: "./.github/actions/install-and-build"
1717
- name: Run Demos
1818
run: npm run run-ts -- ./demo/1-basic.ts

.github/workflows/github-pages.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ jobs:
1010
runs-on: ubuntu-latest
1111
steps:
1212
- name: Checkout Repo
13-
uses: actions/checkout@master
13+
uses: actions/checkout@v4
1414
- name: Install Dependencies
1515
run: npm ci --force
1616
- name: Build 🔧
@@ -19,7 +19,7 @@ jobs:
1919
echo "docx.js.org" > docs/.nojekyll
2020
echo "docx.js.org" > docs/CNAME
2121
- name: Archive Production Artifact
22-
uses: actions/upload-artifact@master
22+
uses: actions/upload-artifact@v4
2323
with:
2424
name: docs
2525
path: docs
@@ -28,11 +28,11 @@ jobs:
2828
runs-on: ubuntu-latest
2929
steps:
3030
- name: Checkout Repo 🛎️
31-
uses: actions/checkout@master
31+
uses: actions/checkout@v4
3232
- name: Install Dependencies
3333
run: npm ci --force
3434
- name: Download Artifact
35-
uses: actions/download-artifact@master
35+
uses: actions/download-artifact@v4
3636
with:
3737
name: docs
3838
path: docs

.github/workflows/npm-publish.yml

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
# This workflow will run tests using node and then publish a package to GitHub Packages when a release is created
2+
# For more information see: https://docs.github.com/en/actions/publishing-packages/publishing-nodejs-packages
3+
4+
name: Node.js Package
5+
6+
on:
7+
release:
8+
types: [created]
9+
10+
jobs:
11+
test:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- uses: actions/checkout@v4
15+
- uses: actions/setup-node@v4
16+
with:
17+
node-version: "20.x"
18+
- run: npm ci
19+
- run: npm run cspell
20+
- run: npm run prettier
21+
- run: npm run lint
22+
- run: npm run test:ci
23+
24+
build:
25+
runs-on: ubuntu-latest
26+
steps:
27+
- uses: actions/checkout@v4
28+
- uses: actions/setup-node@v4
29+
with:
30+
node-version: "20.x"
31+
- run: npm ci
32+
- run: npm run build
33+
34+
publish-npm:
35+
needs: [test, build]
36+
runs-on: ubuntu-latest
37+
steps:
38+
- uses: actions/checkout@v4
39+
- uses: actions/setup-node@v4
40+
with:
41+
node-version: "20.x"
42+
registry-url: https://registry.npmjs.org/
43+
- run: npm ci
44+
- run: npm publish
45+
env:
46+
NODE_AUTH_TOKEN: ${{secrets.npm_token}}

demo/93-template-document.ts

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
// Patch a document with patches
2+
3+
import * as fs from "fs";
4+
import { patchDocument, PatchType, TextRun } from "docx";
5+
6+
patchDocument({
7+
outputType: "nodebuffer",
8+
data: fs.readFileSync("demo/assets/field-trip.docx"),
9+
patches: {
10+
todays_date: {
11+
type: PatchType.PARAGRAPH,
12+
children: [new TextRun({ text: new Date().toLocaleDateString() })],
13+
},
14+
15+
school_name: {
16+
type: PatchType.PARAGRAPH,
17+
children: [new TextRun({ text: "test" })],
18+
},
19+
20+
address: {
21+
type: PatchType.PARAGRAPH,
22+
children: [new TextRun({ text: "blah blah" })],
23+
},
24+
25+
city: {
26+
type: PatchType.PARAGRAPH,
27+
children: [new TextRun({ text: "test" })],
28+
},
29+
30+
state: {
31+
type: PatchType.PARAGRAPH,
32+
children: [new TextRun({ text: "test" })],
33+
},
34+
35+
zip: {
36+
type: PatchType.PARAGRAPH,
37+
children: [new TextRun({ text: "test" })],
38+
},
39+
40+
phone: {
41+
type: PatchType.PARAGRAPH,
42+
children: [new TextRun({ text: "test" })],
43+
},
44+
45+
first_name: {
46+
type: PatchType.PARAGRAPH,
47+
children: [new TextRun({ text: "test" })],
48+
},
49+
50+
last_name: {
51+
type: PatchType.PARAGRAPH,
52+
children: [new TextRun({ text: "test" })],
53+
},
54+
55+
email_address: {
56+
type: PatchType.PARAGRAPH,
57+
children: [new TextRun({ text: "test" })],
58+
},
59+
60+
ft_dates: {
61+
type: PatchType.PARAGRAPH,
62+
children: [new TextRun({ text: "test" })],
63+
},
64+
65+
grade: {
66+
type: PatchType.PARAGRAPH,
67+
children: [new TextRun({ text: "test" })],
68+
},
69+
},
70+
}).then((doc) => {
71+
fs.writeFileSync("My Document.docx", doc);
72+
});

demo/assets/field-trip.docx

24.9 KB
Binary file not shown.

0 commit comments

Comments
 (0)