docs: update installation

This commit is contained in:
xfy
2024-12-30 13:32:18 +08:00
parent 0f8e34b39f
commit 050a88b0bd
29 changed files with 574 additions and 19 deletions

View File

@ -7,3 +7,6 @@ end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
[Makefile]
indent_style = tab

3
docs/.prettierignore Normal file
View File

@ -0,0 +1,3 @@
.docusaurus/
build/
node_modules/

20
docs/Makefile Normal file
View File

@ -0,0 +1,20 @@
PACKAGE_MANAGER = pnpm
all: pack
nvm:
fnm use && $(CMD)
deps:
make nvm CMD="$(PACKAGE_MANAGER) i"
fix:
make nvm CMD="$(PACKAGE_MANAGER) i && $(PACKAGE_MANAGER) pretty"
pack:
cp -r docs/* i18n/zh-Hans/docusaurus-plugin-content-docs/current \
&& make nvm CMD="$(PACKAGE_MANAGER) i && $(PACKAGE_MANAGER) build"
# build:
.PHONY: all

View File

@ -0,0 +1,4 @@
{
"label": "配置",
"position": 2
}

View File

@ -0,0 +1,9 @@
---
sidebar_label: 配置文件
sidebar_position: 1
title: 配置文件
---
## 配置文件
Candy 遵循配置文件进行配置。

View File

@ -3,3 +3,23 @@ sidebar_position: 1
---
# 介绍
Candy 是一个轻量级的 HTTP 服务器,旨在快速部署一个高性能的 HTTP 服务器。
## 安装
TODO
## 使用
Candy 支持单个可执行文件运行:
```bash
./target/release/candy -h
Usage: candy [OPTIONS]
Options:
-c, --config <FILE> Sets a custom config file [default: ./config.toml]
-h, --help Print help
-V, --version Print version
```

View File

@ -1,6 +1,6 @@
import { themes as prismThemes } from 'prism-react-renderer';
import type { Config } from '@docusaurus/types';
import type * as Preset from '@docusaurus/preset-classic';
import type { Config } from '@docusaurus/types';
import { themes as prismThemes } from 'prism-react-renderer';
const config: Config = {
title: 'Candy',

313
docs/i18n/en/code.json Normal file
View File

@ -0,0 +1,313 @@
{
"theme.ErrorPageContent.title": {
"message": "This page crashed.",
"description": "The title of the fallback page when the page crashed"
},
"theme.BackToTopButton.buttonAriaLabel": {
"message": "Scroll back to top",
"description": "The ARIA label for the back to top button"
},
"theme.blog.archive.title": {
"message": "Archive",
"description": "The page & hero title of the blog archive page"
},
"theme.blog.archive.description": {
"message": "Archive",
"description": "The page & hero description of the blog archive page"
},
"theme.blog.paginator.navAriaLabel": {
"message": "Blog list page navigation",
"description": "The ARIA label for the blog pagination"
},
"theme.blog.paginator.newerEntries": {
"message": "Newer entries",
"description": "The label used to navigate to the newer blog posts page (previous page)"
},
"theme.blog.paginator.olderEntries": {
"message": "Older entries",
"description": "The label used to navigate to the older blog posts page (next page)"
},
"theme.blog.post.paginator.navAriaLabel": {
"message": "Blog post page navigation",
"description": "The ARIA label for the blog posts pagination"
},
"theme.blog.post.paginator.newerPost": {
"message": "Newer post",
"description": "The blog post button label to navigate to the newer/previous post"
},
"theme.blog.post.paginator.olderPost": {
"message": "Older post",
"description": "The blog post button label to navigate to the older/next post"
},
"theme.tags.tagsPageLink": {
"message": "View all tags",
"description": "The label of the link targeting the tag list page"
},
"theme.colorToggle.ariaLabel": {
"message": "Switch between dark and light mode (currently {mode})",
"description": "The ARIA label for the navbar color mode toggle"
},
"theme.colorToggle.ariaLabel.mode.dark": {
"message": "dark mode",
"description": "The name for the dark color mode"
},
"theme.colorToggle.ariaLabel.mode.light": {
"message": "light mode",
"description": "The name for the light color mode"
},
"theme.docs.breadcrumbs.navAriaLabel": {
"message": "Breadcrumbs",
"description": "The ARIA label for the breadcrumbs"
},
"theme.docs.DocCard.categoryDescription.plurals": {
"message": "1 item|{count} items",
"description": "The default description for a category card in the generated index about how many items this category includes"
},
"theme.docs.paginator.navAriaLabel": {
"message": "Docs pages",
"description": "The ARIA label for the docs pagination"
},
"theme.docs.paginator.previous": {
"message": "Previous",
"description": "The label used to navigate to the previous doc"
},
"theme.docs.paginator.next": {
"message": "Next",
"description": "The label used to navigate to the next doc"
},
"theme.docs.tagDocListPageTitle.nDocsTagged": {
"message": "One doc tagged|{count} docs tagged",
"description": "Pluralized label for \"{count} docs tagged\". Use as much plural forms (separated by \"|\") as your language support (see https://www.unicode.org/cldr/cldr-aux/charts/34/supplemental/language_plural_rules.html)"
},
"theme.docs.tagDocListPageTitle": {
"message": "{nDocsTagged} with \"{tagName}\"",
"description": "The title of the page for a docs tag"
},
"theme.docs.versions.unreleasedVersionLabel": {
"message": "This is unreleased documentation for {siteTitle} {versionLabel} version.",
"description": "The label used to tell the user that he's browsing an unreleased doc version"
},
"theme.docs.versions.unmaintainedVersionLabel": {
"message": "This is documentation for {siteTitle} {versionLabel}, which is no longer actively maintained.",
"description": "The label used to tell the user that he's browsing an unmaintained doc version"
},
"theme.docs.versions.latestVersionSuggestionLabel": {
"message": "For up-to-date documentation, see the {latestVersionLink} ({versionLabel}).",
"description": "The label used to tell the user to check the latest version"
},
"theme.docs.versions.latestVersionLinkLabel": {
"message": "latest version",
"description": "The label used for the latest version suggestion link label"
},
"theme.docs.versionBadge.label": {
"message": "Version: {versionLabel}"
},
"theme.common.editThisPage": {
"message": "Edit this page",
"description": "The link label to edit the current page"
},
"theme.common.headingLinkTitle": {
"message": "Direct link to {heading}",
"description": "Title for link to heading"
},
"theme.NotFound.title": {
"message": "Page Not Found",
"description": "The title of the 404 page"
},
"theme.navbar.mobileVersionsDropdown.label": {
"message": "Versions",
"description": "The label for the navbar versions dropdown on mobile view"
},
"theme.lastUpdated.atDate": {
"message": " on {date}",
"description": "The words used to describe on which date a page has been last updated"
},
"theme.lastUpdated.byUser": {
"message": " by {user}",
"description": "The words used to describe by who the page has been last updated"
},
"theme.lastUpdated.lastUpdatedAtBy": {
"message": "Last updated{atDate}{byUser}",
"description": "The sentence used to display when a page has been last updated, and by who"
},
"theme.tags.tagsListLabel": {
"message": "Tags:",
"description": "The label alongside a tag list"
},
"theme.AnnouncementBar.closeButtonAriaLabel": {
"message": "Close",
"description": "The ARIA label for close button of announcement bar"
},
"theme.admonition.caution": {
"message": "caution",
"description": "The default label used for the Caution admonition (:::caution)"
},
"theme.admonition.danger": {
"message": "danger",
"description": "The default label used for the Danger admonition (:::danger)"
},
"theme.admonition.info": {
"message": "info",
"description": "The default label used for the Info admonition (:::info)"
},
"theme.admonition.note": {
"message": "note",
"description": "The default label used for the Note admonition (:::note)"
},
"theme.admonition.tip": {
"message": "tip",
"description": "The default label used for the Tip admonition (:::tip)"
},
"theme.admonition.warning": {
"message": "warning",
"description": "The default label used for the Warning admonition (:::warning)"
},
"theme.blog.sidebar.navAriaLabel": {
"message": "Blog recent posts navigation",
"description": "The ARIA label for recent posts in the blog sidebar"
},
"theme.CodeBlock.copied": {
"message": "Copied",
"description": "The copied button label on code blocks"
},
"theme.CodeBlock.copyButtonAriaLabel": {
"message": "Copy code to clipboard",
"description": "The ARIA label for copy code blocks button"
},
"theme.CodeBlock.copy": {
"message": "Copy",
"description": "The copy button label on code blocks"
},
"theme.CodeBlock.wordWrapToggle": {
"message": "Toggle word wrap",
"description": "The title attribute for toggle word wrapping button of code block lines"
},
"theme.DocSidebarItem.expandCategoryAriaLabel": {
"message": "Expand sidebar category '{label}'",
"description": "The ARIA label to expand the sidebar category"
},
"theme.DocSidebarItem.collapseCategoryAriaLabel": {
"message": "Collapse sidebar category '{label}'",
"description": "The ARIA label to collapse the sidebar category"
},
"theme.NavBar.navAriaLabel": {
"message": "Main",
"description": "The ARIA label for the main navigation"
},
"theme.NotFound.p1": {
"message": "We could not find what you were looking for.",
"description": "The first paragraph of the 404 page"
},
"theme.NotFound.p2": {
"message": "Please contact the owner of the site that linked you to the original URL and let them know their link is broken.",
"description": "The 2nd paragraph of the 404 page"
},
"theme.navbar.mobileLanguageDropdown.label": {
"message": "Languages",
"description": "The label for the mobile language switcher dropdown"
},
"theme.TOCCollapsible.toggleButtonLabel": {
"message": "On this page",
"description": "The label used by the button on the collapsible TOC component"
},
"theme.blog.post.readMore": {
"message": "Read more",
"description": "The label used in blog post item excerpts to link to full blog posts"
},
"theme.blog.post.readMoreLabel": {
"message": "Read more about {title}",
"description": "The ARIA label for the link to full blog posts from excerpts"
},
"theme.blog.post.readingTime.plurals": {
"message": "One min read|{readingTime} min read",
"description": "Pluralized label for \"{readingTime} min read\". Use as much plural forms (separated by \"|\") as your language support (see https://www.unicode.org/cldr/cldr-aux/charts/34/supplemental/language_plural_rules.html)"
},
"theme.docs.breadcrumbs.home": {
"message": "Home page",
"description": "The ARIA label for the home page in the breadcrumbs"
},
"theme.docs.sidebar.collapseButtonTitle": {
"message": "Collapse sidebar",
"description": "The title attribute for collapse button of doc sidebar"
},
"theme.docs.sidebar.collapseButtonAriaLabel": {
"message": "Collapse sidebar",
"description": "The title attribute for collapse button of doc sidebar"
},
"theme.docs.sidebar.navAriaLabel": {
"message": "Docs sidebar",
"description": "The ARIA label for the sidebar navigation"
},
"theme.docs.sidebar.closeSidebarButtonAriaLabel": {
"message": "Close navigation bar",
"description": "The ARIA label for close button of mobile sidebar"
},
"theme.navbar.mobileSidebarSecondaryMenu.backButtonLabel": {
"message": "← Back to main menu",
"description": "The label of the back button to return to main menu, inside the mobile navbar sidebar secondary menu (notably used to display the docs sidebar)"
},
"theme.docs.sidebar.toggleSidebarButtonAriaLabel": {
"message": "Toggle navigation bar",
"description": "The ARIA label for hamburger menu button of mobile navigation"
},
"theme.docs.sidebar.expandButtonTitle": {
"message": "Expand sidebar",
"description": "The ARIA label and title attribute for expand button of doc sidebar"
},
"theme.docs.sidebar.expandButtonAriaLabel": {
"message": "Expand sidebar",
"description": "The ARIA label and title attribute for expand button of doc sidebar"
},
"theme.blog.post.plurals": {
"message": "One post|{count} posts",
"description": "Pluralized label for \"{count} posts\". Use as much plural forms (separated by \"|\") as your language support (see https://www.unicode.org/cldr/cldr-aux/charts/34/supplemental/language_plural_rules.html)"
},
"theme.blog.tagTitle": {
"message": "{nPosts} tagged with \"{tagName}\"",
"description": "The title of the page for a blog tag"
},
"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"
},
"theme.ErrorPageContent.tryAgain": {
"message": "Try again",
"description": "The label of the button to try again rendering when the React error boundary captures an error"
},
"theme.common.skipToMainContent": {
"message": "Skip to main content",
"description": "The skip to content label used for accessibility, allowing to rapidly navigate to main content with keyboard tab/enter navigation"
},
"theme.tags.tagsPageTitle": {
"message": "Tags",
"description": "The title of the tag list page"
}
}

View File

@ -0,0 +1,14 @@
{
"title": {
"message": "Blog",
"description": "The title for the blog used in SEO"
},
"description": {
"message": "Blog",
"description": "The description for the blog used in SEO"
},
"sidebar.title": {
"message": "Recent posts",
"description": "The label for the left sidebar"
}
}

View File

@ -0,0 +1,10 @@
{
"version.label": {
"message": "Next",
"description": "The label for version current"
},
"sidebar.tutorialSidebar.category.配置": {
"message": "配置",
"description": "The label for category 配置 in sidebar tutorialSidebar"
}
}

View File

@ -0,0 +1,4 @@
{
"label": "Configuration",
"position": 2
}

View File

@ -0,0 +1,9 @@
---
sidebar_label: Config File
sidebar_position: 1
title: Config File
---
## Config File
Candy follows the config file to configure.

View File

@ -0,0 +1,25 @@
---
sidebar_position: 1
---
# Introduction
Candy is a lightweight HTTP server, aiming to quickly deploy a high-performance HTTP server.
## Installation
TODO
## Usage
Candy supports single executable file running:
```bash
./target/release/candy -h
Usage: candy [OPTIONS]
Options:
-c, --config <FILE> Sets a custom config file [default: ./config.toml]
-h, --help Print help
-V, --version Print version
```

View File

@ -0,0 +1,6 @@
{
"copyright": {
"message": "Copyright © 2024 Candy, Inc. Built with Docusaurus.",
"description": "The footer copyright"
}
}

View File

@ -0,0 +1,22 @@
{
"title": {
"message": "RUA",
"description": "The title in the navbar"
},
"logo.alt": {
"message": "My Site Logo",
"description": "The alt text of navbar logo"
},
"item.label.Tutorial": {
"message": "Tutorial",
"description": "Navbar item with label Tutorial"
},
"item.label.Blog": {
"message": "Blog",
"description": "Navbar item with label Blog"
},
"item.label.GitHub": {
"message": "GitHub",
"description": "Navbar item with label GitHub"
}
}

View File

@ -0,0 +1,4 @@
{
"label": "配置",
"position": 2
}

View File

@ -0,0 +1,5 @@
---
sidebar_position: 1
---
## 配置文件

View File

@ -2,5 +2,9 @@
"version.label": {
"message": "Next",
"description": "The label for version current"
},
"sidebar.tutorialSidebar.category.配置": {
"message": "配置",
"description": "The label for category 配置 in sidebar tutorialSidebar"
}
}

View File

@ -0,0 +1,4 @@
{
"label": "配置",
"position": 2
}

View File

@ -0,0 +1,9 @@
---
sidebar_label: 配置文件
sidebar_position: 1
title: 配置文件
---
## 配置文件
Candy 遵循配置文件进行配置。

View File

@ -0,0 +1,25 @@
---
sidebar_position: 1
---
# 介绍
Candy 是一个轻量级的 HTTP 服务器,旨在快速部署一个高性能的 HTTP 服务器。
## 安装
TODO
## 使用
Candy 支持单个可执行文件运行:
```bash
./target/release/candy -h
Usage: candy [OPTIONS]
Options:
-c, --config <FILE> Sets a custom config file [default: ./config.toml]
-h, --help Print help
-V, --version Print version
```

View File

@ -0,0 +1,7 @@
---
sidebar_position: 1
---
# 介绍
Candy 是一个轻量级的 HTTP 服务器,旨在快速部署一个高性能的 HTTP 服务器。

View File

@ -4,11 +4,11 @@
"description": "The title in the navbar"
},
"logo.alt": {
"message": "My Site Logo",
"message": "Candy logo",
"description": "The alt text of navbar logo"
},
"item.label.Tutorial": {
"message": "Tutorial",
"message": "文档",
"description": "Navbar item with label Tutorial"
},
"item.label.Blog": {

View File

@ -6,15 +6,17 @@
"docusaurus": "docusaurus",
"start": "docusaurus start",
"start-zh": "docusaurus start --locale zh-Hans",
"build": "docusaurus write-translations && docusaurus write-translations --locale zh-Hans && docusaurus write-heading-ids && docusaurus build",
"build": "docusaurus write-translations --locale en && docusaurus write-translations --locale zh-Hans && docusaurus build",
"swizzle": "docusaurus swizzle",
"deploy": "docusaurus deploy",
"clear": "docusaurus clear",
"serve": "docusaurus serve",
"write-translations": "docusaurus write-translations",
"write-translations-zh": "docusaurus write-translations --locale zh-Hans",
"write-translations": "docusaurus write-translations --locale zh-Hans",
"write-translations-en": "docusaurus write-translations --locale en",
"write-heading-ids": "docusaurus write-heading-ids",
"typecheck": "tsc"
"pretty": "prettier --cache --write \"./**/*.{js,jsx,ts,tsx,json,md,mdx,css}\" --ignore-unknown --plugin=prettier-plugin-organize-imports",
"pretty-check": "prettier --cache \"./**/*.{js,jsx,ts,tsx,json,md,mdx,css}\" --ignore-unknown --check --plugin=prettier-plugin-organize-imports",
"tsc": "tsc"
},
"dependencies": {
"@docusaurus/core": "3.6.3",
@ -30,6 +32,8 @@
"@docusaurus/module-type-aliases": "3.6.3",
"@docusaurus/tsconfig": "3.6.3",
"@docusaurus/types": "3.6.3",
"prettier": "^3.4.2",
"prettier-plugin-organize-imports": "^4.1.0",
"typescript": "~5.7.2"
},
"browserslist": {

28
docs/pnpm-lock.yaml generated
View File

@ -42,6 +42,12 @@ importers:
'@docusaurus/types':
specifier: 3.6.3
version: 3.6.3(@swc/core@1.9.3)(acorn@8.14.0)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)
prettier:
specifier: ^3.4.2
version: 3.4.2
prettier-plugin-organize-imports:
specifier: ^4.1.0
version: 4.1.0(prettier@3.4.2)(typescript@5.7.2)
typescript:
specifier: ~5.7.2
version: 5.7.2
@ -4339,6 +4345,21 @@ packages:
resolution: {integrity: sha512-OCVPnIObs4N29kxTjzLfUryOkvZEq+pf8jTF0lg8E7uETuWHA+v7j3c/xJmiqpX450191LlmZfUKkXxkTry7nA==}
engines: {node: ^10 || ^12 || >=14}
prettier-plugin-organize-imports@4.1.0:
resolution: {integrity: sha512-5aWRdCgv645xaa58X8lOxzZoiHAldAPChljr/MT0crXVOWTZ+Svl4hIWlz+niYSlO6ikE5UXkN1JrRvIP2ut0A==}
peerDependencies:
prettier: '>=2.0'
typescript: '>=2.9'
vue-tsc: ^2.1.0
peerDependenciesMeta:
vue-tsc:
optional: true
prettier@3.4.2:
resolution: {integrity: sha512-e9MewbtFo+Fevyuxn/4rrcDAaq0IYxPGLvObpQjiZBMAzB9IGmzlnG9RZy3FFas+eBMu2vA0CszMeduow5dIuQ==}
engines: {node: '>=14'}
hasBin: true
pretty-error@4.0.0:
resolution: {integrity: sha512-AoJ5YMAcXKYxKhuJGdcvse+Voc6v1RgnsR3nWcYU7q4t6z0Q6T86sv5Zq8VIRbOWWFpvdGE83LtdSMNd+6Y0xw==}
@ -10848,6 +10869,13 @@ snapshots:
picocolors: 1.1.1
source-map-js: 1.2.1
prettier-plugin-organize-imports@4.1.0(prettier@3.4.2)(typescript@5.7.2):
dependencies:
prettier: 3.4.2
typescript: 5.7.2
prettier@3.4.2: {}
pretty-error@4.0.0:
dependencies:
lodash: 4.17.21

View File

@ -1,4 +1,4 @@
import type {SidebarsConfig} from '@docusaurus/plugin-content-docs';
import type { SidebarsConfig } from '@docusaurus/plugin-content-docs';
/**
* Creating a sidebar enables you to:
@ -12,7 +12,7 @@ import type {SidebarsConfig} from '@docusaurus/plugin-content-docs';
*/
const sidebars: SidebarsConfig = {
// By default, Docusaurus generates a sidebar from the docs folder structure
tutorialSidebar: [{type: 'autogenerated', dirName: '.'}],
tutorialSidebar: [{ type: 'autogenerated', dirName: '.' }],
// But you can create a sidebar manually
/*

View File

@ -1,5 +1,5 @@
import clsx from 'clsx';
import Heading from '@theme/Heading';
import clsx from 'clsx';
import styles from './styles.module.css';
type FeatureItem = {
@ -41,7 +41,7 @@ const FeatureList: FeatureItem[] = [
},
];
function Feature({title, Svg, description}: FeatureItem) {
function Feature({ title, Svg, description }: FeatureItem) {
return (
<div className={clsx('col col--4')}>
<div className="text--center">

View File

@ -1,14 +1,14 @@
import clsx from 'clsx';
import Link from '@docusaurus/Link';
import useDocusaurusContext from '@docusaurus/useDocusaurusContext';
import Layout from '@theme/Layout';
import HomepageFeatures from '@site/src/components/HomepageFeatures';
import Heading from '@theme/Heading';
import Layout from '@theme/Layout';
import clsx from 'clsx';
import styles from './index.module.css';
function HomepageHeader() {
const {siteConfig} = useDocusaurusContext();
const { siteConfig } = useDocusaurusContext();
return (
<header className={clsx('hero hero--primary', styles.heroBanner)}>
<div className="container">
@ -19,7 +19,8 @@ function HomepageHeader() {
<div className={styles.buttons}>
<Link
className="button button--secondary button--lg"
to="/docs/intro">
to="/docs/intro"
>
Docusaurus Tutorial - 5min
</Link>
</div>
@ -29,11 +30,12 @@ function HomepageHeader() {
}
export default function Home(): JSX.Element {
const {siteConfig} = useDocusaurusContext();
const { siteConfig } = useDocusaurusContext();
return (
<Layout
title={`Hello from ${siteConfig.title}`}
description="Description will go into a meta tag in <head />">
description="Description will go into a meta tag in <head />"
>
<HomepageHeader />
<main>
<HomepageFeatures />