Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 42 additions & 5 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,46 @@ jobs:
with:
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
command: 'pages deploy build --project-name=halocommunitywebsite'
command: 'pages deploy build --project-name=docusauruscommunitywebsite'
gitHubToken: ${{ secrets.GITHUB_TOKEN }}

- name: Resolve deployment URLs
id: deploy-urls
run: |
DEPLOYMENT_URL="${{ steps.cloudflare-pages-deploy.outputs['deployment-url'] }}"
ALIAS_URL="${{ steps.cloudflare-pages-deploy.outputs['pages-deployment-alias-url'] }}"

# Prefer alias URL for preview builds; fall back to deployment URL.
FINAL_URL="$ALIAS_URL"
if [ -z "$FINAL_URL" ]; then
FINAL_URL="$DEPLOYMENT_URL"
fi

echo "deployment_url=$DEPLOYMENT_URL" >> "$GITHUB_OUTPUT"
echo "alias_url=$ALIAS_URL" >> "$GITHUB_OUTPUT"
echo "final_url=$FINAL_URL" >> "$GITHUB_OUTPUT"

- name: Write deployment summary
shell: bash
env:
COMMIT_SHA: ${{ github.event.pull_request.head.sha || github.sha }}
RUN_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
ENVIRONMENT: ${{ steps.cloudflare-pages-deploy.outputs['pages-environment'] }}
DEPLOYMENT_URL: ${{ steps.deploy-urls.outputs.deployment_url }}
PREVIEW_URL: ${{ steps.deploy-urls.outputs.final_url }}
run: |
{
echo "## Deploying with Cloudflare Pages"
echo
echo "| Name | Result |"
echo "| --- | --- |"
echo "| Last commit | \`$COMMIT_SHA\` |"
echo "| Deploy log | [View run]($RUN_URL) |"
echo "| Preview URL | [$PREVIEW_URL]($PREVIEW_URL) |"
echo "| Deployment URL | [$DEPLOYMENT_URL]($DEPLOYMENT_URL) |"
echo "| Environment | $ENVIRONMENT |"
} >> "$GITHUB_STEP_SUMMARY"

- name: Create commit comment
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
uses: peter-evans/commit-comment@v4
Expand All @@ -104,8 +141,8 @@ jobs:
### ⚡ Successfully deployed to Cloudflare Pages!
| <span aria-hidden="true">🔨</span> **Latest commit** | ${{ github.event.pull_request.head.sha || github.sha }} |
| <span aria-hidden="true">🔍</span> **Latest deploy log** | ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} |
| <span aria-hidden="true">😎</span> **Deploy preview URL** | [${{ steps.cloudflare-pages-deploy.outputs.url }}](${{ steps.cloudflare-pages-deploy.outputs.url }}) |
| <span aria-hidden="true">🌳</span> **Environment** | ${{ steps.cloudflare-pages-deploy.outputs.environment }} |
| <span aria-hidden="true">😎</span> **Deploy preview URL** | [${{ steps.deploy-urls.outputs.final_url }}](${{ steps.deploy-urls.outputs.final_url }}) |
| <span aria-hidden="true">🌳</span> **Environment** | ${{ steps.cloudflare-pages-deploy.outputs['pages-environment'] }} |

- name: Create PR comment
if: ${{ github.event_name == 'pull_request' || github.event_name == 'pull_request_target' }}
Expand All @@ -115,8 +152,8 @@ jobs:
### ⚡ Successfully deployed to Cloudflare Pages!
| <span aria-hidden="true">🔨</span> **Latest commit** | ${{ github.event.pull_request.head.sha || github.sha }} |
| <span aria-hidden="true">🔍</span> **Latest deploy log** | ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} |
| <span aria-hidden="true">😎</span> **Deploy preview URL** | [${{ steps.cloudflare-pages-deploy.outputs.url }}](${{ steps.cloudflare-pages-deploy.outputs.url }}) |
| <span aria-hidden="true">🌳</span> **Environment** | ${{ steps.cloudflare-pages-deploy.outputs.environment }} |
| <span aria-hidden="true">😎</span> **Deploy preview URL** | [${{ steps.deploy-urls.outputs.final_url }}](${{ steps.deploy-urls.outputs.final_url }}) |
| <span aria-hidden="true">🌳</span> **Environment** | ${{ steps.cloudflare-pages-deploy.outputs['pages-environment'] }} |

- name: Remove label
if: ${{ github.event_name == 'pull_request_target' && contains(github.event.label.name, '🚀request-deploy') }}
Expand Down
Binary file modified .yarn/install-state.gz
Binary file not shown.
3 changes: 0 additions & 3 deletions babel.config.js

This file was deleted.

30 changes: 18 additions & 12 deletions docusaurus.config.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
// @ts-check
// Note: type annotations allow type checking and IDEs autocompletion
// Import Types
import type { Config, PluginModule } from '@docusaurus/types';
import type { Config } from '@docusaurus/types';
import type * as Preset from '@docusaurus/preset-classic';
import type {Options as DocsOptions} from '@docusaurus/plugin-content-docs';
import type {Options as PageOptions} from '@docusaurus/plugin-content-pages';
// Import the Docusaurus version.
import { DOCUSAURUS_VERSION } from '@docusaurus/utils'
// Setup our Prism themes.
import { themes } from 'prism-react-renderer';
import plausiblePlugin, {type PluginOptions as PlausiblePluginOptions} from '@homotechsual/docusaurus-plugin-plausible';
const lightCodeTheme = themes.vsLight;
const darkCodeTheme = themes.vsDark;
// Define our admonitions config.
Expand Down Expand Up @@ -60,9 +61,6 @@ const commonDocsPluginConfig = {
...remarkPluginsConfig,
}

import plausiblePlugin, {type PluginOptions as plausibleOptions} from '@homotechsual/docusaurus-plugin-plausible';
import searchPlugin, {type PluginOptions as searchOptions} from '@easyops-cn/docusaurus-search-local';

/** @type {import('@docusaurus/types').Config} */
const config: Config = {
title: 'Docusaurus.community',
Expand All @@ -73,6 +71,7 @@ const config: Config = {
organizationName: 'homotechsual', // Usually your GitHub org/user name.
projectName: 'docusaurus.community', // Usually your repo name.
onBrokenLinks: 'throw',
trailingSlash: true,
i18n: {
defaultLocale: 'en',
locales: ['en'],
Expand Down Expand Up @@ -245,10 +244,10 @@ const config: Config = {
],
'docusaurus-plugin-sass',
[
plausiblePlugin as PluginModule,
plausiblePlugin,
{
domain: 'docusaurus.community',
} satisfies plausibleOptions,
} satisfies PlausiblePluginOptions,
],
[
'@docusaurus/plugin-content-docs',
Expand All @@ -265,29 +264,36 @@ const config: Config = {
],
themes: [
[
searchPlugin as PluginModule,
{
require.resolve("@easyops-cn/docusaurus-search-local"),
/** @type {import("@easyops-cn/docusaurus-search-local").PluginOptions} */
({
indexDocs: true,
indexBlog: false,
indexPages: true,
docsRouteBasePath: ["knowledge", "contributing"],
hashed: true,
docsDir: ["docs", "contributing"],
highlightSearchTermsOnTargetPage: true,
} satisfies searchOptions,
}),
],
],
markdown: {
hooks: {
onBrokenMarkdownLinks: 'throw',
},
format: 'detect',
mermaid: true,
mdx1Compat: {
comments: false,
headingIds: false,
admonitions: false,
},
hooks: {
onBrokenMarkdownLinks: 'throw',
}
},
future: {
faster: true,
v4: {
removeLegacyPostBuildHeadAttribute: true,
},
},
};
export default config;
11 changes: 6 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,11 @@
"@fortawesome/free-regular-svg-icons": "^7.2.0",
"@fortawesome/free-solid-svg-icons": "^7.2.0",
"@fortawesome/react-fontawesome": "^3.3.1",
"@homotechsual/docusaurus-plugin-plausible": "^1.0.0",
"@homotechsual/docusaurus-plugin-plausible": "^1.1.1",
"@iconify/react": "^6.0.2",
Comment thread
homotechsual marked this conversation as resolved.
"@mdx-js/react": "^3.1.1",
"@popperjs/core": "^2.11.8",
"@swc/core": "^1.15.40",
"@swc/core": "^1.15.43",
"@types/react-dom": "^19.2.3",
"clsx": "^2.1.1",
"docusaurus-plugin-sass": "^0.2.6",
Expand All @@ -48,18 +48,19 @@
"remark-definition-list": "^2.0.0",
"remark-deflist": "^1.0.0",
"remark-math": "6",
"sass": "^1.100.0",
"sass": "^1.101.0",
"swc-loader": "^0.2.7"
},
"devDependencies": {
"@docusaurus/faster": "^3.10.1",
"@docusaurus/module-type-aliases": "^3.10.1",
"@docusaurus/tsconfig": "^3.10.1",
"@docusaurus/types": "^3.10.1",
"@types/jest": "^30.0.0",
"@types/node": "^25.9.2",
"@types/node": "^26.0.0",
"@types/react": "^19.2.17",
"jest": "^30.4.2",
"prettier": "3.8.3",
"prettier": "3.8.4",
"prettier-plugin-css-order": "2.2.0",
"prop-types": "^15.8.1",
"react-waypoint": "^10.3.0",
Expand Down
5 changes: 3 additions & 2 deletions src/pages/plugindirectory/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@

import React, {useState, useMemo, useEffect} from 'react';
import clsx from 'clsx';
import ExecutionEnvironment from '@docusaurus/ExecutionEnvironment';
import Translate, {translate} from '@docusaurus/Translate';
import {useHistory, useLocation} from '@docusaurus/router';
import {usePluralForm} from '@docusaurus/theme-common';
Expand Down Expand Up @@ -51,6 +50,8 @@ type UserState = {
focusedElementId: string | undefined;
};

const canUseDOM = typeof window !== 'undefined' && typeof document !== 'undefined';

function restoreUserState(userState: UserState | null) {
const {scrollTopPosition, focusedElementId} = userState ?? {
scrollTopPosition: 0,
Expand All @@ -61,7 +62,7 @@ function restoreUserState(userState: UserState | null) {
}

export function prepareUserState(): UserState | undefined {
if (ExecutionEnvironment.canUseDOM) {
if (canUseDOM) {
return {
scrollTopPosition: window.scrollY,
focusedElementId: document.activeElement?.id,
Expand Down
Loading