Update to latest version of Docusaurus and Yarn v4 (#42)
* - Switch to modern yarn (v4) - Update packages - Pin postman-code-generators version due to https://github.com/postmanlabs/postman-code-generators/issues/760 - Upgrade to latest nodejs LTS (v22) - Update create-providers-json.ts to not cause type errors Signed-off-by: Joshua Castle <26531652+Kas-tle@users.noreply.github.com> * Must setup node twice to enable corepack Signed-off-by: Joshua Castle <26531652+Kas-tle@users.noreply.github.com> * Get everything building again Signed-off-by: Joshua Castle <26531652+Kas-tle@users.noreply.github.com> --------- Signed-off-by: Joshua Castle <26531652+Kas-tle@users.noreply.github.com>
This commit is contained in:
1 parent
17e3b06b3d
commit
902e9f3da7
15 files changed
+18411
-10821
No files matched your search
@@ -30,22 +30,29 @@ jobs:
|
||||
name: Deploy to GitHub Pages
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332
|
||||
- uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af
|
||||
with:
|
||||
node-version: 22
|
||||
|
||||
- name: Enable Corepack
|
||||
run: corepack enable
|
||||
|
||||
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Setup Pages
|
||||
uses: actions/configure-pages@983d7736d9b0ae728b81ab479565c72886d7745b
|
||||
|
||||
- uses: actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b
|
||||
- uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af
|
||||
with:
|
||||
node-version: 18
|
||||
node-version: 22
|
||||
cache: yarn
|
||||
|
||||
- name: Install dependencies
|
||||
run: yarn install --frozen-lockfile
|
||||
|
||||
- uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9
|
||||
- uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57
|
||||
with:
|
||||
path: |
|
||||
${{ github.workspace }}/.docusaurus
|
||||
@@ -71,4 +78,4 @@ jobs:
|
||||
steps:
|
||||
- name: Deploy to GitHub Pages
|
||||
id: deployment
|
||||
uses: actions/deploy-pages@decdde0ac072f6dcbe43649d82d9c635fff5b4e4
|
||||
uses: actions/deploy-pages@d6db90164ac5ed86f2b6aed7e0febac5b3c0c03e
|
||||
@@ -8,19 +8,26 @@ jobs:
|
||||
name: Build PR
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332
|
||||
- uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af
|
||||
with:
|
||||
node-version: 22
|
||||
|
||||
- name: Enable Corepack
|
||||
run: corepack enable
|
||||
|
||||
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- uses: actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b
|
||||
- uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af
|
||||
with:
|
||||
node-version: 18
|
||||
node-version: 22
|
||||
cache: yarn
|
||||
|
||||
- name: Install dependencies
|
||||
run: yarn install --frozen-lockfile
|
||||
|
||||
- uses: actions/cache/restore@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9
|
||||
- uses: actions/cache/restore@1bd1e32a3bdc45362d1e726936510720a7c30a57
|
||||
with:
|
||||
path: |
|
||||
${{ github.workspace }}/.docusaurus
|
||||
|
||||
+6
-1
@@ -26,4 +26,9 @@ vendor
|
||||
npm-debug.log*
|
||||
yarn-debug.log*
|
||||
yarn-error.log*
|
||||
package-lock.json
|
||||
package-lock.json
|
||||
|
||||
.pnp.*
|
||||
.yarn/*
|
||||
!.yarn/patches
|
||||
!.yarn/versions
|
||||
@@ -0,0 +1 @@
|
||||
nodeLinker: node-modules
|
||||
@@ -770,5 +770,46 @@
|
||||
"theme.unlistedContent.message": {
|
||||
"message": "This page is unlisted. Search engines will not index it, and only users having a direct link can access it.",
|
||||
"description": "The unlisted content banner message"
|
||||
},
|
||||
"providers.provider.not_listed.description": {
|
||||
"message": "If your hosting provider is not listed, try enabling the `clone-remote-port` option in the config. Then, restart the server, and try connecting with the same IP and port as on Java Edition. <br> If this does not work, ask your server hosting provider for a UDP port, and use that. For VPS/KVM servers please follow the self-hosting steps."
|
||||
},
|
||||
"providers.provider.wasabihosting.description": {
|
||||
"message": "Install Geyser with the plugin installer. Use the same port as your Java server in the Geyser config. Connect with the same address and port as your Java server."
|
||||
},
|
||||
"pages.download.description.hurricane": {
|
||||
"message": "A plugin with various workarounds for Geyser players that modify the server in order to achieve their goal."
|
||||
},
|
||||
"theme.blog.author.pageTitle": {
|
||||
"message": "{authorName} - {nPosts}",
|
||||
"description": "The title of the page for a blog author"
|
||||
},
|
||||
"theme.blog.authorsList.pageTitle": {
|
||||
"message": "Authors",
|
||||
"description": "The title of the authors page"
|
||||
},
|
||||
"theme.blog.authorsList.viewAll": {
|
||||
"message": "View all authors",
|
||||
"description": "The label of the link targeting the blog authors page"
|
||||
},
|
||||
"theme.blog.author.noPosts": {
|
||||
"message": "This author has not written any posts yet.",
|
||||
"description": "The text for authors with 0 blog post"
|
||||
},
|
||||
"theme.contentVisibility.unlistedBanner.title": {
|
||||
"message": "Unlisted page",
|
||||
"description": "The unlisted content banner title"
|
||||
},
|
||||
"theme.contentVisibility.unlistedBanner.message": {
|
||||
"message": "This page is unlisted. Search engines will not index it, and only users having a direct link can access it.",
|
||||
"description": "The unlisted content banner message"
|
||||
},
|
||||
"theme.contentVisibility.draftBanner.title": {
|
||||
"message": "Draft page",
|
||||
"description": "The draft content banner title"
|
||||
},
|
||||
"theme.contentVisibility.draftBanner.message": {
|
||||
"message": "This page is a draft. It will only be visible in dev and be excluded from the production build.",
|
||||
"description": "The draft content banner message"
|
||||
}
|
||||
}
|
||||
@@ -182,5 +182,9 @@
|
||||
"sidebar.geyserSidebar.category.Geyser API": {
|
||||
"message": "Geyser API",
|
||||
"description": "The label for category Geyser API in sidebar geyserSidebar"
|
||||
},
|
||||
"sidebar.geyserSidebar.category.Custom Resource Packs": {
|
||||
"message": "Custom Resource Packs",
|
||||
"description": "The label for category Custom Resource Packs in sidebar geyserSidebar"
|
||||
}
|
||||
}
|
||||
@@ -2,5 +2,73 @@
|
||||
"copyright": {
|
||||
"message": "Copyright © 2024 GeyserMC. Built with Docusaurus.",
|
||||
"description": "The footer copyright"
|
||||
},
|
||||
"link.title.Wiki": {
|
||||
"message": "Wiki",
|
||||
"description": "The title of the footer links column with title=Wiki in the footer"
|
||||
},
|
||||
"link.title.Downloads": {
|
||||
"message": "Downloads",
|
||||
"description": "The title of the footer links column with title=Downloads in the footer"
|
||||
},
|
||||
"link.title.Community": {
|
||||
"message": "Community",
|
||||
"description": "The title of the footer links column with title=Community in the footer"
|
||||
},
|
||||
"link.title.More": {
|
||||
"message": "More",
|
||||
"description": "The title of the footer links column with title=More in the footer"
|
||||
},
|
||||
"link.item.label.Geyser": {
|
||||
"message": "Geyser",
|
||||
"description": "The label of footer link with label=Geyser linking to download?project=geyser"
|
||||
},
|
||||
"link.item.label.Floodgate": {
|
||||
"message": "Floodgate",
|
||||
"description": "The label of footer link with label=Floodgate linking to download?project=floodgate"
|
||||
},
|
||||
"link.item.label.REST APIs": {
|
||||
"message": "REST APIs",
|
||||
"description": "The label of footer link with label=REST APIs linking to wiki/api/api.geysermc.org/global-api"
|
||||
},
|
||||
"link.item.label.Other": {
|
||||
"message": "Other",
|
||||
"description": "The label of footer link with label=Other linking to download?project=other-projects"
|
||||
},
|
||||
"link.item.label.Crowdin": {
|
||||
"message": "Crowdin",
|
||||
"description": "The label of footer link with label=Crowdin linking to https://translate.geysermc.org/"
|
||||
},
|
||||
"link.item.label.Discord": {
|
||||
"message": "Discord",
|
||||
"description": "The label of footer link with label=Discord linking to https://discord.gg/geysermc"
|
||||
},
|
||||
"link.item.label.GitHub": {
|
||||
"message": "GitHub",
|
||||
"description": "The label of footer link with label=GitHub linking to https://github.com/GeyserMC/Geyser"
|
||||
},
|
||||
"link.item.label.Reddit": {
|
||||
"message": "Reddit",
|
||||
"description": "The label of footer link with label=Reddit linking to https://www.reddit.com/r/GeyserMC/"
|
||||
},
|
||||
"link.item.label.Twitter": {
|
||||
"message": "Twitter",
|
||||
"description": "The label of footer link with label=Twitter linking to https://twitter.com/Geyser_MC"
|
||||
},
|
||||
"link.item.label.Blog": {
|
||||
"message": "Blog",
|
||||
"description": "The label of footer link with label=Blog linking to blog"
|
||||
},
|
||||
"link.item.label.Donate": {
|
||||
"message": "Donate",
|
||||
"description": "The label of footer link with label=Donate linking to https://opencollective.com/geysermc"
|
||||
},
|
||||
"link.item.label.Global Linking": {
|
||||
"message": "Global Linking",
|
||||
"description": "The label of footer link with label=Global Linking linking to https://link.geysermc.org/"
|
||||
},
|
||||
"logo.alt": {
|
||||
"message": "GeyserMC logo",
|
||||
"description": "The alt text of footer logo"
|
||||
}
|
||||
}
|
||||
+26
-22
@@ -23,30 +23,33 @@
|
||||
"typecheck": "tsc"
|
||||
},
|
||||
"dependencies": {
|
||||
"@docusaurus/core": "^3.4.0",
|
||||
"@docusaurus/preset-classic": "^3.4.0",
|
||||
"@fortawesome/fontawesome-svg-core": "^6.5.1",
|
||||
"@fortawesome/free-brands-svg-icons": "^6.5.1",
|
||||
"@fortawesome/free-regular-svg-icons": "^6.5.1",
|
||||
"@fortawesome/free-solid-svg-icons": "^6.5.1",
|
||||
"@fortawesome/react-fontawesome": "^0.2.0",
|
||||
"@docusaurus/core": "3.6.3",
|
||||
"@docusaurus/preset-classic": "3.6.3",
|
||||
"@fortawesome/fontawesome-svg-core": "6.5.1",
|
||||
"@fortawesome/free-brands-svg-icons": "6.5.1",
|
||||
"@fortawesome/free-regular-svg-icons": "6.5.1",
|
||||
"@fortawesome/free-solid-svg-icons": "6.5.1",
|
||||
"@fortawesome/react-fontawesome": "0.2.0",
|
||||
"@kas-tle/docusaurus-og": "https://github.com/Kas-tle/docusaurus-og",
|
||||
"@mdx-js/react": "^3.0.0",
|
||||
"clsx": "^1.2.1",
|
||||
"docusaurus-plugin-openapi-docs": "^3.0.1",
|
||||
"docusaurus-theme-openapi-docs": "^3.0.1",
|
||||
"prism-react-renderer": "^2.1.0",
|
||||
"react": "^18.0.0",
|
||||
"react-dom": "^18.0.0",
|
||||
"@mdx-js/react": "3.0.0",
|
||||
"clsx": "1.2.1",
|
||||
"docusaurus-plugin-openapi-docs": "4.3.0",
|
||||
"docusaurus-theme-openapi-docs": "4.3.0",
|
||||
"prism-react-renderer": "2.1.0",
|
||||
"react": "18.3.1",
|
||||
"react-dom": "18.3.1",
|
||||
"react-markdown": "^9.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@docusaurus/module-type-aliases": "^3.4.0",
|
||||
"@docusaurus/tsconfig": "^3.4.0",
|
||||
"@docusaurus/types": "^3.4.0",
|
||||
"docusaurus-plugin-sass": "^0.2.5",
|
||||
"sass": "^1.77.8",
|
||||
"typescript": "~5.2.2"
|
||||
"@docusaurus/module-type-aliases": "^3.6.3",
|
||||
"@docusaurus/tsconfig": "^3.6.3",
|
||||
"@docusaurus/types": "^3.6.3",
|
||||
"docusaurus-plugin-sass": "0.2.5",
|
||||
"sass": "1.77.8",
|
||||
"typescript": "5.7.2"
|
||||
},
|
||||
"resolutions": {
|
||||
"postman-code-generators": "1.14.0"
|
||||
},
|
||||
"browserslist": {
|
||||
"production": [
|
||||
@@ -61,6 +64,7 @@
|
||||
]
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=18.0"
|
||||
}
|
||||
"node": ">=22.0"
|
||||
},
|
||||
"packageManager": "yarn@4.5.3"
|
||||
}
|
||||
@@ -1,6 +1,8 @@
|
||||
import { translate } from "@docusaurus/Translate"
|
||||
import { Providers } from "../types/providers"
|
||||
|
||||
// Do not modify the structure of this file without updating the extraction logic in create-providers-json.ts
|
||||
|
||||
const descriptionTemplates = {
|
||||
default: translate({
|
||||
id: 'providers.templates.default',
|
||||
|
||||
File renamed without changes.
@@ -2,38 +2,133 @@ import fs from 'fs';
|
||||
import path from 'path';
|
||||
import { LoadContext, Plugin, PluginOptions } from '@docusaurus/types';
|
||||
import logger from '@docusaurus/logger';
|
||||
import Module from 'module';
|
||||
import ts from "typescript";
|
||||
|
||||
const createProvidersJsonPlugin = (context: LoadContext, options: PluginOptions): Plugin => {
|
||||
return {
|
||||
name: 'docusaurus-plugin-create-providers-json',
|
||||
// Welcome to hell
|
||||
const createProvidersJsonPlugin = (_context: LoadContext, _options: PluginOptions): Plugin => {
|
||||
return {
|
||||
name: 'docusaurus-plugin-create-providers-json',
|
||||
|
||||
async postBuild({ outDir, routes, plugins }) {
|
||||
const originalResolveFilename = Module._resolveFilename
|
||||
async postBuild({ outDir }) {
|
||||
const providersFilePath = path.join(__dirname, '../data/providers.ts');
|
||||
const providersFileContent = fs.readFileSync(providersFilePath, 'utf-8');
|
||||
const providersAst = ts.createSourceFile('providers.ts', providersFileContent, ts.ScriptTarget.Latest, true);
|
||||
|
||||
// This is a hack to allow us to import a custom module instead of the normal translation module
|
||||
Module._resolveFilename = function (request, parent, isMain, options) {
|
||||
if (request == '@docusaurus/Translate') {
|
||||
request = path.resolve(__dirname, 'custom_modules', 'translate.ts');
|
||||
let providersDataNode: ts.ObjectLiteralExpression | null = null;
|
||||
let descriptionTemplatesNode: ts.ObjectLiteralExpression | null = null;
|
||||
|
||||
for (const statement of providersAst.statements) {
|
||||
if (ts.isVariableStatement(statement)) {
|
||||
for (const decl of statement.declarationList.declarations) {
|
||||
if (
|
||||
ts.isIdentifier(decl.name) &&
|
||||
decl.initializer
|
||||
) {
|
||||
if (decl.name.text === 'providersData' && ts.isObjectLiteralExpression(decl.initializer)) {
|
||||
providersDataNode = decl.initializer;
|
||||
} else if (decl.name.text === 'descriptionTemplates' && ts.isObjectLiteralExpression(decl.initializer)) {
|
||||
descriptionTemplatesNode = decl.initializer;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!providersDataNode) {
|
||||
logger.error('Could not find providersData in providers.ts');
|
||||
return;
|
||||
}
|
||||
|
||||
if (!descriptionTemplatesNode) {
|
||||
logger.error('Could not find defaultDescriptions in providers.ts');
|
||||
return;
|
||||
}
|
||||
|
||||
function parseDescriptionTemplates(node: ts.ObjectLiteralExpression): Record<string, string> {
|
||||
const map: Record<string, string> = {};
|
||||
for (const prop of node.properties) {
|
||||
if (ts.isPropertyAssignment(prop) && ts.isIdentifier(prop.name)) {
|
||||
const key = prop.name.text;
|
||||
const val = extractDescription(prop.initializer);
|
||||
map[key] = val || '';
|
||||
}
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
let defaultDescriptionsMap = parseDescriptionTemplates(descriptionTemplatesNode);
|
||||
|
||||
function extractDescription(node: ts.Expression): string {
|
||||
if (ts.isCallExpression(node)) {
|
||||
const expr = node.expression;
|
||||
if (ts.isIdentifier(expr) && expr.text === 'translate') {
|
||||
const arg = node.arguments[0];
|
||||
if (arg && ts.isObjectLiteralExpression(arg)) {
|
||||
for (const prop of arg.properties) {
|
||||
if (
|
||||
ts.isPropertyAssignment(prop) &&
|
||||
ts.isIdentifier(prop.name) &&
|
||||
prop.name.text === 'message' &&
|
||||
ts.isStringLiteral(prop.initializer)
|
||||
) {
|
||||
return prop.initializer.text;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (ts.isPropertyAccessExpression(node)) {
|
||||
if (ts.isIdentifier(node.expression) && node.expression.text === 'descriptionTemplates') {
|
||||
const key = node.name.text;
|
||||
return defaultDescriptionsMap[key] || '';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function parseProvidersArray(prop: ts.PropertyAssignment): {name: string; url: string; description: string;}[] {
|
||||
if (ts.isArrayLiteralExpression(prop.initializer)) {
|
||||
return prop.initializer.elements
|
||||
.filter(ts.isObjectLiteralExpression)
|
||||
.map(element => {
|
||||
let nameVal = '';
|
||||
let urlVal = '';
|
||||
let descVal = '';
|
||||
|
||||
for (const property of element.properties) {
|
||||
if (ts.isPropertyAssignment(property) && ts.isIdentifier(property.name)) {
|
||||
const key = property.name.text;
|
||||
const val = property.initializer;
|
||||
if (key === 'name' && ts.isStringLiteral(val)) {
|
||||
nameVal = val.text;
|
||||
} else if (key === 'url' && ts.isStringLiteral(val)) {
|
||||
urlVal = val.text;
|
||||
} else if (key === 'description') {
|
||||
descVal = extractDescription(val);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return { name: nameVal, url: urlVal, description: descVal };
|
||||
});
|
||||
}
|
||||
return [];
|
||||
}
|
||||
|
||||
let providersJson = {};
|
||||
|
||||
for (const prop of providersDataNode.properties) {
|
||||
if (ts.isPropertyAssignment(prop) && ts.isIdentifier(prop.name)) {
|
||||
providersJson[prop.name.text] = parseProvidersArray(prop);
|
||||
}
|
||||
}
|
||||
|
||||
const dataDir = path.join(outDir, 'data');
|
||||
if (!fs.existsSync(dataDir)) {
|
||||
fs.mkdirSync(dataDir, { recursive: true });
|
||||
}
|
||||
const outputFilePath = path.join(dataDir, 'providers.json');
|
||||
fs.writeFileSync(outputFilePath, JSON.stringify(providersJson, null, 4), 'utf-8');
|
||||
}
|
||||
return originalResolveFilename.call(this, request, parent, isMain, options);
|
||||
};
|
||||
|
||||
// Import the providers data
|
||||
const { providersData } = await import('../data/providers');
|
||||
|
||||
// Restore the original resolve function
|
||||
Module._resolveFilename = originalResolveFilename
|
||||
|
||||
const providersFilePath = path.join(outDir, 'data/providers.json');
|
||||
|
||||
fs.mkdirSync(path.dirname(providersFilePath), { recursive: true });
|
||||
|
||||
fs.writeFileSync(providersFilePath, JSON.stringify(providersData, null, 2), 'utf-8');
|
||||
|
||||
logger.success(`Created providers.json file at ${providersFilePath}`);
|
||||
}
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
export default createProvidersJsonPlugin;
|
||||
+3
-2
@@ -1,12 +1,13 @@
|
||||
{
|
||||
// This file is not used in compilation. It is here just for a nice editor experience.
|
||||
"extends": "@docusaurus/tsconfig",
|
||||
"esModuleInterop": true,
|
||||
"compilerOptions": {
|
||||
"lib": ["DOM", "DOM.Iterable", "ESNext"],
|
||||
"target": "ESNext",
|
||||
"baseUrl": "."
|
||||
},
|
||||
"exclude": [
|
||||
"**/node_modules"
|
||||
"**/node_modules",
|
||||
"build",
|
||||
]
|
||||
}
|
||||
@@ -5,7 +5,7 @@ description: 'Geyser is a bridge between Minecraft: Bedrock Edition and Minecraf
|
||||
---
|
||||
|
||||
import { Versions } from '@site/src/components/Versions'
|
||||
import { useDocById } from '@docusaurus/theme-common/internal'
|
||||
import { useDocById } from '@docusaurus/plugin-content-docs/client'
|
||||
import DocCardList from '@theme/DocCardList'
|
||||
|
||||
# Overview
|
||||
|
||||
@@ -5,7 +5,7 @@ description: 'Other projects or guides not directly referring to Geyser or Flood
|
||||
---
|
||||
|
||||
import DocCardList from '@theme/DocCardList'
|
||||
import { useDocById } from '@docusaurus/theme-common/internal'
|
||||
import { useDocById } from '@docusaurus/plugin-content-docs/client'
|
||||
|
||||
# Overview of Other projects
|
||||
|
||||
|
||||
Reference in new issue
Block a user