Skip to content

Commit c9bd470

Browse files
authored
Merge pull request #10843 from marmelab/headless-doc
[Doc] Bootstrap headless documentation
2 parents e857f1b + bcaaa38 commit c9bd470

25 files changed

+14369
-8210
lines changed
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
name: 📕 Deploy headless docs
2+
on:
3+
push:
4+
branches:
5+
- master
6+
- next # TODO remove
7+
pull_request: # TODO remove
8+
9+
concurrency:
10+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
11+
cancel-in-progress: true
12+
13+
permissions:
14+
pages: write
15+
contents: write
16+
17+
jobs:
18+
deploy:
19+
name: 📕 Deploy headless docs
20+
runs-on: ubuntu-latest
21+
22+
env:
23+
PRODUCTION_REMOTE: https://git:${{ secrets.DEPLOY_TOKEN }}@github.com/${{ vars.DEPLOY_REPOSITORY }}
24+
25+
steps:
26+
- name: 📥 Checkout repo
27+
uses: actions/checkout@v4
28+
29+
- name: ⚙️ Setup node
30+
uses: actions/setup-node@v4
31+
with:
32+
node-version: 20
33+
cache: yarn
34+
35+
- name: ⚙️ Setup git
36+
run: |
37+
echo Deploying to pages to $PRODUCTION_REMOTE
38+
git remote set-url origin https://git:${{ secrets.GITHUB_TOKEN }}@github.com/${GITHUB_REPOSITORY}
39+
git remote add production $PRODUCTION_REMOTE
40+
git config --global user.email [email protected]
41+
git config --global user.name github-actions-bot
42+
43+
- name: 📥 Download deps
44+
run: yarn install --frozen-lockfile
45+
46+
- name: 🔨 Build
47+
run: |
48+
cd docs_headless
49+
yarn build
50+
cd ..
51+
52+
- name: 📡 Deploy GitHub pages
53+
run: yarn gh-pages --remote production -d docs_headless/dist -b ${{ vars.DEPLOY_BRANCH || 'gh-pages' }}
54+
env:
55+
GITHUB_TOKEN: ${{ secrets.DEPLOY_TOKEN }}

.prettierignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,5 @@ cypress/screenshots
2323
!.yarn/plugins
2424
!.yarn/releases
2525
!.yarn/sdks
26-
!.yarn/versions
26+
!.yarn/versions
27+
.astro

Makefile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,9 @@ build: build-ra-core build-ra-data-fakerest build-ra-ui-materialui build-ra-data
117117
doc: ## compile doc as html and launch doc web server
118118
@yarn doc
119119

120+
doc-headless: ## launch headless doc web server
121+
@cd docs_headless && yarn dev
122+
120123
docker-doc: ## run the doc website in a docker container
121124
@docker run -it --rm \
122125
-p 4000:4000 \

docs_headless/.gitignore

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
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

docs_headless/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+
npm 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+
| `npm install` | Installs dependencies |
46+
| `npm run dev` | Starts local dev server at `localhost:4321` |
47+
| `npm run build` | Build your production site to `./dist/` |
48+
| `npm run preview` | Preview your build locally, before deploying |
49+
| `npm run astro ...` | Run CLI commands like `astro add`, `astro check` |
50+
| `npm run 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).

docs_headless/astro.config.mjs

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
// @ts-check
2+
import { defineConfig } from 'astro/config';
3+
import starlight from '@astrojs/starlight';
4+
import react from '@astrojs/react';
5+
import mdx from '@astrojs/mdx';
6+
import tailwindcss from '@tailwindcss/vite';
7+
import rehypeCodeGroup from 'rehype-code-group';
8+
import expressiveCode from 'astro-expressive-code';
9+
import { pluginFullscreen } from 'expressive-code-fullscreen';
10+
import { pluginCollapsibleSections } from '@expressive-code/plugin-collapsible-sections';
11+
import rehypeAstroRelativeMarkdownLinks from 'astro-rehype-relative-markdown-links';
12+
13+
// https://astro.build/config
14+
export default defineConfig({
15+
integrations: [
16+
starlight({
17+
title: 'React Admin Headless',
18+
customCss: ['./src/styles/global.css'],
19+
favicon: '/favicon.ico',
20+
social: [
21+
{
22+
icon: 'github',
23+
label: 'GitHub',
24+
href: 'https://github.com/marmelab/react-admin',
25+
},
26+
],
27+
sidebar: [
28+
{
29+
label: 'Guides & Concepts',
30+
items: [
31+
// Each item here is one entry in the navigation menu.
32+
{
33+
label: 'General Concepts',
34+
slug: 'guides/architecture',
35+
},
36+
{
37+
label: 'Data Fetching',
38+
slug: 'guides/datafetchingguide',
39+
},
40+
{
41+
label: 'CRUD pages',
42+
slug: 'guides/crud',
43+
attrs: {
44+
class: 'flex items-center',
45+
},
46+
badge: {
47+
text: '',
48+
variant: 'default',
49+
class: 'ee-badge',
50+
},
51+
},
52+
],
53+
},
54+
{
55+
label: 'Reference',
56+
autogenerate: {
57+
directory: 'reference',
58+
},
59+
},
60+
],
61+
components: {
62+
Sidebar: './src/components/CustomSidebar.astro',
63+
},
64+
}),
65+
expressiveCode({
66+
plugins: [pluginFullscreen(), pluginCollapsibleSections()],
67+
}),
68+
react(),
69+
mdx(),
70+
],
71+
markdown: {
72+
rehypePlugins: [
73+
rehypeCodeGroup,
74+
[
75+
rehypeAstroRelativeMarkdownLinks,
76+
{
77+
base: '/ra-core/',
78+
collectionBase: false,
79+
},
80+
],
81+
],
82+
},
83+
vite: {
84+
plugins: [tailwindcss()],
85+
},
86+
base: '/ra-core/',
87+
site: 'https://marmelab.com',
88+
build: {
89+
assets: 'assets',
90+
},
91+
});

docs_headless/package.json

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
{
2+
"name": "ra-core-doc",
3+
"type": "module",
4+
"version": "0.0.1",
5+
"scripts": {
6+
"dev": "astro dev",
7+
"start": "astro dev",
8+
"build": "astro build",
9+
"preview": "astro preview",
10+
"astro": "astro"
11+
},
12+
"dependencies": {
13+
"@astrojs/mdx": "^4.3.1",
14+
"@astrojs/react": "^4.3.0",
15+
"@astrojs/starlight": "0.35.2",
16+
"@astrojs/starlight-tailwind": "^4.0.1",
17+
"@expressive-code/plugin-collapsible-sections": "^0.41.3",
18+
"@tailwindcss/vite": "^4.1.11",
19+
"@types/react": "^19.1.8",
20+
"@types/react-dom": "^19.1.6",
21+
"astro": "5.12.6",
22+
"astro-expressive-code": "^0.41.3",
23+
"astro-rehype-relative-markdown-links": "^0.18.1",
24+
"expressive-code-fullscreen": "^1.0.0",
25+
"react": "^18.3.1",
26+
"react-dom": "^18.3.1",
27+
"rehype-code-group": "^0.2.4",
28+
"sharp": "^0.34.2",
29+
"starlight-package-managers": "^0.11.0",
30+
"tailwindcss": "^4.1.11"
31+
},
32+
"devDependencies": {
33+
"prettier": "^3.2.5",
34+
"prettier-plugin-astro": "^0.14.1"
35+
}
36+
}

docs_headless/public/favicon.ico

5.3 KB
Binary file not shown.
Lines changed: 1 addition & 0 deletions
Loading
71.4 KB
Loading

0 commit comments

Comments
 (0)