Skip to content

Commit b1f1cb7

Browse files
docs: add new website using Astro Starlight (#5246)
* docs: add new website using Astro Starlight * chore: add docs command to package.json * Add supporters.js dependencies * add root-level install to npm run docs * remove question mark * docs-next/netlify.toml * console.log(process.env) * Don't have /next base in Netlify * More proper astro.config.mjs * linting * Smaller title * Dark mode fixups * Slightly darker sl-color-white * Mentioned this being WIP * Missing _ * Tweaked notice * Tweaked notice colors * Tweaked notice text * fix /api and /example/tests.html links * fix: responsive homepage title * fix: sized responsive homepage title * Added <Head> override for mocha-thumbnail.svg * Added starting buttons * fix: starting buttons config link * fix: starting buttons 'ing' * Footer mobile responsiveness, and root netlify.toml revert * Simpler, more accurate test file * chore: rm docs-next/pnpm-lock.yaml * chore: docs-next should not have pnpm at all * docs: generate, not prebuild * Apply suggestions from code review Co-authored-by: Mark Wiemer <[email protected]> * First round of feedback updates * Missed a sidebar heading title * Update docs-next/src/content/docs/index.mdx Co-authored-by: Mark Wiemer <[email protected]> --------- Co-authored-by: Mark Wiemer <[email protected]>
1 parent 945d6e3 commit b1f1cb7

File tree

98 files changed

+12437
-4
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

98 files changed

+12437
-4
lines changed

docs-next/.gitignore

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
.astro/
2+
dist/
3+
node_modules/
4+
src/content/data/supporters.json

docs-next/.prettierrc.json

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"bracketSpacing": true
3+
}

docs-next/README.md

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# Mocha Docs vNext: Built on Astro Starlight
2+
3+
After `cd`ing into this directory:
4+
5+
```shell
6+
npm i
7+
npm run generate
8+
npm run dev
9+
```

docs-next/astro.config.ts

+124
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,124 @@
1+
import { defineConfig } from "astro/config";
2+
import starlight from "@astrojs/starlight";
3+
4+
export default defineConfig({
5+
// For now, this is only being deployed to mocha-docs-next.netlify.app.
6+
// Soon we'll move it onto mochajs.org/next.
7+
...(!process.env.NETLIFY_BUILD_BASE && { base: "/next" }),
8+
integrations: [
9+
starlight({
10+
components: {
11+
Footer: "./src/components/Footer.astro",
12+
Head: "./src/components/Head.astro",
13+
PageTitle: "./src/components/PageTitle.astro",
14+
},
15+
customCss: ["./src/style/custom.css"],
16+
logo: {
17+
dark: "./src/components/icon-dark.svg",
18+
light: "./src/components/icon-light.svg",
19+
},
20+
sidebar: [
21+
{ label: "Getting Started", slug: "getting-started" },
22+
{
23+
items: [
24+
{ label: "CLI", slug: "running/cli" },
25+
{ label: "Configuring", slug: "running/configuring" },
26+
{ label: "Editor plugins", slug: "running/editor-plugins" },
27+
{ label: "Browsers", slug: "running/browsers" },
28+
{ label: "Test globs", slug: "running/test-globs" },
29+
],
30+
label: "Running Mocha",
31+
},
32+
{
33+
items: [
34+
{ label: "Dynamic tests", slug: "declaring/dynamic-tests" },
35+
{ label: "Exclusive tests", slug: "declaring/exclusive-tests" },
36+
{ label: "Inclusive tests", slug: "declaring/inclusive-tests" },
37+
{ label: "Pending tests", slug: "declaring/pending-tests" },
38+
{ label: "Retrying tests", slug: "declaring/retrying-tests" },
39+
],
40+
label: "Declaring Tests",
41+
},
42+
{
43+
items: [
44+
{ label: "Arrow functions", slug: "features/arrow-functions" },
45+
{ label: "Assertions", slug: "features/assertions" },
46+
{ label: "Asynchronous code", slug: "features/asynchronous-code" },
47+
{ label: "Error codes", slug: "features/error-codes" },
48+
{ label: "Global fixtures", slug: "features/global-fixtures" },
49+
{ label: "Hooks", slug: "features/hooks" },
50+
{ label: "Parallel mode", slug: "features/parallel-mode" },
51+
{ label: "Root hook plugins", slug: "features/root-hook-plugins" },
52+
{ label: "Timeouts", slug: "features/timeouts" },
53+
],
54+
label: "Features",
55+
},
56+
{
57+
collapsed: true,
58+
items: [
59+
{ label: "BDD (default)", slug: "interfaces/bdd" },
60+
{ label: "TDD", slug: "interfaces/tdd" },
61+
{ label: "Exports", slug: "interfaces/exports" },
62+
{ label: "QUnit", slug: "interfaces/qunit" },
63+
{ label: "Require", slug: "interfaces/require" },
64+
{ label: "Third-Party", slug: "interfaces/third-party" },
65+
],
66+
label: "Interfaces",
67+
},
68+
{
69+
collapsed: true,
70+
items: [
71+
{ label: "Spec (default)", slug: "reporters/spec" },
72+
{ label: "Doc", slug: "reporters/doc" },
73+
{ label: "Dot", slug: "reporters/dot" },
74+
{ label: "HTML", slug: "reporters/html" },
75+
{ label: "JSON Stream", slug: "reporters/json-stream" },
76+
{ label: "JSON", slug: "reporters/json" },
77+
{ label: "Landing", slug: "reporters/landing" },
78+
{ label: "List", slug: "reporters/list" },
79+
{ label: "Markdown", slug: "reporters/markdown" },
80+
{ label: "Min", slug: "reporters/min" },
81+
{ label: "Nyan", slug: "reporters/nyan" },
82+
{ label: "Progress", slug: "reporters/progress" },
83+
{ label: "Tap", slug: "reporters/tap" },
84+
{ label: "XUnit", slug: "reporters/xunit" },
85+
{ label: "Third-Party", slug: "reporters/third-party" },
86+
],
87+
label: "Reporters",
88+
},
89+
{
90+
collapsed: true,
91+
items: [
92+
{
93+
label: "Detecting multiple calls to done()",
94+
slug: "explainers/detecting-multiple-calls-to-done",
95+
},
96+
{
97+
label: "Node.js native ESM support",
98+
slug: "explainers/nodejs-native-esm-support",
99+
},
100+
{
101+
label: "Run cycle overview",
102+
slug: "explainers/run-cycle-overview",
103+
},
104+
{ label: "Test duration", slug: "explainers/test-duration" },
105+
{
106+
label: "Test fixture decision tree",
107+
slug: "explainers/test-fixture-decision-tree",
108+
},
109+
],
110+
label: "Explainers",
111+
},
112+
{
113+
label: "API",
114+
link: "https://mochajs.org/api",
115+
},
116+
],
117+
social: {
118+
discord: "https://discord.gg/KeDn2uXhER",
119+
github: "https://github.com/mochajs/mocha",
120+
},
121+
title: "Mocha",
122+
}),
123+
],
124+
});

docs-next/netlify.toml

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
[build]
2+
command = "npm run docs"
3+
publish = "dist/"
4+
5+
[build.environment]
6+
DEBUG = "mocha:docs*"
7+
NODE_VERSION = "20"
8+
9+
[context.deploy-preview]
10+
command = "npm run docs"
11+
publish = "dist/"

0 commit comments

Comments
 (0)