Skip to content

Commit 82690be

Browse files
docs(misc): add base astro setup for docs (#32058)
Add the base docs website built with Astro. --------- Co-authored-by: Caleb Ukle <caleb@nrwl.io>
1 parent d0cbfec commit 82690be

113 files changed

Lines changed: 58430 additions & 293 deletions

File tree

Some content is hidden

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

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,3 +108,4 @@ tasks/
108108
# Upstream docs local configuration (machine-specific)
109109
.upstreamdocs.local.json
110110

111+
astro-docs/.netlify

astro-docs/.gitignore

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# build output
2+
dist/
3+
# generated types
4+
.astro/
5+
6+
# dependencies
7+
node_modules/
8+
9+
# logs
10+
npm-debug.log*
11+
yarn-debug.log*
12+
yarn-error.log*
13+
pnpm-debug.log*
14+
15+
16+
# environment variables
17+
.env
18+
.env.production
19+
20+
# macOS-specific files
21+
.DS_Store
22+
23+
# Local Netlify folder
24+
.netlify

astro-docs/README.md

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
# Starlight Starter Kit: Basics
2+
3+
[![Built with Starlight](https://astro.badg.es/v2/built-with-starlight/tiny.svg)](https://starlight.astro.build)
4+
5+
```
6+
pnpm create astro@latest -- --template starlight
7+
```
8+
9+
[![Open in StackBlitz](https://developer.stackblitz.com/img/open_in_stackblitz.svg)](https://stackblitz.com/github/withastro/starlight/tree/main/examples/basics)
10+
[![Open with CodeSandbox](https://assets.codesandbox.io/github/button-edit-lime.svg)](https://codesandbox.io/p/sandbox/github/withastro/starlight/tree/main/examples/basics)
11+
[![Deploy to Netlify](https://www.netlify.com/img/deploy/button.svg)](https://app.netlify.com/start/deploy?repository=https://github.com/withastro/starlight&create_from_path=examples/basics)
12+
[![Deploy with Vercel](https://vercel.com/button)](https://vercel.com/new/clone?repository-url=https%3A%2F%2Fgithub.com%2Fwithastro%2Fstarlight%2Ftree%2Fmain%2Fexamples%2Fbasics&project-name=my-starlight-docs&repository-name=my-starlight-docs)
13+
14+
> 🧑‍🚀 **Seasoned astronaut?** Delete this file. Have fun!
15+
16+
## 🚀 Project Structure
17+
18+
Inside of your Astro + Starlight project, you'll see the following folders and files:
19+
20+
```
21+
.
22+
├── public/
23+
├── src/
24+
│ ├── assets/
25+
│ ├── content/
26+
│ │ ├── docs/
27+
│ └── content.config.ts
28+
├── astro.config.mjs
29+
├── package.json
30+
└── tsconfig.json
31+
```
32+
33+
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.
34+
35+
Images can be added to `src/assets/` and embedded in Markdown with a relative link.
36+
37+
Static assets, like favicons, can be placed in the `public/` directory.
38+
39+
## 🧞 Commands
40+
41+
All commands are run from the root of the project, from a terminal:
42+
43+
| Command | Action |
44+
| :--------------------- | :----------------------------------------------- |
45+
| `pnpm install` | Installs dependencies |
46+
| `pnpm dev` | Starts local dev server at `localhost:4321` |
47+
| `pnpm build` | Build your production site to `./dist/` |
48+
| `pnpm preview` | Preview your build locally, before deploying |
49+
| `pnpm astro ...` | Run CLI commands like `astro add`, `astro check` |
50+
| `pnpm astro -- --help` | Get help using the Astro CLI |
51+
52+
## 👀 Want to learn more?
53+
54+
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).

astro-docs/astro.config.mjs

Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
// @ts-check
2+
import { defineConfig } from 'astro/config';
3+
import starlight from '@astrojs/starlight';
4+
import { sectionSidebarPlugin } from './src/plugins/section-sidebar.plugin';
5+
import netlify from '@astrojs/netlify';
6+
import linkValidator from 'starlight-links-validator';
7+
import react from '@astrojs/react';
8+
import markdoc from '@astrojs/markdoc';
9+
10+
// https://astro.build/config
11+
export default defineConfig({
12+
integrations: [
13+
markdoc(),
14+
starlight({
15+
title: 'Nx',
16+
tagline:
17+
'An AI-first build platform that connects everything from your editor to CI. Helping you deliver fast, without breaking things.',
18+
favicon: '/favicon.svg',
19+
logo: {
20+
src: './src/assets/nx/Nx-light.png',
21+
replacesTitle: true,
22+
},
23+
plugins: [
24+
// linkValidator(),
25+
sectionSidebarPlugin(),
26+
],
27+
routeMiddleware: ['./src/plugins/banner.middleware.ts'],
28+
markdown: {
29+
// this breaks the renderMarkdown function in the plugin loader due to starlight path normalization
30+
// as to _why_ it has to normalize a path?
31+
// idk just working around the issue for now but we'll want to have linked headers so will need to fix
32+
headingLinks: false,
33+
},
34+
social: [
35+
{ icon: 'github', label: 'GitHub', href: 'https://github.com/nrwl/nx' },
36+
{
37+
icon: 'youtube',
38+
label: 'YouTube',
39+
href: 'https://www.youtube.com/@NxDevtools?utm_source=nx.dev',
40+
},
41+
{
42+
icon: 'x.com',
43+
label: 'X',
44+
href: 'https://x.com/NxDevTools?utm_source=nx.dev',
45+
},
46+
{
47+
icon: 'discord',
48+
label: 'Discord',
49+
href: 'https://go.nx.dev/community',
50+
},
51+
],
52+
editLink: {
53+
baseUrl: 'https://github.com/nrwl/nx/tree/main/',
54+
},
55+
customCss: ['./src/styles/custom.css'],
56+
sidebar: [
57+
{
58+
label: 'Getting Started',
59+
autogenerate: { directory: 'getting-started' },
60+
},
61+
{
62+
label: 'Guides',
63+
autogenerate: { directory: 'guides' },
64+
},
65+
{
66+
label: 'Concepts',
67+
autogenerate: { directory: 'concepts' },
68+
},
69+
{
70+
label: 'References',
71+
collapsed: true,
72+
items: [
73+
// have to use link bc slug is mapped to the /docs/ folder but we need the astro component in the pages/ dir
74+
{ label: 'Nx CLI', link: 'api/nx-cli' },
75+
{ label: 'Nx Cloud CLI', slug: 'api/nx-cloud-cli' },
76+
{ label: 'create-nx-workspace', link: 'api/create-nx-workspace' },
77+
{
78+
label: 'devkit',
79+
collapsed: true,
80+
items: [
81+
{ label: 'Overview', link: 'api/plugins/devkit/' },
82+
{
83+
label: 'Ng CLI Adapter',
84+
link: 'api/plugins/devkit/ngcli_adapter',
85+
},
86+
],
87+
},
88+
// plugins are autogenerated from the Nx repository via the sidebar plugin
89+
],
90+
},
91+
],
92+
}),
93+
react(),
94+
],
95+
site: 'https://docs.nx.dev',
96+
adapter: netlify(),
97+
});

astro-docs/markdoc.config.mjs

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
import { defineMarkdocConfig, component } from '@astrojs/markdoc/config';
2+
import starlightMarkdoc from '@astrojs/starlight-markdoc';
3+
4+
export default defineMarkdocConfig({
5+
extends: [starlightMarkdoc()],
6+
tags: {
7+
youtube: {
8+
render: component('./src/components/Youtube.astro'),
9+
attributes: {
10+
src: {
11+
type: 'String',
12+
required: true,
13+
},
14+
title: {
15+
type: 'String',
16+
required: true,
17+
},
18+
width: {
19+
type: 'String',
20+
default: '100%',
21+
},
22+
caption: {
23+
type: 'String',
24+
required: false,
25+
},
26+
},
27+
},
28+
},
29+
});

astro-docs/package.json

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"name": "astro-docs",
3+
"version": "0.0.1",
4+
"private": true,
5+
"dependencies": {
6+
"astro": "^5.10.1",
7+
"@astrojs/markdoc": "^0.15.0",
8+
"@astrojs/netlify": "^6.4.0",
9+
"@astrojs/starlight": "0.34.6",
10+
"@astrojs/starlight-markdoc": "^0.4.0",
11+
"@astrojs/check": "^0.7.0",
12+
"@astrojs/react": "^4.3.0"
13+
}
14+
}

astro-docs/project.json

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
{
2+
"name": "astro-docs",
3+
"targets": {
4+
"comment": "package.json#scripts runs in the project root directory with astro assumes is where the node_modules is. which fails. so run the scripts in project.json#targets with --root command instead",
5+
"serve": {
6+
"continuous": true,
7+
"dependsOn": [
8+
{
9+
"projects": ["devkit", "create-nx-workspace"],
10+
"target": "build"
11+
}
12+
],
13+
"command": "astro dev",
14+
"options": {
15+
"cwd": "astro-docs"
16+
}
17+
},
18+
"build": {
19+
"dependsOn": [
20+
{
21+
"projects": ["devkit", "create-nx-workspace"],
22+
"target": "build"
23+
}
24+
],
25+
"command": "astro build",
26+
"options": {
27+
"cwd": "astro-docs"
28+
}
29+
},
30+
"astro": {
31+
"command": "astro",
32+
"options": {
33+
"cwd": "astro-docs"
34+
}
35+
}
36+
}
37+
}

astro-docs/public/favicon.svg

Lines changed: 1 addition & 0 deletions
Loading
47.4 KB
Binary file not shown.
36.4 KB
Binary file not shown.

0 commit comments

Comments
 (0)