Skip to content

Commit 909f880

Browse files
brunoborgesCopilot
andcommitted
Restructure repo: site/, content/, templates/ folders
- Move all 85 JSON source files to content/{category}/ - Move site assets (HTML, JS, CSS, images, fonts) to site/ - Move slug-template.html to templates/ - Update Generate.java and generate.py path constants - Update .gitignore, deploy workflow, README, copilot-instructions - Update check-new-jdk workflow with new paths Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 2310297 commit 909f880

File tree

104 files changed

+80
-67
lines changed

Some content is hidden

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

104 files changed

+80
-67
lines changed

.github/copilot-instructions.md

Lines changed: 28 additions & 18 deletions

.github/workflows/check-new-jdk.md

Lines changed: 8 additions & 8 deletions

.github/workflows/deploy.yml

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,10 @@ on:
44
push:
55
branches: [main]
66
paths:
7-
- '*/**.json'
8-
- 'slug-template.html'
7+
- 'content/*/**.json'
8+
- 'templates/**'
99
- 'Generate.java'
10-
- 'index.html'
11-
- 'styles.css'
12-
- 'app.js'
13-
- 'manifest.json'
14-
- 'favicon.svg'
15-
- 'assets/**'
16-
- 'images/**'
10+
- 'site/**'
1711
workflow_dispatch:
1812

1913
permissions:
@@ -54,7 +48,7 @@ jobs:
5448
- name: Upload artifact
5549
uses: actions/upload-pages-artifact@v3
5650
with:
57-
path: .
51+
path: site
5852

5953
deploy:
6054
needs: build

.gitignore

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
1-
# Generated HTML detail pages (built by generate.py from JSON sources)
2-
language/*.html
3-
collections/*.html
4-
strings/*.html
5-
streams/*.html
6-
concurrency/*.html
7-
io/*.html
8-
errors/*.html
9-
datetime/*.html
10-
security/*.html
11-
tooling/*.html
1+
# Generated HTML detail pages (built by Generate.java from JSON sources)
2+
site/language/*.html
3+
site/collections/*.html
4+
site/strings/*.html
5+
site/streams/*.html
6+
site/concurrency/*.html
7+
site/io/*.html
8+
site/errors/*.html
9+
site/datetime/*.html
10+
site/security/*.html
11+
site/tooling/*.html
1212

13-
# Generated aggregate file (built by generate.py from individual JSON sources)
14-
data/snippets.json
13+
# Generated aggregate file (built by Generate.java from individual JSON sources)
14+
site/data/snippets.json

Generate.java

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,9 @@
2727
*/
2828

2929
static final String BASE_URL = "https://javaevolved.github.io";
30-
static final String TEMPLATE_FILE = "slug-template.html";
30+
static final String TEMPLATE_FILE = "templates/slug-template.html";
31+
static final String CONTENT_DIR = "content";
32+
static final String SITE_DIR = "site";
3133
static final Pattern TOKEN_PATTERN = Pattern.compile("\\{\\{(\\w+)}}");
3234
static final ObjectMapper MAPPER = new ObjectMapper();
3335

@@ -109,7 +111,8 @@ void main() throws IOException {
109111
// Generate HTML files
110112
for (var snippet : allSnippets.values()) {
111113
var html = generateHtml(template, snippet, allSnippets).strip();
112-
Files.writeString(Path.of(snippet.category(), snippet.slug() + ".html"), html);
114+
Files.createDirectories(Path.of(SITE_DIR, snippet.category()));
115+
Files.writeString(Path.of(SITE_DIR, snippet.category(), snippet.slug() + ".html"), html);
113116
}
114117
IO.println("Generated %d HTML files".formatted(allSnippets.size()));
115118

@@ -123,17 +126,18 @@ void main() throws IOException {
123126
})
124127
.toList();
125128

126-
Files.createDirectories(Path.of("data"));
129+
Files.createDirectories(Path.of(SITE_DIR, "data"));
127130
var prettyMapper = new ObjectMapper().enable(SerializationFeature.INDENT_OUTPUT);
128-
Files.writeString(Path.of("data", "snippets.json"),
131+
Files.writeString(Path.of(SITE_DIR, "data", "snippets.json"),
129132
prettyMapper.writeValueAsString(snippetsList) + "\n");
130133
IO.println("Rebuilt data/snippets.json with %d entries".formatted(snippetsList.size()));
131134

132135
// Patch index.html with the current snippet count
133136
int count = allSnippets.size();
134-
var indexContent = Files.readString(Path.of("index.html"))
137+
var indexPath = Path.of(SITE_DIR, "index.html");
138+
var indexContent = Files.readString(indexPath)
135139
.replace("{{snippetCount}}", String.valueOf(count));
136-
Files.writeString(Path.of("index.html"), indexContent);
140+
Files.writeString(indexPath, indexContent);
137141
IO.println("Patched index.html with snippet count: %d".formatted(count));
138142
}
139143

@@ -142,7 +146,7 @@ void main() throws IOException {
142146
SequencedMap<String, Snippet> loadAllSnippets() throws IOException {
143147
SequencedMap<String, Snippet> snippets = new LinkedHashMap<>();
144148
for (var cat : CATEGORIES) {
145-
var catDir = Path.of(cat);
149+
var catDir = Path.of(CONTENT_DIR, cat);
146150
if (!Files.isDirectory(catDir)) continue;
147151

148152
try (var stream = Files.newDirectoryStream(catDir, "*.json")) {

README.md

Lines changed: 4 additions & 4 deletions
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)