Skip to content
This repository has been archived by the owner on Jun 18, 2024. It is now read-only.

Use Starlight instead of GitBook #52

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
Open
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
Binary file removed .gitbook/assets/image (2).png
Binary file not shown.
Binary file not shown.
Binary file not shown.
71 changes: 71 additions & 0 deletions .github/workflows/pages.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@

name: Deploy Astro site to Pages

on:
push:
branches: [ "master" ]

workflow_dispatch:

permissions:
contents: read
pages: write
id-token: write

concurrency:
group: "pages"
cancel-in-progress: false

env:
BUILD_PATH: "."

jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set package manager
id: detect-package-manager
run: |
echo "manager=pnpm" >> $GITHUB_OUTPUT
echo "command=install" >> $GITHUB_OUTPUT
echo "runner=pnpm" >> $GITHUB_OUTPUT
exit 0
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: "20"
- name: Setup pnpm
uses: pnpm/action-setup@v2
with:
version: "latest"
- name: Setup Pages
id: pages
uses: actions/configure-pages@v4
- name: Install dependencies
run: ${{ steps.detect-package-manager.outputs.manager }} ${{ steps.detect-package-manager.outputs.command }}
working-directory: ${{ env.BUILD_PATH }}
- name: Build with Astro
run: |
${{ steps.detect-package-manager.outputs.runner }} astro build \
--site "${{ steps.pages.outputs.origin }}" \
--base "${{ steps.pages.outputs.base_path }}"
working-directory: ${{ env.BUILD_PATH }}
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: ${{ env.BUILD_PATH }}/dist

deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
needs: build
runs-on: ubuntu-latest
name: Deploy
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
.idea
node_modules
.astro
.obsidian
29 changes: 25 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,28 @@
# Presentation
# Minestom Documentation

The goal of this wiki is to familiarize you with our library. The most important concepts are described here, however many are not. You can contact one of the Minestom contributors if you wish to help develop the library or have any questions.
[![Built with Starlight](https://astro.badg.es/v2/built-with-starlight/tiny.svg)](https://starlight.astro.build)

The project Javadoc is currently hosted [here](https://minestom.github.io/Minestom/). Additionally, we do have a [Discord server](https://discord.gg/pkFRvqB) where you can ask anything you want.
This is the documentation for [Minestom](https://github.com/Minestom/Minestom).

If you do not know how you landed here, Minestom is a complete rewrite of the Minecraft server software without any Mojang code. You can learn more about it [here](https://github.com/Minestom/Minestom).
# Install

To install the documentation, you need to install Node and PNPM. Then, clone this repository and run the following command:
```bash
pnpm install
```

# Usage

To start a development server, run the following command:
```bash
pnpm dev
```

To build the documentation, run the following command:
```bash
pnpm astro build
```

# Contributing

See the [contributing file](https://github.com/Minestom/Minestom/blob/master/.github/CONTRIBUTING.md)!
53 changes: 0 additions & 53 deletions SUMMARY.md

This file was deleted.

157 changes: 157 additions & 0 deletions astro.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,157 @@
import { defineConfig } from "astro/config";
import starlight from "@astrojs/starlight";
import { readFileSync } from "fs";
import { parse } from 'yaml'

function document(path, props={}) {
let fullFilenameMDX = `./src/content/docs/${path}.mdx`;
let fullFilename = `./src/content/docs/${path}.md`;

let possibleFiles = [fullFilenameMDX, fullFilename];

path = path.replace(/\/index$/, "");

for (let file of possibleFiles) {
try {
// Read & parse frontmatter
let content = readFileSync(file, "utf-8");
let frontmatter = content.split("---")[1];
let data = parse(frontmatter);

let title = data.title;
return {
link: path,
label: title,
...props
};
} catch (e) {
// ignore
}
}

return {
link: path,
label: path,
...props
};
}

// https://astro.build/config
export default defineConfig({
integrations: [
starlight({
title: "Minestom Wiki",
logo: {
src: "./public/favicon.png",
},
favicon: "/favicon.png",
social: {
github: "https://github.com/Minestom/Minestom",
discord: "https://minestom.net/discord",
},
editLink: {
baseUrl: "https://github.com/Minestom/wiki/edit/master/",
},
customCss: ["./src/content/index.css"],
sidebar: [
{
label: "Presentation",
link: "/",
},
{
label: "Setup",
items: [
document("setup/dependencies"),
document("setup/your-first-server"),
]
},
{
label: "Thread Architecture",
items: [
{
label: "Aquirable API",
items: [
document("thread-architecture/acquirable-api/index"),
document("thread-architecture/acquirable-api/inside-the-api"),
],
collapsed: true,
},
document("thread-architecture/thread-safety"),
]
},
{
label: "World",
items: [
document("world/anvilloader"),
document("world/batch"),
document("world/blocks"),
document("world/chunk-management"),
document("world/coordinates"),
document("world/generation"),
document("world/instances"),
]
},
{
label: "Feature",
items: [
{
label: "Entities",
items: [
document("feature/entities/index"),
document("feature/entities/ai"),
],
collapsed: true,
},
{
label: "Events",
items: [
document("feature/events/index"),
document("feature/events/implementation"),
document("feature/events/server-list-ping"),
],
collapsed: true,
},
{
label: "Map Rendering",
items: [
document("feature/map-rendering/index"),
document("feature/map-rendering/glfwmaprendering"),
],
collapsed: true,
},
document("feature/advancements"),
document("feature/adventure"),
document("feature/commands"),
document("feature/inventories"),
document("feature/items"),
document("feature/open-to-lan"),
document("feature/permissions"),
document("feature/player-skin"),
document("feature/player-uuid"),
document("feature/query"),
document("feature/schedulers"),
document("feature/tags"),
]
},
{
label: "Expansion",
items: [
{
label: "Scripting",
items: [
document("expansion/scripting/index"),
document("expansion/scripting/wip-java-interoperability"),
],
collapsed: true,
},
document("expansion/extensions"),
]
},
],
components: {
MobileMenuToggle: "./src/components/MobileMenuToggle.astro",
MobileTableOfContents: "./src/components/MobileTableOfContents.astro",
}
}),
],
});
4 changes: 0 additions & 4 deletions book.json

This file was deleted.

2 changes: 0 additions & 2 deletions expansion/scripting/wip-commands.md

This file was deleted.

22 changes: 22 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"name": "",
"type": "module",
"version": "0.0.1",
"scripts": {
"dev": "astro dev",
"start": "astro dev",
"build": "astro check && astro build",
"preview": "astro preview",
"astro": "astro"
},
"dependencies": {
"@astrojs/check": "^0.4.1",
"@astrojs/starlight": "^0.16.0",
"astro": "^4.2.1",
"sharp": "^0.32.5",
"typescript": "^5.3.3"
},
"devDependencies": {
"yaml": "^2.3.4"
}
}
Loading