Skip to content

Commit 2310297

Browse files
brunoborgesCopilot
andcommitted
Update README with JSON-first architecture and JBang build docs
Document the build pipeline (Generate.java + JBang), prerequisites, contributing workflow using JSON files, and architecture overview. Fix snippet count from 86 to 85. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 3e0a909 commit 2310297

File tree

1 file changed

+39
-14
lines changed

1 file changed

+39
-14
lines changed

README.md

Lines changed: 39 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
**Java has evolved. Your code can too.**
44

5-
A collection of 86 side-by-side code comparisons showing old Java patterns next to their clean, modern replacements — from Java 8 all the way to Java 25.
5+
A collection of 85 side-by-side code comparisons showing old Java patterns next to their clean, modern replacements — from Java 8 all the way to Java 25.
66

77
🔗 **[javaevolved.github.io](https://javaevolved.github.io)**
88

@@ -32,37 +32,62 @@ Each comparison includes an explanation of *why* the modern approach is better,
3232
| **Security** | TLS defaults, `SecureRandom`, PEM encoding, key derivation functions |
3333
| **Tooling** | JShell, single-file execution, JFR profiling, compact source files, AOT |
3434

35-
## Tech stack
35+
## Architecture
36+
37+
This site uses a **JSON-first** build pipeline:
38+
39+
- **Source of truth**: Individual `category/slug.json` files (85 across 10 category folders)
40+
- **Template**: `slug-template.html` — shared HTML template with `{{placeholder}}` tokens
41+
- **Generator**: `Generate.java` — a [JBang](https://jbang.dev) script that produces all HTML detail pages and `data/snippets.json`
42+
- **Deploy**: GitHub Actions runs the generator and deploys to GitHub Pages
43+
44+
Generated files (`category/*.html` and `data/snippets.json`) are in `.gitignore` — never edit them directly.
45+
46+
## Build & run locally
47+
48+
### Prerequisites
3649

37-
Plain HTML, CSS, and JavaScript — no frameworks, no build step. Hosted on GitHub Pages.
50+
- **Java 25+** (e.g. [Temurin](https://adoptium.net/))
51+
- **[JBang](https://jbang.dev)** (`brew install jbang` / `sdk install jbang` / [other options](https://www.jbang.dev/download/))
3852

39-
## Run locally
53+
### Generate and serve
4054

4155
```bash
42-
cd modern-java
56+
# Generate all HTML pages and data/snippets.json
57+
jbang Generate.java
58+
59+
# Serve locally
4360
python3 -m http.server 8090
4461
# Open http://localhost:8090
4562
```
4663

47-
## Modernize with GitHub Copilot
64+
The generator is a compact source file (Java 25) that uses Jackson for JSON parsing. On first run, JBang resolves the Jackson dependency (~2s); subsequent runs use a cached jar (~0.8s).
4865

49-
GitHub Copilot can help you migrate legacy Java codebases automatically:
66+
A Python equivalent (`generate.py`) is also available and produces identical output:
5067

51-
- [App Modernization](https://github.com/solutions/use-case/app-modernization)
52-
- [Modernize Java Applications with Copilot](https://docs.github.com/en/enterprise-cloud@latest/copilot/tutorials/modernize-java-applications)
68+
```bash
69+
python3 generate.py
70+
```
5371

5472
## Contributing
5573

56-
Contributions are welcome! If you'd like to add a new snippet, fix an inaccuracy, or improve the site:
74+
Contributions are welcome! Content is managed as JSON files — never edit generated HTML.
5775

5876
1. Fork the repo
59-
2. Add or edit snippets in `data/snippets.json`
60-
3. Create the corresponding `.html` article page
61-
4. Update `index.html` with the new card
62-
5. Open a pull request
77+
2. Create or edit a JSON file in the appropriate category folder (e.g. `language/my-feature.json`)
78+
3. Follow the [snippet JSON schema](.github/copilot-instructions.md) for all required fields
79+
4. Run `jbang Generate.java` to verify your changes build correctly
80+
5. Update `index.html` with a new preview card if adding a new snippet
81+
6. Open a pull request
6382

6483
Please ensure JDK version labels only reference the version where a feature became **final** (non-preview).
6584

85+
## Tech stack
86+
87+
- Plain HTML, CSS, and JavaScript — no frontend frameworks
88+
- [JBang](https://jbang.dev) + [Jackson](https://github.com/FasterXML/jackson) for build-time generation
89+
- Hosted on GitHub Pages via GitHub Actions
90+
6691
## Author
6792

6893
**Bruno Borges**

0 commit comments

Comments
 (0)