From 344a6332fb3ec78f2750fa62e63a958455e59d4f Mon Sep 17 00:00:00 2001 From: Sylvain Zimmer Date: Tue, 26 Sep 2023 16:15:03 +0200 Subject: [PATCH] Switch documentation website from Nuxt to Astro --- .gitignore | 9 +- CHANGELOG.md | 3 - docs/.gitignore | 21 + docs/README.md | 65 +- docs/assets/css/main.css | 194 - docs/astro.config.mjs | 63 + docs/content/en/changelog.md | 1 - docs/content/settings.json | 5 - docs/nuxt.config.js | 26 - docs/package.json | 35 +- docs/{static => public}/favicon.svg | 0 docs/src/assets/logo-black.svg | 1 + .../images => src/assets}/logo-white.svg | 0 docs/src/content/config.ts | 7 + .../{content => src/content/docs}/cn/index.md | 0 .../content/docs}/configuration/caching.md | 4 +- .../content/docs}/configuration/default.md | 6 +- .../content/docs}/configuration/metrics.md | 4 +- .../content/docs}/configuration/proxy.md | 4 +- .../content/docs}/configuration/security.md | 4 +- .../content/docs}/configuration/server.md | 4 +- .../content/docs}/configuration/users.md | 4 +- docs/{content/en => src/content/docs}/faq.md | 3 - .../content/docs}/getting_started.md | 3 - .../en => src/content/docs}/history.md | 2 - .../{content/en => src/content/docs}/index.md | 13 +- .../en => src/content/docs}/install.md | 2 - .../content/docs}/use-cases/all-use-cases.md | 6 +- .../docs}/use-cases/authorize-users.md | 6 +- .../content/docs}/use-cases/spread-insert.md | 6 +- .../content/docs}/use-cases/spread-select.md | 6 +- .../content/docs}/use-cases/wildcarded.md | 6 +- docs/src/env.d.ts | 2 + docs/src/styles/custom.css | 0 docs/tsconfig.json | 3 + docs/yarn.lock | 9126 +++++------------ 36 files changed, 2914 insertions(+), 6730 deletions(-) create mode 100644 docs/.gitignore delete mode 100644 docs/assets/css/main.css create mode 100644 docs/astro.config.mjs delete mode 120000 docs/content/en/changelog.md delete mode 100644 docs/content/settings.json delete mode 100644 docs/nuxt.config.js rename docs/{static => public}/favicon.svg (100%) create mode 100644 docs/src/assets/logo-black.svg rename docs/{static/images => src/assets}/logo-white.svg (100%) create mode 100644 docs/src/content/config.ts rename docs/{content => src/content/docs}/cn/index.md (100%) rename docs/{content/en => src/content/docs}/configuration/caching.md (99%) rename docs/{content/en => src/content/docs}/configuration/default.md (99%) rename docs/{content/en => src/content/docs}/configuration/metrics.md (99%) rename docs/{content/en => src/content/docs}/configuration/proxy.md (96%) rename docs/{content/en => src/content/docs}/configuration/security.md (97%) rename docs/{content/en => src/content/docs}/configuration/server.md (95%) rename docs/{content/en => src/content/docs}/configuration/users.md (98%) rename docs/{content/en => src/content/docs}/faq.md (94%) rename docs/{content/en => src/content/docs}/getting_started.md (99%) rename docs/{content/en => src/content/docs}/history.md (96%) rename docs/{content/en => src/content/docs}/index.md (94%) rename docs/{content/en => src/content/docs}/install.md (98%) rename docs/{content/en => src/content/docs}/use-cases/all-use-cases.md (95%) rename docs/{content/en => src/content/docs}/use-cases/authorize-users.md (96%) rename docs/{content/en => src/content/docs}/use-cases/spread-insert.md (96%) rename docs/{content/en => src/content/docs}/use-cases/spread-select.md (95%) rename docs/{content/en => src/content/docs}/use-cases/wildcarded.md (93%) create mode 100644 docs/src/env.d.ts create mode 100644 docs/src/styles/custom.css create mode 100644 docs/tsconfig.json diff --git a/.gitignore b/.gitignore index 0287076d..ff44fe7a 100644 --- a/.gitignore +++ b/.gitignore @@ -4,13 +4,10 @@ /tags /dist -# Documentation dependencies and artefacts -/docs/dist -/docs/node_modules -/docs/.output -/docs/.nuxt -/docs/static/sw.js +/docs/src/content/docs/changelog.md + .idea +.vscode # Examples data directories examples/*/resources/chproxy/data diff --git a/CHANGELOG.md b/CHANGELOG.md index 254e9379..db3cf663 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,8 +1,5 @@ --- title: Changelog -menuTitle: Changelog -category: Guides -position: 104 --- Since v1.17.1, chproxy follows [semantic versioning](https://semver.org/). diff --git a/docs/.gitignore b/docs/.gitignore new file mode 100644 index 00000000..6240da8b --- /dev/null +++ b/docs/.gitignore @@ -0,0 +1,21 @@ +# build output +dist/ +# generated types +.astro/ + +# dependencies +node_modules/ + +# logs +npm-debug.log* +yarn-debug.log* +yarn-error.log* +pnpm-debug.log* + + +# environment variables +.env +.env.production + +# macOS-specific files +.DS_Store diff --git a/docs/README.md b/docs/README.md index f837bf32..f95661b5 100644 --- a/docs/README.md +++ b/docs/README.md @@ -1,34 +1,53 @@ -# Chproxy documentation +# Starlight Starter Kit: Basics -The documentation website is build with Nuxt and the official docs theme. +[![Built with Starlight](https://astro.badg.es/v2/built-with-starlight/tiny.svg)](https://starlight.astro.build) -It is automatically deployed on each commit on the `main` branch, through -Render. +``` +npm create astro@latest -- --template starlight +``` -# CONTRIBUTING +[![Open in StackBlitz](https://developer.stackblitz.com/img/open_in_stackblitz.svg)](https://stackblitz.com/github/withastro/starlight/tree/main/examples/basics) +[![Open with CodeSandbox](https://assets.codesandbox.io/github/button-edit-lime.svg)](https://codesandbox.io/p/sandbox/github/withastro/starlight/tree/main/examples/basics) -## Ordering links in the sidebar +> ๐Ÿง‘โ€๐Ÿš€ **Seasoned astronaut?** Delete this file. Have fun! -Each page should be given a unique `position`, that will determine where it will -be positioned in the sidebar. Each page can also have a `category`, to group -similar pages together. +## ๐Ÿš€ Project Structure -Note that the `position` is relative to the top of the sidebar, not to the top -of the parent category. +Inside of your Astro + Starlight project, you'll see the following folders and files: -**Tip:** Span `position` values on various hundreds, so you can more easily -reorder links in a given category. For example, all links in the first category -should be `101`, `102`, etc and links in the third category should be `301`, -`302`, etc. +``` +. +โ”œโ”€โ”€ public/ +โ”œโ”€โ”€ src/ +โ”‚ โ”œโ”€โ”€ assets/ +โ”‚ โ”œโ”€โ”€ content/ +โ”‚ โ”‚ โ”œโ”€โ”€ docs/ +โ”‚ โ”‚ โ””โ”€โ”€ config.ts +โ”‚ โ””โ”€โ”€ env.d.ts +โ”œโ”€โ”€ astro.config.mjs +โ”œโ”€โ”€ package.json +โ””โ”€โ”€ tsconfig.json +``` +Starlight looks for `.md` or `.mdx` files in the `src/content/docs/` directory. Each file is exposed as a route based on its file name. +Images can be added to `src/assets/` and embedded in Markdown with a relative link. -## TODO: +Static assets, like favicons, can be placed in the `public/` directory. -- Configure Render for deployment -- Configure Render for Pull Requests - - Can we make it smart and only re-render if changes in the docs, not if - changes in the code? -- Configure Algolia DocSearch -- Need to add a logo -- Replace the manual copy/paste of files with dynamic links +## ๐Ÿงž Commands + +All commands are run from the root of the project, from a terminal: + +| Command | Action | +| :------------------------ | :----------------------------------------------- | +| `npm install` | Installs dependencies | +| `npm run dev` | Starts local dev server at `localhost:4321` | +| `npm run build` | Build your production site to `./dist/` | +| `npm run preview` | Preview your build locally, before deploying | +| `npm run astro ...` | Run CLI commands like `astro add`, `astro check` | +| `npm run astro -- --help` | Get help using the Astro CLI | + +## ๐Ÿ‘€ Want to learn more? + +Check out [Starlightโ€™s docs](https://starlight.astro.build/), read [the Astro documentation](https://docs.astro.build), or jump into the [Astro Discord server](https://astro.build/chat). diff --git a/docs/assets/css/main.css b/docs/assets/css/main.css deleted file mode 100644 index ab20dd58..00000000 --- a/docs/assets/css/main.css +++ /dev/null @@ -1,194 +0,0 @@ -/** - * The Nuxt doc theme only allows a very minimal amount of color configuration - * (only the color of links). - * To override the default colors with our own, we have to overwrite the CSS - * applied through Tailwind. To make matter worse, very few of the HTML elements - * have semantic class/ids for selection, so we have to do some dirty work and - * select elements by their presentational classes, and overwrite them. - * - * All selectors are prefixed with `body[class]` for artificially make weight - * more than the default Tailwind classes. - **/ -:root { - --chp-background: #1B202B; - --chp-detail: #2F3747; - --chp-text: #A3AEBE; - --chp-header: #FFFFFF; - --chp-accent: #6CC3EA; - --chp-accent-25: #6CC3EA25; -} -/* Main background */ -body[class] { - background-color: var(--chp-background); -} -/* Dark mode switcher (we default to dark mode, and don't really have a light - * mode) */ -body[class] button[aria-label="Color Mode"] { - display: none; -} - -/* Desktop Header - * Identified by nav.fixed - **/ -body[class] nav.fixed { - background-color: var(--chp-background); -} -/* Parent element of the logo link. - * We need to make it take the whole header height so the logo takes the whole - * space as well - **/ -body[class] nav.fixed .h-16 > .pr-4 { - height: 100%; - width: 100%; /* This one is only for mobile */ -} -@media (min-width: 1024px) { - body[class] nav.fixed .h-16 > .pr-4 { - width: 20%; - } -} -/* Logo link */ -body[class] nav.fixed .h-16 > .pr-4 a[href="/"] { - background-image: url("/images/logo-white.svg"); - background-repeat: no-repeat; - height: 100%; -} -/* Header text */ -body[class] nav.fixed .h-16 > .pr-4 a[href="/"] span { - display: none; -} - -/* - * Search bar - * The search bar is identified by input#search. The suggested results are links - * in a