Skip to content

Commit ccc46dc

Browse files
committed
feat: migrate documentation from MkDocs to Docusaurus
- Replace MkDocs with Docusaurus 3.x for modern React-based docs - Add inline chart editor with iframe integration on click - Add CSS hover overlay for chart images ("Open in Editor") - Migrate content generation scripts (error codes, fonts, gallery) - Update CI/CD workflow for Docusaurus build - Add local search with @easyops-cn/docusaurus-search-local - Add mermaid diagram support - Clean up legacy MkDocs files and assets - Update .gitignore for generated files
1 parent 8d17ff3 commit ccc46dc

File tree

148 files changed

+21654
-2145
lines changed

Some content is hidden

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

148 files changed

+21654
-2145
lines changed

.env.dist

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

.github/workflows/build.yml

100644100755
Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,23 +12,28 @@ jobs:
1212
build-and-deploy:
1313
runs-on: ubuntu-latest
1414
steps:
15-
- uses: actions/checkout@v3
15+
- uses: actions/checkout@v4
1616

17-
- name: Tests
18-
run: make test
17+
- name: Setup Node.js
18+
uses: actions/setup-node@v4
19+
with:
20+
node-version: "18"
21+
cache: "npm"
22+
23+
- name: Install dependencies
24+
run: npm ci
1925

2026
- name: Build website
21-
run: make build
27+
run: npm run build
2228
env:
2329
ACCOUNT_ID: ${{ secrets.ACCOUNT_ID }}
2430
SECRET_KEY: ${{ secrets.SECRET_KEY }}
25-
GOOGLE_ANALYTICS_TOKEN: ${{ secrets.GOOGLE_ANALYTICS_TOKEN }}
2631

27-
- name: Deploy to Netlify 🚀
32+
- name: Deploy to Netlify
2833
if: github.ref == 'refs/heads/master'
29-
uses: nwtgck/actions-netlify@v1.2
34+
uses: nwtgck/actions-netlify@v3
3035
with:
31-
publish-dir: "./site"
36+
publish-dir: "./build"
3237
production-branch: master
3338
github-token: ${{ secrets.GITHUB_TOKEN }}
3439
deploy-message: "Deploy from GitHub Actions"
@@ -39,4 +44,4 @@ jobs:
3944
env:
4045
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
4146
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}
42-
timeout-minutes: 1
47+
timeout-minutes: 5

.gitignore

100644100755
Lines changed: 35 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,36 @@
1-
docs/logo/*.md
2-
site
3-
hmac_.exe
4-
Program.class
5-
java.iml
6-
node_modules
7-
gallery.json
1+
# Dependencies
2+
node_modules/
3+
4+
# Build output
5+
build/
6+
.docusaurus/
7+
8+
# Generated documentation (built from external APIs)
9+
docs/GENERATED-*.md
10+
11+
# Cache
12+
.cache/
13+
14+
# Misc
15+
.DS_Store
16+
*.log
17+
npm-debug.log*
18+
yarn-error.log*
19+
20+
# Environment
21+
.env
22+
.env.local
823
.envrc
9-
.envrc.dist
10-
.netlify
24+
25+
# IDE
26+
.idea/
27+
.vscode/
28+
*.swp
29+
*.swo
30+
*.sublime-*
31+
32+
# Netlify
33+
.netlify/
34+
35+
# OS
36+
Thumbs.db

CLAUDE.md

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
# Image-Charts Documentation - Project Instructions
2+
3+
## Prerequisites
4+
5+
**CRITICAL**: Before any build operation, you MUST source the `.envrc` file:
6+
7+
```bash
8+
source .envrc
9+
```
10+
11+
The `.envrc` file contains required environment variables:
12+
- `ACCOUNT_ID` - Image-Charts account identifier (used for signing gallery URLs)
13+
- `SECRET_KEY` - HMAC secret key for URL signing
14+
- `GOOGLE_ANALYTICS_TOKEN` - Analytics tracking
15+
- Python/pyenv configuration
16+
17+
Without these variables, the `generate:gallery` script will fail.
18+
19+
## Build Commands
20+
21+
```bash
22+
# Full build (generates docs + builds site)
23+
source .envrc && npm run build
24+
25+
# Development server
26+
source .envrc && npm run start
27+
28+
# Generate only (without full build)
29+
source .envrc && npm run generate
30+
31+
# Serve production build locally
32+
npm run serve
33+
```
34+
35+
## Generation Scripts
36+
37+
The build process runs three generation scripts that fetch data from the Image-Charts API:
38+
39+
| Script | Source | Output | Requires Env |
40+
|--------|--------|--------|--------------|
41+
| `generate:error-codes` | `https://image-charts.com/errors.json` | `docs/GENERATED-error-codes.md` | No |
42+
| `generate:google-fonts` | `https://image-charts.com/swagger.json` | `docs/GENERATED-google-fonts.md` | No |
43+
| `generate:gallery` | `https://image-charts.com/gallery.json` | `docs/GENERATED-gallery.md` | **Yes** (ACCOUNT_ID, SECRET_KEY) |
44+
45+
The gallery script signs chart URLs using HMAC-SHA256 with the `SECRET_KEY`.
46+
47+
## Tech Stack
48+
49+
- Docusaurus 3.x
50+
- React 19
51+
- Node.js 18+
52+
53+
## Deployment
54+
55+
Automated via Netlify on push to master branch.
56+
57+
## File Structure
58+
59+
```
60+
scripts/
61+
generate-error-codes.js # Fetches error codes from API
62+
generate-google-fonts.js # Fetches font list from Swagger
63+
generate-gallery.js # Generates signed gallery URLs
64+
docs/
65+
GENERATED-*.md # Auto-generated files (do not edit manually)
66+
```

Dockerfile

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

Makefile

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

README.md

100644100755
Lines changed: 29 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,48 @@
1-
Image-Charts documentation
2-
--------------------------
1+
# Image-Charts Documentation
32

43
Read the documentation [online](https://documentation.image-charts.com/).
54

5+
## Development
66

7-
### Start local dev environment
7+
### Requirements
88

9-
Requirements:
10-
- docker
9+
- Node.js 18+
1110

12-
```
13-
make serve
14-
```
11+
### Install dependencies
1512

16-
### update
17-
18-
Update:
13+
```bash
14+
npm install
15+
```
1916

20-
- image-charts logo versions
17+
### Start local dev server
2118

22-
```
23-
make update
19+
```bash
20+
npm run start
2421
```
2522

26-
### tests
23+
This will start a local development server at `http://localhost:3000`.
2724

28-
We want that much of our code examples are tested through unit-tests.
25+
### Build
2926

27+
```bash
28+
npm run build
3029
```
31-
make test
30+
31+
### Serve production build locally
32+
33+
```bash
34+
npm run serve
3235
```
3336

34-
### deployment
37+
## Deployment
38+
39+
Deployment is done through Netlify when the master branch is updated.
3540

36-
Deployment is done through Github Actions to Netlify ([admin](https://app.netlify.com/sites/image-charts-documentation/overview)), when master branch is updated.
41+
- [Netlify Admin](https://app.netlify.com/sites/image-charts-documentation/overview)
3742

38-
### Credits
43+
## Tech Stack
3944

40-
Image-charts documentation is built upon [mkdocs](https://www.mkdocs.org) and [mkdocs-material](https://github.com/squidfunk/mkdocs-material/).
45+
- [Docusaurus 3.x](https://docusaurus.io/)
46+
- [React 19](https://react.dev/)
47+
- [@easyops-cn/docusaurus-search-local](https://github.com/easyops-cn/docusaurus-search-local) for search
48+
- [@docusaurus/theme-mermaid](https://docusaurus.io/docs/markdown-features/diagrams) for diagrams

docs/GENERATED-error-codes.md

100644100755
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,3 +32,10 @@
3232
}
3333
}```
3434
35+
- `IC_EMAIL_NOT_SENT`: Could not send email
36+
- `IC_SEND_EMAIL_MISSING`: email attribute missing, could not sent email
37+
- `IC_CONTACT_NOT_UPDATED`: Could not update contact
38+
- `IC_METADATA_EMAIL_MISSING`: email attribute missing, could not create or update metadata
39+
- `IC_UPDATE_METADATA_FAILED`: Could not create or update Metadata
40+
- `IC_CUSTOMER_SEARCH_FAILED`: Customer search failed
41+
- `IC_DATA_LOADING_FAILED`: Data loading failed

0 commit comments

Comments
 (0)