Skip to content

Commit 916085b

Browse files
authored
Fix live demo (#359)
* Add starter workflow * Try building site * Remove Jekyll * Format * Update links
1 parent 49af257 commit 916085b

File tree

4 files changed

+65
-5
lines changed

4 files changed

+65
-5
lines changed

.github/workflows/gh-pages.yml

+60
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
name: Deploy to GitHub Pages
2+
3+
on:
4+
# Runs on pushes targeting the default branch
5+
push:
6+
branches: ['master']
7+
8+
# Allows you to run this workflow manually from the Actions tab
9+
workflow_dispatch:
10+
11+
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
12+
permissions:
13+
contents: read
14+
pages: write
15+
id-token: write
16+
17+
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
18+
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
19+
concurrency:
20+
group: 'pages'
21+
cancel-in-progress: false
22+
23+
jobs:
24+
# Build job
25+
build:
26+
runs-on: ubuntu-latest
27+
steps:
28+
- name: Checkout
29+
uses: actions/checkout@v4
30+
- name: Setup Pages
31+
uses: actions/configure-pages@v4
32+
- name: Setup Node
33+
uses: actions/setup-node@v3
34+
with:
35+
node-version: 'lts/*'
36+
cache: 'npm'
37+
- name: Install dependencies
38+
run: npm ci
39+
- name: Build jsondiffpatch
40+
run: npm run build
41+
working-directory: ./packages/jsondiffpatch
42+
- name: Build HTML demo
43+
run: npm run build
44+
working-directory: ./demos/html-demo
45+
- name: Upload artifact
46+
uses: actions/upload-pages-artifact@v3
47+
with:
48+
path: ./demos/html-demo
49+
50+
# Deployment job
51+
deploy:
52+
environment:
53+
name: github-pages
54+
url: ${{ steps.deployment.outputs.page_url }}
55+
runs-on: ubuntu-latest
56+
needs: build
57+
steps:
58+
- name: Deploy to GitHub Pages
59+
id: deployment
60+
uses: actions/deploy-pages@v4

README.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ Diff & patch JavaScript objects
1212

1313
---
1414

15-
## **[Live Demo](http://benjamine.github.io/jsondiffpatch/demo/index.html)**
15+
## **[Live Demo](http://benjamine.github.io/jsondiffpatch/index.html)**
1616

1717
- min+gzipped ~ 16KB
1818
- browser and server (ESM-only)
@@ -22,7 +22,7 @@ Diff & patch JavaScript objects
2222
- unpatch (eg. revert object to its original state using a delta)
2323
- simplistic, pure JSON, low footprint [delta format](docs/deltas.md)
2424
- multiple output formatters:
25-
- html (check it at the [Live Demo](http://benjamine.github.io/jsondiffpatch/demo/index.html))
25+
- html (check it at the [Live Demo](http://benjamine.github.io/jsondiffpatch/index.html))
2626
- annotated json (html), makes the JSON delta format self-explained
2727
- console (colored), try running `./node_modules/.bin/jsondiffpatch left.json right.json`
2828
- JSON Patch format RFC 6902 support
@@ -270,7 +270,7 @@ const jsondiffpatchInstance = jsondiffpatch.create({
270270
</html>
271271
```
272272

273-
To see formatters in action check the [Live Demo](http://benjamine.github.io/jsondiffpatch/demo/index.html).
273+
To see formatters in action check the [Live Demo](http://benjamine.github.io/jsondiffpatch/index.html).
274274

275275
For more details check [Formatters documentation](docs/formatters.md)
276276

docs/deltas.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ This format was created with a balance between readability and low footprint in
88
- to represent changed parts, arrays and magic numbers are used to keep a low footprint (i.e. you won't see verbosity like `"type": "added"`)
99
- keep it pure JSON serializable
1010

11-
A great way to understand this format is using the "Annotated JSON" option in the [Live Demo](http://benjamine.github.io/jsondiffpatch/demo/index.html), and try the different left/right examples, or edit left/right JSON to see the annotated delta update as your type.
11+
A great way to understand this format is using the "Annotated JSON" option in the [Live Demo](http://benjamine.github.io/jsondiffpatch/index.html), and try the different left/right examples, or edit left/right JSON to see the annotated delta update as your type.
1212

1313
Here's a complete reference of this format.
1414

docs/formatters.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Formatters
22

3-
Some formatters are included that let you convert a JSON delta into other formats, you can see some of these used in the [Live Demo](https://benjamine.github.io/jsondiffpatch/demo/index.html)
3+
Some formatters are included that let you convert a JSON delta into other formats, you can see some of these used in the [Live Demo](https://benjamine.github.io/jsondiffpatch/index.html)
44

55
## Html
66

0 commit comments

Comments
 (0)