Skip to content

Commit eb8cdd8

Browse files
authored
Update deps 17 jul 2025 (#1188)
1 parent fa071de commit eb8cdd8

File tree

12 files changed

+225
-101
lines changed

12 files changed

+225
-101
lines changed

.github/copilot-instructions.md

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
## Copilot instructions for this repo (AdoptOpenJDK Blog)
2+
3+
Purpose: Help AI coding agents work productively in this Gatsby (v5) + MDX (v2) blog.
4+
5+
Big picture
6+
- Static site built with Gatsby 5.x, content in `content/blog/**/index.md` (MDX). Images live next to posts.
7+
- Programmatic pages are created in `gatsby-node.ts` using GraphQL over MDX nodes; custom fields `fields.slug` and `fields.postPath` are added in `onCreateNode` and used across templates.
8+
- Main templates live in `src/templates/` (blog-post, blog-page, tag-page, author-page). Shared UI in `src/components/`.
9+
- Site config and plugin wiring in `gatsby-config.js`. Two filesystem sources (`content/blog`, `content/assets`). MDX is configured with remark plugins (images, prism, etc.).
10+
11+
Key workflows
12+
- Install deps: `npm ci` (use Node 18+).
13+
- Dev server: `npm run develop` (hot-reload preview while editing content/components).
14+
- Build: `npm run build` then preview: `npm run serve` (site at http://localhost:9000).
15+
- Test script: `npm run test` runs lint then build. Lint uses ESLint 8 with `.eslintrc` (flat config is NOT used here).
16+
17+
Project-specific conventions
18+
- Posts are MDX files at `content/blog/<slug>/index.md` with frontmatter: `title`, `date` (ISO8601), `author`, optional `featuredImage`, `description` for home excerpts. See README for examples.
19+
- Author metadata in `content/authors.json`; author images resolved to `content/assets/authors/<key>.jpg`. If missing, `gatsby-node.ts` downloads GitHub avatar at build time using global `fetch` and writes to that path.
20+
- GraphQL usage relies on custom `fields` on `Mdx` nodes (set in `gatsby-node.ts`). Templates query `fields { slug, postPath }` and `frontmatter { ... }`. When creating new templates/queries, ensure those fields exist or add similar fields in `onCreateNode`.
21+
- Pagination: `gatsby-node.ts` creates `/page/1..N`; index shows up to 10 posts, template queries use `$skip`/`$limit`.
22+
- RSS: only generated in production (`gatsby build && gatsby serve`).
23+
24+
Important files
25+
- `gatsby-node.ts`: page creation, tag pages, author pages, MDX fields. Uses Node 18 global `fetch` and `fs.promises.writeFile(new Uint8Array(...))` when downloading author avatars.
26+
- `gatsby-config.js`: plugins & site metadata; MDX/remark configuration; Google Analytics; feed; typography.
27+
- `src/templates/*.js`: GraphQL queries + rendering logic per page type.
28+
- `src/components/*`: Layout, SEO, ArticlePreview, Byline, Tags, Comments, etc.
29+
- `content/`: blog posts and assets; authors.json.
30+
31+
Patterns to follow
32+
- When adding GraphQL fields to `Mdx`, define them in `onCreateNode` (slug, postPath). All templates assume these fields are present.
33+
- Use `internal.contentFilePath` when creating pages for MDX (`?__contentFilePath=`) to enable MDX rendering.
34+
- For author pages, ensure each author key in `authors.json` maps to a `.jpg` in `content/assets/authors/` or the avatar fetch will run at build time.
35+
- Keep queries in templates in sync with the schema defined by the plugins and the fields created in `gatsby-node.ts`.
36+
37+
Common pitfalls
38+
- If you see GraphQL errors like “Cannot query field 'fields' on type 'Mdx'”, check `onCreateNode` in `gatsby-node.ts` is creating those fields and that Gatsby is picking up the TS node file (it is, via `gatsby-node.ts`). Run `npm run clean` before `npm run build` after changes.
39+
- Do not upgrade React to v19 or MDX to v3 without coordinating upgrades to Gatsby v6+ and `gatsby-plugin-mdx` v6+. This repo is pinned to Gatsby 5.x with MDX v2.
40+
- ESLint 8 with `.eslintrc` is the current setup; ESLint 9 flat config caused parsing issues. Update only if necessary, and migrate carefully.
41+
42+
Examples
43+
- Creating a new blog post: add `content/blog/hello-world/index.md` with frontmatter, optional images; run `npm run develop`, verify at `/` and `/page/2`.
44+
- Linking to posts: use `node.fields.postPath` provided by `gatsby-node.ts` when building lists (see `src/templates/blog-page.js`).
45+
46+
Local commands (copy/paste)
47+
- Install: `npm ci`
48+
- Dev: `npm run develop`
49+
- Clean + build: `npm run clean && npm run build`
50+
- Preview build: `npm run serve` (http://localhost:9000)
51+
52+
Maintainer notes for agents
53+
- Prefer minimal, surgical changes. Avoid upgrading major versions unless explicitly requested.
54+
- When changing GraphQL, run a clean build to regenerate `.cache/schema.gql` and catch schema issues early.
55+
56+
Azure note
57+
- If asked to generate Azure code or commands, follow the Azure best-practices tool guidance available in your environment.
58+
59+
Contribution flow
60+
- Create feature branches from `master` (or the working update branch if collaborating).
61+
- Validate locally before PR:
62+
- `npm ci`
63+
- `npm run test` (runs lint + build)
64+
- Optional: `npm run serve` and verify key pages (/, /page/2, a post, /tags/<tag>, /author/<key>).
65+
- Keep changes minimal; avoid dependency major bumps unless the PR is dedicated to that effort.
66+
- In PRs, call out changes to GraphQL queries/templates and any content structure updates.

.github/workflows/ci.yml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [ main, master ]
6+
pull_request:
7+
branches: [ main, master ]
8+
9+
jobs:
10+
build:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Checkout
14+
uses: actions/checkout@v4
15+
16+
- name: Setup Node
17+
uses: actions/setup-node@v4
18+
with:
19+
node-version: '20'
20+
cache: 'npm'
21+
22+
- name: Install dependencies
23+
run: npm ci
24+
25+
- name: Restore Gatsby cache
26+
uses: actions/cache@v4
27+
with:
28+
path: |
29+
.cache
30+
public
31+
key: ${{ runner.os }}-gatsby-20-${{ hashFiles('**/package-lock.json') }}
32+
restore-keys: |
33+
${{ runner.os }}-gatsby-20-
34+
35+
- name: Lint
36+
run: npm run lint --silent
37+
38+
- name: Build
39+
run: npm run build --silent

.gitignore

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,3 @@ yarn-error.log
7373

7474
# VS Code Config
7575
.vscode/
76-
77-
# GH Copilot Instructions
78-
.github/copilot-instructions.md

README.md

Lines changed: 45 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,34 @@
1+
# AdoptOpenJDK Blog
2+
13
[![Deploy to GitHub Pages](https://github.com/AdoptOpenJDK/blog/actions/workflows/deploy-to-gh-pages.yml/badge.svg)](https://github.com/AdoptOpenJDK/blog/actions/workflows/deploy-to-gh-pages.yml)
24

3-
# AdoptOpenJDK Blog
5+
This is the source of the AdoptOpenJDK blog: <https://blog.adoptopenjdk.net/>
46

5-
This is the source of the [AdoptOpenJDK blog](https://blog.adoptopenjdk.net/).
7+
React 19 upgrade plan: see docs/react19-plan.md for the phased plan and current blocker status.
68

79
## Prerequisites
810

911
1. Install dependencies, run `npm install` in the root directory of the repository.
1012

1113
## Adding Content
1214

13-
1. Create a folder in `blog` that is named after your post's title. [Slugify](https://blog.tersmitten.nl/slugify/) the title if it's more than a single word. Example: `hello-world`.
15+
1. Create a folder in `blog` that is named after your post's title. Slugify the title if it's more than a single word. Example: `hello-world`.
1416
2. Create a file called `index.md` in the directory you just created (`blog/hello-world`).
1517
3. Add the required metadata at the beginning of the file
16-
```
17-
---
18-
title: Hello World
19-
date: "2020-04-21T12:20:00+00:00"
20-
author: janedoe
21-
featuredImage: "./featured_image.png" (optional)
22-
---
23-
```
24-
`title` is the title of your post as it appears on the website. `date` is the ISO 8601 timestamp of the publication date (`date -u +"%Y-%m-%dT%H:%M:%SZ"` generates that for you on the command line) and `author` the identifier of the author as specified in the `authors.json`. `featuredImage` (optional) the relative path to the featured image.
18+
19+
---
20+
title: Hello World
21+
date: "2020-04-21T12:20:00+00:00"
22+
author: janedoe
23+
featuredImage: "./featured_image.png" (optional)
24+
---
25+
26+
`title` is the title of your post as it appears on the website. `date` is the ISO 8601 timestamp of the publication date (`date -u +"%Y-%m-%dT%H:%M:%SZ"` generates that for you on the command line) and `author` the identifier of the author as specified in the `authors.json`. `featuredImage` (optional) the relative path to the featured image.
2527
4. Write your post in Markdown. Save any images in the folder of your post alongside the `index.md`. Put the biggest resolution in there that you have. Responsive images will automatically be generated for you.
2628

2729
To preview your post, start the local development server by running `gatsby develop` in the root directory of the repository.
2830

29-
**WARNING**: The RSS feed is only generated in production mode: `gatsby build && gatsby serve`.
31+
WARNING: The RSS feed is only generated in production mode: `gatsby build && gatsby serve`.
3032

3133
## Editing Conventions
3234

@@ -38,75 +40,61 @@ On the front page, we only display excerpts and not full posts. By default, Gats
3840

3941
To add captions to your images, use the following structure:
4042

41-
```markdown
42-
![Alt text](./image.jpg)
43-
*Your caption here*
44-
```
43+
![Alt text](./image.jpg)
44+
*Your caption here*
4545

4646
Our CSS will take care of rendering it correctly by looking for `img + em`.
4747

4848
Example:
4949

50-
```markdown
51-
![Photo depiciting a drop of water](./clean-drop-of-water-liquid.jpg)
52-
*AQA v1.0 is a first drop in an on-going series of improvements.*
53-
```
50+
![Photo depiciting a drop of water](./clean-drop-of-water-liquid.jpg)
51+
*AQA v1.0 is a first drop in an on-going series of improvements.*
5452

5553
### Quotes
5654

57-
```markdown
58-
> Quote
59-
>
60-
> <cite>Name of the person</cite>
61-
```
55+
> Quote
56+
>
57+
> <cite>Name of the person</cite>
6258

6359
Example:
6460

65-
```markdown
66-
> When the Well is Dry, We’ll Know the Worth of Water.
67-
>
68-
> <cite>Benjamin Franklin</cite>
69-
```
61+
> When the Well is Dry, We’ll Know the Worth of Water.
62+
>
63+
> <cite>Benjamin Franklin</cite>
7064

7165
### Guest Posts
7266

7367
Right after the front matter, add the following snippet to introduce the person that wrote the post:
7468

75-
```markdown
76-
<GuestPost>
77-
Some introductory text
78-
</GuestPost>
79-
```
69+
<GuestPost>
70+
Some introductory text
71+
</GuestPost>
8072

8173
This is going to render as:
8274

83-
```
84-
<p className="guestpost">
85-
<em>Some introductory text – AdoptOpenJDK Team</em>
86-
</p>
87-
```
75+
<p className="guestpost">
76+
<em>Some introductory text – AdoptOpenJDK Team</em>
77+
</p>
8878

8979
Example:
9080

91-
```markdown
92-
<GuestPost>
93-
This a guest post by <a href="https://www.linkedin.com/in/weitzelm/">Mark Weitzel</a>, General Manager, New Relic One at New Relic.
94-
</GuestPost>
95-
```
81+
<GuestPost>
82+
This a guest post by <a href="https://www.linkedin.com/in/weitzelm/">Mark Weitzel</a>, General Manager, New Relic One at New Relic.
83+
</GuestPost>
9684

97-
**Note:** Markdown is not supported within `<GuestPost/>`. This is a limitation of MDX v1 and fixed in [MDX v2](https://github.com/mdx-js/mdx/issues/1041) which is currently being developed.
85+
Note: Markdown is not supported within `<GuestPost/>`. This is a limitation of MDX v1 and fixed in MDX v2 (<https://github.com/mdx-js/mdx/issues/1041>) which is currently being developed.
9886

9987
## Adding Authors
10088

10189
1. Create an entry in `content/authors.json`. Structure:
102-
```json
103-
{
104-
"janedoe": {
105-
"name": "Jane Doe",
106-
"summary": "Some info about Jane",
107-
"twitter": "Jane's Twitter handle",
108-
"github": "Jane's GitHub username"
109-
}
110-
}
111-
```
90+
91+
{
92+
"janedoe": {
93+
"name": "Jane Doe",
94+
"summary": "Some info about Jane",
95+
"twitter": "Jane's Twitter handle",
96+
"github": "Jane's GitHub username"
97+
}
98+
}
99+
112100
2. Your profile picture comes from github but this can be changed by adding a profile picture in `content/assets/authors`. If the key in the `authors.json` is `janedoe`, name the image file `janedoe.jpg`.

content/blog/bundling-adoptopenjdk-into-a-notarized-macos-application/index.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ Some changes have been made to the way we codesign our macOS binaries.
1515

1616
## Summary
1717

18-
Apple has recently changed the requirements for applications to install on macOS 10.15 and above. The change requires developers to notarize the application before it gets shipped. Notarization involves submitting the application to Apple to be scanned and generates a JSON report with any issues. More information about notarization can be found [here](https://developer.apple.com/documentation/security/notarizing_your_app_before_distribution).
18+
Apple has recently changed the requirements for applications to install on macOS 10.15 and above. The change requires developers to notarize the application before it gets shipped. Notarization involves submitting the application to Apple to be scanned and generates a JSON report with any issues. More information about notarization can be found in [Apple’s docs on notarization](https://developer.apple.com/documentation/security/notarizing_your_app_before_distribution).
1919

2020
## What’s changed?
2121

@@ -25,8 +25,10 @@ We have enabled hardened runtime on our macOS binaries which will allow them to
2525

2626
We had multiple bug reports from users saying that when they bundle AdoptOpenJDK binaries into their applications, the notarization fails with multiple errors such as the ones below:
2727

28-
“message”: “The signature algorithm used is too weak.”,
29-
“message”: “The executable does not have the hardened runtime enabled.”,
28+
```text
29+
“message”: “The signature algorithm used is too weak.”,
30+
“message”: “The executable does not have the hardened runtime enabled.”,
31+
```
3032

3133
In order to work around this, we have had to enable hardened runtime on our binaries when we codesign them.
3234

@@ -51,7 +53,7 @@ This requires us to add --options runtime to the codesign command. It also requi
5153

5254
If you try and bundle our OpenJDK8 binaries you will receive the following notarization failure:
5355

54-
```output
56+
```text
5557
"message": "The binary uses an SDK older than the 10.9 SDK.",
5658
```
5759

docs/react19-plan.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# React 19 upgrade plan (tracking)
2+
3+
Status: [Blocked by Gatsby 5 peer dependency on React ^18](https://github.com/gatsbyjs/gatsby/issues/39180)
4+
5+
Phases
6+
7+
1) Upgrade Gatsby to the first React 19–compatible major and bump all official plugins to matching majors.
8+
9+
2) Align MDX ecosystem: gatsby-plugin-mdx to matching major, @mdx-js/react v3, gatsby-remark-* majors.
10+
11+
3) Upgrade react/react-dom to 19.1.1+. Validate SSR/hydration across pages.
12+
13+
Done
14+
15+
- Removed defaultProps on function components (SEO) and used param defaults.
16+
- Switched analytics to gatsby-plugin-google-gtag.
17+
- Cleaned tsconfig include.
18+
19+
To monitor
20+
21+
- `npm view gatsby peerDependencies` should include react: ^19 once supported.
22+
23+
Quick check
24+
25+
- npm run check:compat

gatsby-config.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,15 +46,16 @@ module.exports = {
4646
],
4747
},
4848
},
49-
"gatsby-remark-images",
49+
// Note: gatsby-remark-images is configured via
50+
// gatsby-plugin-mdx's gatsbyRemarkPlugins
5051
"gatsby-transformer-sharp",
5152
"gatsby-plugin-image",
5253
"gatsby-plugin-sharp",
5354
{
54-
resolve: "gatsby-plugin-google-analytics",
55+
resolve: "gatsby-plugin-google-gtag",
5556
options: {
56-
trackingId: "UA-99905649-2",
57-
anonymize: true,
57+
trackingIds: ["UA-99905649-2"],
58+
gtagConfig: { anonymize_ip: true },
5859
},
5960
},
6061
{

gatsby-node.ts

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,5 @@
11
import path from 'path'
2-
import fetch from 'node-fetch'
32
import fs from 'fs'
4-
5-
import { pipeline } from 'stream'
6-
import { promisify } from 'util'
73
import { createFilePath } from 'gatsby-source-filesystem'
84

95
import type { GatsbyNode, Node } from 'gatsby'
@@ -30,12 +26,14 @@ export const createPages: GatsbyNode['createPages'] = async ({ graphql, actions
3026
await fs.promises.access(`content/assets/authors/${author}.jpg`);
3127
} catch (error) {
3228
const githubUsername = authorJson[author].github;
33-
const streamPipeline = promisify(pipeline);
29+
// Use Node 18+ global fetch to download the avatar without additional deps
3430
const response = await fetch(`https://github.com/${githubUsername}.png?size=250`);
3531
if (!response.ok) {
3632
throw new Error(`Unexpected response: ${response.statusText}`);
3733
}
38-
await streamPipeline(response.body, fs.createWriteStream(`content/assets/authors/${author}.jpg`));
34+
const arrayBuf = await response.arrayBuffer();
35+
const uint8 = new Uint8Array(arrayBuf);
36+
await fs.promises.writeFile(`content/assets/authors/${author}.jpg`, uint8);
3937
}
4038

4139
createPage({

0 commit comments

Comments
 (0)