Skip to content

Commit 262ce17

Browse files
authored
Merge pull request #7 from hrhrng/claude/compress-json-before-base64-fO1bu
Add gzip compression for JSON sharing and cross-platform scripts
2 parents f2fd3d3 + e2ea92a commit 262ce17

43 files changed

Lines changed: 1886 additions & 1316 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/ci.yml

Lines changed: 60 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1-
name: CI & Preview
1+
name: CI
22

33
on:
44
push:
5-
branches-ignore: [ main ]
65
pull_request:
76
branches: [ main ]
87

98
permissions:
10-
contents: write
9+
contents: read
10+
deployments: write
1111

1212
jobs:
1313
build:
@@ -36,7 +36,56 @@ jobs:
3636
env:
3737
NODE_OPTIONS: "--max_old_space_size=4096"
3838

39-
preview:
39+
test-scripts:
40+
runs-on: ${{ matrix.os }}
41+
strategy:
42+
matrix:
43+
os: [ubuntu-latest, windows-latest]
44+
steps:
45+
- name: Checkout
46+
uses: actions/checkout@v4
47+
48+
- name: Run present tests (Linux/macOS)
49+
if: runner.os != 'Windows'
50+
run: bash tests/test-present.sh
51+
52+
- name: Run present tests (Windows)
53+
if: runner.os == 'Windows'
54+
shell: pwsh
55+
run: ./tests/test-present.ps1
56+
57+
playwright:
58+
runs-on: ubuntu-latest
59+
needs: build
60+
if: github.event_name == 'pull_request'
61+
steps:
62+
- name: Checkout
63+
uses: actions/checkout@v4
64+
65+
- name: Setup Node
66+
uses: actions/setup-node@v4
67+
with:
68+
node-version: '20'
69+
cache: 'npm'
70+
71+
- name: Install dependencies
72+
run: npm ci
73+
74+
- name: Install Playwright browsers
75+
run: npx playwright install --with-deps chromium
76+
77+
- name: Run Playwright tests
78+
run: npx playwright test
79+
80+
- name: Upload test report
81+
if: ${{ !cancelled() }}
82+
uses: actions/upload-artifact@v4
83+
with:
84+
name: playwright-report
85+
path: playwright-report/
86+
retention-days: 14
87+
88+
deploy:
4089
runs-on: ubuntu-latest
4190
needs: build
4291
if: github.event_name == 'push'
@@ -53,17 +102,14 @@ jobs:
53102
- name: Install dependencies
54103
run: npm ci
55104

56-
- name: Build for preview
57-
run: |
58-
BRANCH_NAME=${GITHUB_REF_NAME}
59-
npm run build -- --base=/super-json/preview/${BRANCH_NAME}/
105+
- name: Build
106+
run: npm run build
60107
env:
61108
NODE_OPTIONS: "--max_old_space_size=4096"
62109

63-
- name: Deploy preview to gh-pages
64-
uses: peaceiris/actions-gh-pages@v4
110+
- name: Deploy to Cloudflare Pages
111+
uses: cloudflare/wrangler-action@v3
65112
with:
66-
github_token: ${{ secrets.GITHUB_TOKEN }}
67-
publish_dir: ./dist
68-
destination_dir: preview/${{ github.ref_name }}
69-
keep_files: true
113+
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
114+
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
115+
command: pages deploy dist --project-name=super-json --branch=${{ github.ref_name }}

.github/workflows/cleanup-preview.yml

Lines changed: 0 additions & 38 deletions
This file was deleted.

.github/workflows/deploy.yml

Lines changed: 0 additions & 42 deletions
This file was deleted.

CLAUDE.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,9 @@
22

33
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
44

5-
## deploy guidline
6-
use playwright to test ui by snapshot.
5+
## Deploy Guideline
6+
- Use Playwright to test UI by snapshot.
7+
- Before creating a PR, run `npm test` locally to ensure all Playwright tests pass.
78

89
## Project Overview
910

README.md

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
**The Ultimate Multi-Layer Escaped JSON Editor - Parse, Edit, and Rebuild Complex Nested JSON with Ease! 🎯**
1010

11-
[**Try It Now**](https://hrhrng.github.io/super-json)
11+
[**Try It Now**](https://superjson.org) | [**Documentation**](https://superjson.org/docs/)
1212

1313
[Report Bug](https://github.com/hrhrng/super-json/issues) | [Request Feature](https://github.com/hrhrng/super-json/issues)
1414

@@ -75,9 +75,8 @@ Ever struggled with deeply nested, escaped JSON strings? Like this nightmare:
7575

7676
Share JSON instantly via URL — no server required:
7777

78-
- **Share Button** - One-click share with LZ-String compression (`?s=` parameter)
78+
- **Share Button** - One-click share with gzip compression (`?c=` parameter)
7979
- **Custom Tab Names** - Hover "Share" to name your tab before sharing (`?t=` parameter)
80-
- **Base64url Mode** - Shell-friendly encoding without dependencies (`?r=` parameter)
8180
- **Hero Direct Link** - Add `?h=1` to auto-open JSON Hero viewer on import
8281

8382
### 🤖 Claude Code Skill: `present-json`
@@ -93,20 +92,19 @@ npx skills add hrhrng/super-json
9392
**How it works — agent generates a shareable link from any JSON:**
9493

9594
```bash
96-
# Agent generates a shareable link from any JSON
97-
encoded=$(echo -n '{"status":"ok","data":[1,2,3]}' | base64 | tr '+/' '-_' | tr -d '=\n')
98-
echo "https://hrhrng.github.io/super-json?r=${encoded}&t=API+Response"
95+
# Agent generates a compressed shareable link from any JSON
96+
encoded=$(echo -n '{"status":"ok","data":[1,2,3]}' | gzip -9 | base64 | tr '+/' '-_' | tr -d '=\n')
97+
echo "https://hrhrng.github.io/super-json?c=${encoded}&t=API+Response"
9998

10099
# With Hero mode for interactive visualization
101-
echo "https://hrhrng.github.io/super-json?r=${encoded}&t=API+Response&h=1"
100+
echo "https://hrhrng.github.io/super-json?c=${encoded}&t=API+Response&h=1"
102101
```
103102

104103
**URL Parameters:**
105104

106105
| Param | Description | Example |
107106
|-------|-------------|---------|
108-
| `s` | LZ-String compressed JSON (shorter URLs) | `?s=NoIgbg9...` |
109-
| `r` | Base64url encoded JSON (shell-friendly) | `?r=eyJrZXki...` |
107+
| `c` | Gzip + Base64url compressed JSON | `?c=H4sIA...` |
110108
| `t` | Custom tab name | `&t=My+Results` |
111109
| `h` | Auto-switch to Hero mode | `&h=1` |
112110

0 commit comments

Comments
 (0)