From 916085bb3c09519dfbbce44376a3ad6aa1826e94 Mon Sep 17 00:00:00 2001 From: Nathan Bierema Date: Fri, 5 Jan 2024 18:40:43 -0500 Subject: [PATCH] Fix live demo (#359) * Add starter workflow * Try building site * Remove Jekyll * Format * Update links --- .github/workflows/gh-pages.yml | 60 ++++++++++++++++++++++++++++++++++ README.md | 6 ++-- docs/deltas.md | 2 +- docs/formatters.md | 2 +- 4 files changed, 65 insertions(+), 5 deletions(-) create mode 100644 .github/workflows/gh-pages.yml diff --git a/.github/workflows/gh-pages.yml b/.github/workflows/gh-pages.yml new file mode 100644 index 00000000..c7022359 --- /dev/null +++ b/.github/workflows/gh-pages.yml @@ -0,0 +1,60 @@ +name: Deploy to GitHub Pages + +on: + # Runs on pushes targeting the default branch + push: + branches: ['master'] + + # Allows you to run this workflow manually from the Actions tab + workflow_dispatch: + +# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages +permissions: + contents: read + pages: write + id-token: write + +# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued. +# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete. +concurrency: + group: 'pages' + cancel-in-progress: false + +jobs: + # Build job + build: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Setup Pages + uses: actions/configure-pages@v4 + - name: Setup Node + uses: actions/setup-node@v3 + with: + node-version: 'lts/*' + cache: 'npm' + - name: Install dependencies + run: npm ci + - name: Build jsondiffpatch + run: npm run build + working-directory: ./packages/jsondiffpatch + - name: Build HTML demo + run: npm run build + working-directory: ./demos/html-demo + - name: Upload artifact + uses: actions/upload-pages-artifact@v3 + with: + path: ./demos/html-demo + + # Deployment job + deploy: + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} + runs-on: ubuntu-latest + needs: build + steps: + - name: Deploy to GitHub Pages + id: deployment + uses: actions/deploy-pages@v4 diff --git a/README.md b/README.md index 8c3168bb..40ad56ab 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@ Diff & patch JavaScript objects --- -## **[Live Demo](http://benjamine.github.io/jsondiffpatch/demo/index.html)** +## **[Live Demo](http://benjamine.github.io/jsondiffpatch/index.html)** - min+gzipped ~ 16KB - browser and server (ESM-only) @@ -22,7 +22,7 @@ Diff & patch JavaScript objects - unpatch (eg. revert object to its original state using a delta) - simplistic, pure JSON, low footprint [delta format](docs/deltas.md) - multiple output formatters: - - html (check it at the [Live Demo](http://benjamine.github.io/jsondiffpatch/demo/index.html)) + - html (check it at the [Live Demo](http://benjamine.github.io/jsondiffpatch/index.html)) - annotated json (html), makes the JSON delta format self-explained - console (colored), try running `./node_modules/.bin/jsondiffpatch left.json right.json` - JSON Patch format RFC 6902 support @@ -270,7 +270,7 @@ const jsondiffpatchInstance = jsondiffpatch.create({ ``` -To see formatters in action check the [Live Demo](http://benjamine.github.io/jsondiffpatch/demo/index.html). +To see formatters in action check the [Live Demo](http://benjamine.github.io/jsondiffpatch/index.html). For more details check [Formatters documentation](docs/formatters.md) diff --git a/docs/deltas.md b/docs/deltas.md index 9e5fc25d..a5a4cb2d 100644 --- a/docs/deltas.md +++ b/docs/deltas.md @@ -8,7 +8,7 @@ This format was created with a balance between readability and low footprint in - 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"`) - keep it pure JSON serializable -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. +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. Here's a complete reference of this format. diff --git a/docs/formatters.md b/docs/formatters.md index 3e5e00f3..1bd85596 100644 --- a/docs/formatters.md +++ b/docs/formatters.md @@ -1,6 +1,6 @@ # Formatters -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) +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) ## Html