Skip to content

Commit

Permalink
chore: replatform docs site to Astro + Starlight
Browse files Browse the repository at this point in the history
I tried to resist the temptation to fix other tech debt here (untyped JS, etc.).
  • Loading branch information
serhalp committed Jan 22, 2025
1 parent da7f42e commit 4140021
Show file tree
Hide file tree
Showing 55 changed files with 7,769 additions and 23,857 deletions.
16 changes: 0 additions & 16 deletions .github/workflows/docsearch.yml

This file was deleted.

3 changes: 1 addition & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,8 @@ vendor
/.netlify

# site
test-site
site/dist
site-cra
site/.astro/
site/src/**/*.md

# tests
Expand Down
2 changes: 2 additions & 0 deletions docs/commands/api.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
---
title: Netlify CLI api command
sidebar:
label: api
---

# `api`
Expand Down
2 changes: 2 additions & 0 deletions docs/commands/blobs.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
---
title: Netlify CLI blobs command
sidebar:
label: blobs
description: Manage objects in Netlify Blobs
---

Expand Down
2 changes: 2 additions & 0 deletions docs/commands/build.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
---
title: Netlify CLI build command
sidebar:
label: build
---

# `build`
Expand Down
2 changes: 2 additions & 0 deletions docs/commands/completion.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
---
title: Netlify CLI completion command
sidebar:
label: completion
description: Shell completion script for netlify CLI
---

Expand Down
2 changes: 2 additions & 0 deletions docs/commands/deploy.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
---
title: Netlify CLI deploy command
sidebar:
label: deploy
---

# `deploy`
Expand Down
2 changes: 2 additions & 0 deletions docs/commands/dev.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
---
title: Netlify CLI dev command
sidebar:
label: dev
description: Run netlify dev locally
---

Expand Down
2 changes: 2 additions & 0 deletions docs/commands/env.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
---
title: Netlify CLI env command
sidebar:
label: env
description: Control environment variables for the current site
---

Expand Down
2 changes: 2 additions & 0 deletions docs/commands/functions.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
---
title: Netlify CLI functions command
sidebar:
label: functions
description: Run netlify dev locally
---

Expand Down
2 changes: 2 additions & 0 deletions docs/commands/init.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
---
title: Netlify CLI init command
sidebar:
label: init
description: Initialize a new site locally
---

Expand Down
2 changes: 2 additions & 0 deletions docs/commands/integration.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
---
title: Netlify CLI integration command
sidebar:
label: integration
description: Create, develop, and deploy integrations.
---

Expand Down
2 changes: 2 additions & 0 deletions docs/commands/link.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
---
title: Netlify CLI link command
sidebar:
label: link
description: Link an existing site to a local site directory
---

Expand Down
2 changes: 2 additions & 0 deletions docs/commands/login.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
---
title: Netlify CLI login command
sidebar:
label: login
description: Login to your Netlify account
---

Expand Down
2 changes: 2 additions & 0 deletions docs/commands/logout.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
---
title: Netlify CLI logout command
sidebar:
label: logout
description: Login to your Netlify account
hidden: true
---
Expand Down
2 changes: 2 additions & 0 deletions docs/commands/logs.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
---
title: Netlify CLI logs command
sidebar:
label: logs
---

# `logs`
Expand Down
2 changes: 2 additions & 0 deletions docs/commands/open.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
---
title: Netlify CLI open command
sidebar:
label: open
---

# `open`
Expand Down
2 changes: 2 additions & 0 deletions docs/commands/recipes.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
---
title: Netlify CLI recipes command
sidebar:
label: recipes
---

# `recipes`
Expand Down
2 changes: 2 additions & 0 deletions docs/commands/serve.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
---
title: Netlify CLI serve command
sidebar:
label: serve
description: (Beta) Build the site for production and serve locally. This does not watch the code for changes, so if you need to rebuild your site then you must exit and run `serve` again.
---

Expand Down
2 changes: 2 additions & 0 deletions docs/commands/sites.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
---
title: Netlify CLI sites command
sidebar:
label: sites
description: Manage Netlify sites via the command line
---

Expand Down
2 changes: 2 additions & 0 deletions docs/commands/status.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
---
title: Netlify CLI status command
sidebar:
label: status
description: Get the current context of the netlify CLI
---

Expand Down
2 changes: 2 additions & 0 deletions docs/commands/switch.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
---
title: Netlify CLI switch command
sidebar:
label: switch
description: Switch your active Netlify account
---

Expand Down
2 changes: 2 additions & 0 deletions docs/commands/unlink.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
---
title: Netlify CLI unlink command
sidebar:
label: unlink
description: Link an existing site to a local site directory
---

Expand Down
2 changes: 2 additions & 0 deletions docs/commands/watch.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
---
title: Netlify CLI watch command
sidebar:
label: watch
description: Watch for site deploy to finish
---

Expand Down
2 changes: 0 additions & 2 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ title: Netlify CLI command reference
description: All Netlify CLI commands
---

# Netlify CLI command reference

To get a list of commands, run

```
Expand Down
5 changes: 0 additions & 5 deletions netlify.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,6 @@
# This is the directory is publishing to netlify's CDN
publish = "site/dist"

[build.environment]
# cannot use node 18, as we use x0 which uses webpack 4
NODE_VERSION = "16"
AWS_LAMBDA_JS_RUNTIME = "nodejs16.x"

[functions]
# Sets a custom directory for Netlify Functions
directory = "functions"
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
"test:ci:vitest:unit": "vitest run --coverage tests/unit/",
"test:ci:vitest:integration": "vitest run --coverage tests/integration/",
"e2e": "node ./tools/e2e/run.js",
"docs": "node ./site/scripts/docs.mjs",
"docs": "pushd site && npm run build && popd",
"watch": "c8 --reporter=lcov vitest --watch",
"site:build": "run-s site:build:*",
"site:build:install": "cd site && npm install --no-audit",
Expand Down
57 changes: 57 additions & 0 deletions site/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
# Netlify CLI docs site

[![Built with Starlight](https://astro.badg.es/v2/built-with-starlight/tiny.svg)](https://starlight.astro.build)

## Architecture

All the command reference pages and the list of commands are automatically generated from the CLI code. This is
automatically inserted into the existing, committed, semi-manually-written pages in `../docs/`. Here's how the flow
works:

1. The `docs.js` script replaces the content between the auto-generation marker comments in the files in `../docs/`; the
rest you can update manually.
2. The `sync.js` script copies these over to this Astro Starlight site, into `src/content/docs/`. It may also perform
some minor transformations.
3. From there, it's any old Astro/Starlight docs site, as documented.

## πŸš€ Project Structure

Inside of your Astro + Starlight project, you'll see the following folders and files:

```
.
β”œβ”€β”€ public/
β”œβ”€β”€ src/
β”‚ β”œβ”€β”€ assets/
β”‚ β”œβ”€β”€ content/
β”‚ β”‚ β”œβ”€β”€ docs/
β”‚ └── content.config.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.

Static assets, like favicons, can be placed in the `public/` directory.

## 🧞 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:docs-md` | Generate the Markdown command pages from code |
| `npm run build:docs-md` | Generate the Markdown command pages from code and sync them into this site's pages |
| `npm run build` | Build your production site to `./dist/` |
| `npm run preview` | Preview your build locally, before deploying |

## πŸ‘€ 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).
18 changes: 0 additions & 18 deletions site/algolia/config.json

This file was deleted.

Loading

0 comments on commit 4140021

Please sign in to comment.