Skip to content

Commit edbce6d

Browse files
homotechsualclaude
andcommitted
build: migrate to @docusaurus/faster and modernise config
- Replace custom webpack/SWC loader config with @docusaurus/faster (rspack) - Remove babel.config.js (no longer needed) - Move onBrokenMarkdownLinks into markdown.hooks per v4 API - Enable future.faster and future.v4.removeLegacyPostBuildHeadAttribute - Replace ExecutionEnvironment import with inline canUseDOM check - Add deployment summary step to publish workflow - Fix pages-environment output reference to use bracket notation Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 35ddfee commit edbce6d

7 files changed

Lines changed: 573 additions & 32 deletions

File tree

.github/workflows/publish.yml

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,27 @@ jobs:
112112
echo "alias_url=$ALIAS_URL" >> "$GITHUB_OUTPUT"
113113
echo "final_url=$FINAL_URL" >> "$GITHUB_OUTPUT"
114114
115+
- name: Write deployment summary
116+
shell: bash
117+
env:
118+
COMMIT_SHA: ${{ github.event.pull_request.head.sha || github.sha }}
119+
RUN_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
120+
ENVIRONMENT: ${{ steps.cloudflare-pages-deploy.outputs['pages-environment'] }}
121+
DEPLOYMENT_URL: ${{ steps.deploy-urls.outputs.deployment_url }}
122+
PREVIEW_URL: ${{ steps.deploy-urls.outputs.final_url }}
123+
run: |
124+
{
125+
echo "## Deploying with Cloudflare Pages"
126+
echo
127+
echo "| Name | Result |"
128+
echo "| --- | --- |"
129+
echo "| Last commit | \`$COMMIT_SHA\` |"
130+
echo "| Deploy log | [View run]($RUN_URL) |"
131+
echo "| Preview URL | [$PREVIEW_URL]($PREVIEW_URL) |"
132+
echo "| Deployment URL | [$DEPLOYMENT_URL]($DEPLOYMENT_URL) |"
133+
echo "| Environment | $ENVIRONMENT |"
134+
} >> "$GITHUB_STEP_SUMMARY"
135+
115136
- name: Create commit comment
116137
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
117138
uses: peter-evans/commit-comment@v4
@@ -121,7 +142,7 @@ jobs:
121142
| <span aria-hidden="true">🔨</span> **Latest commit** | ${{ github.event.pull_request.head.sha || github.sha }} |
122143
| <span aria-hidden="true">🔍</span> **Latest deploy log** | ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} |
123144
| <span aria-hidden="true">😎</span> **Deploy preview URL** | [${{ steps.deploy-urls.outputs.final_url }}](${{ steps.deploy-urls.outputs.final_url }}) |
124-
| <span aria-hidden="true">🌳</span> **Environment** | ${{ steps.cloudflare-pages-deploy.outputs.environment }} |
145+
| <span aria-hidden="true">🌳</span> **Environment** | ${{ steps.cloudflare-pages-deploy.outputs['pages-environment'] }} |
125146
126147
- name: Create PR comment
127148
if: ${{ github.event_name == 'pull_request' || github.event_name == 'pull_request_target' }}
@@ -132,7 +153,7 @@ jobs:
132153
| <span aria-hidden="true">🔨</span> **Latest commit** | ${{ github.event.pull_request.head.sha || github.sha }} |
133154
| <span aria-hidden="true">🔍</span> **Latest deploy log** | ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} |
134155
| <span aria-hidden="true">😎</span> **Deploy preview URL** | [${{ steps.deploy-urls.outputs.final_url }}](${{ steps.deploy-urls.outputs.final_url }}) |
135-
| <span aria-hidden="true">🌳</span> **Environment** | ${{ steps.cloudflare-pages-deploy.outputs.environment }} |
156+
| <span aria-hidden="true">🌳</span> **Environment** | ${{ steps.cloudflare-pages-deploy.outputs['pages-environment'] }} |
136157
137158
- name: Remove label
138159
if: ${{ github.event_name == 'pull_request_target' && contains(github.event.label.name, '🚀request-deploy') }}

.yarn/install-state.gz

51.3 KB
Binary file not shown.

babel.config.js

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

docusaurus.config.ts

Lines changed: 9 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,6 @@ const config: Config = {
7171
organizationName: 'homotechsual', // Usually your GitHub org/user name.
7272
projectName: 'docusaurus.community', // Usually your repo name.
7373
onBrokenLinks: 'throw',
74-
onBrokenMarkdownLinks: 'throw',
7574
trailingSlash: true,
7675
i18n: {
7776
defaultLocale: 'en',
@@ -278,29 +277,10 @@ const config: Config = {
278277
}),
279278
],
280279
],
281-
webpack: {
282-
jsLoader: (isServer: boolean) => ({
283-
loader: 'swc-loader',
284-
options: {
285-
jsc: {
286-
parser: {
287-
syntax: 'typescript',
288-
tsx: true,
289-
},
290-
transform: {
291-
react: {
292-
runtime: 'automatic',
293-
}
294-
},
295-
target: 'es2017',
296-
},
297-
module: {
298-
type: isServer ? 'commonjs' : 'es6',
299-
},
300-
},
301-
}),
302-
},
303280
markdown: {
281+
hooks: {
282+
onBrokenMarkdownLinks: 'throw',
283+
},
304284
format: 'detect',
305285
mermaid: true,
306286
mdx1Compat: {
@@ -309,5 +289,11 @@ const config: Config = {
309289
admonitions: false,
310290
}
311291
},
292+
future: {
293+
faster: true,
294+
v4: {
295+
removeLegacyPostBuildHeadAttribute: true,
296+
},
297+
},
312298
};
313299
export default config;

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@
5252
"swc-loader": "^0.2.7"
5353
},
5454
"devDependencies": {
55+
"@docusaurus/faster": "^3.10.1",
5556
"@docusaurus/module-type-aliases": "^3.10.1",
5657
"@docusaurus/tsconfig": "^3.10.1",
5758
"@docusaurus/types": "^3.10.1",

src/pages/plugindirectory/index.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77

88
import React, {useState, useMemo, useEffect} from 'react';
99
import clsx from 'clsx';
10-
import ExecutionEnvironment from '@docusaurus/ExecutionEnvironment';
1110
import Translate, {translate} from '@docusaurus/Translate';
1211
import {useHistory, useLocation} from '@docusaurus/router';
1312
import {usePluralForm} from '@docusaurus/theme-common';
@@ -51,6 +50,8 @@ type UserState = {
5150
focusedElementId: string | undefined;
5251
};
5352

53+
const canUseDOM = typeof window !== 'undefined' && typeof document !== 'undefined';
54+
5455
function restoreUserState(userState: UserState | null) {
5556
const {scrollTopPosition, focusedElementId} = userState ?? {
5657
scrollTopPosition: 0,
@@ -61,7 +62,7 @@ function restoreUserState(userState: UserState | null) {
6162
}
6263

6364
export function prepareUserState(): UserState | undefined {
64-
if (ExecutionEnvironment.canUseDOM) {
65+
if (canUseDOM) {
6566
return {
6667
scrollTopPosition: window.scrollY,
6768
focusedElementId: document.activeElement?.id,

0 commit comments

Comments
 (0)