|
2 | 2 |
|
3 | 3 | [](https://github.com/prisma/docs/blob/main/CONTRIBUTING.md) [](https://discord.com/invite/prisma-937751382725886062?utm_source=twitter&utm_medium=bio&dub_id=0HxLEKaaOg6pL0OL) |
4 | 4 |
|
5 | | -This repository contains the [source code](./src) and the [content](./content) for the [Prisma documentation](https://www.prisma.io/docs). |
| 5 | +This repository is a **pnpm monorepo** containing the Prisma documentation, blog, design system docs, and shared packages. |
6 | 6 |
|
7 | | -## Contributing to the docs |
| 7 | +## Repository structure |
8 | 8 |
|
9 | | -New contributors are welcome! Read through the [contributing guide](CONTRIBUTING.md) to learn how you can contribute to the Prisma documentation. |
| 9 | +| Path | Description | |
| 10 | +|------|--------------| |
| 11 | +| `apps/docs` | Prisma documentation site (Next.js + Fumadocs) | |
| 12 | +| `apps/blog` | Prisma blog | |
| 13 | +| `apps/eclipse` | Eclipse design system documentation | |
| 14 | +| `packages/eclipse` | Eclipse design system component library (`@prisma-docs/eclipse`) | |
| 15 | +| `packages/ui` | Shared UI components and utilities (`@prisma-docs/ui`) | |
10 | 16 |
|
11 | | -## Run the docs site locally |
| 17 | +See each appβs `README.md` for more detail. |
12 | 18 |
|
13 | | -1. Clone this repository. |
14 | | -2. On your computer, open a terminal window in the repository's directory. |
15 | | -3. Run the following commands: |
| 19 | +## Contributing |
16 | 20 |
|
17 | | -``` |
18 | | -npm install |
19 | | -npm run start |
20 | | -``` |
21 | | - |
22 | | -Be sure to also test building the static site: |
| 21 | +New contributors are welcome. Read the [contributing guide](CONTRIBUTING.md) before submitting changes. |
23 | 22 |
|
24 | | -``` |
25 | | -npm run clean && npm run build |
26 | | -npm run serve |
27 | | -``` |
| 23 | +## Run locally |
28 | 24 |
|
29 | | -To prettify or format the code, run: |
| 25 | +From the repository root: |
30 | 26 |
|
| 27 | +```bash |
| 28 | +pnpm install |
| 29 | +pnpm dev |
31 | 30 | ``` |
32 | | -npm run format |
33 | | -``` |
34 | | - |
35 | | -Please note that `.md` and `.mdx` files are not formatted by Prettier because they are written in [MDX 3](https://mdxjs.com/blog/v3/) which Prettier [does not support](https://github.com/prettier/prettier/issues/12209). |
36 | | - |
37 | | -Visit `http://localhost:3000` to view the app. |
38 | | - |
39 | | -## Configure |
40 | | - |
41 | | -Write MDX files in `content` folder. |
42 | 31 |
|
43 | | -Most frontmatter for the docs are the same as [Docusaurus Frontmatter](https://docusaurus.io/docs/api/plugins/@docusaurus/plugin-content-docs#markdown-front-matter). There are some differences due to legacy frontmatter which are handled [here](https://github.com/prisma/docs/blob/94b04aa1d8f723802e715b531b9808bab2d7ae15/src/theme/DocItem/Metadata/index.tsx). |
| 32 | +This starts all apps via Turbo: |
44 | 33 |
|
45 | | -When possible, avoid using custom frontmatter fields and use the default ones available via Docusaurus. |
| 34 | +- **Docs** β http://localhost:3000 |
| 35 | +- **Blog** β http://localhost:3001 |
| 36 | +- **Eclipse** β http://localhost:3002 |
46 | 37 |
|
47 | | -## Inserting, moving and deleting files |
48 | | - |
49 | | -All files/folders in the context are prefixed with a _position_ which indicates the order in which they appear in the sidenav on the docs website. This makes it cumbersome to insert, move and delete files because the positions of a number of other files (if not all) in the same folder might need to be adjusted. Thanks to [Luca Steeb](https://github.com/steebchen/), you can perform these operations with a dedicated CLI called [`mdtool`](https://gist.githubusercontent.com/steebchen/bd085ebde1fcf4242e3fdd0df4d202a6/raw/c04e3d262eb6a302a9fab98f6428fec9329681e2/mdtool). |
50 | | - |
51 | | -### Install |
52 | | - |
53 | | -First, install `wget`: |
| 38 | +To run a single app: |
54 | 39 |
|
55 | 40 | ```bash |
56 | | -brew install wget |
| 41 | +pnpm --filter docs dev # docs only |
| 42 | +pnpm --filter blog dev # blog only |
| 43 | +pnpm --filter eclipse dev # eclipse design system docs only |
57 | 44 | ``` |
58 | 45 |
|
59 | | -Then use `wget` to install `mdtool`: |
| 46 | +## Build |
60 | 47 |
|
61 | 48 | ```bash |
62 | | -wget https://gist.githubusercontent.com/steebchen/bd085ebde1fcf4242e3fdd0df4d202a6/raw/c04e3d262eb6a302a9fab98f6428fec9329681e2/mdtool -qO /usr/local/bin/mdtool |
63 | | -chmod +x /usr/local/bin/mdtool |
64 | | -``` |
65 | | - |
66 | | -### Usage |
67 | | - |
68 | | -#### Overview |
69 | | - |
70 | | -``` |
71 | | -mdtool insert 3 |
72 | | -mdtool swap A B |
73 | | -mdtool move A B |
74 | | -mdtool remove 4 |
| 49 | +pnpm build |
75 | 50 | ``` |
76 | 51 |
|
77 | | -#### `mdtool insert` |
| 52 | +To build and serve the docs site: |
78 | 53 |
|
79 | | -Make place for a new file at given index and increment all numbers by one after that index: |
80 | | - |
81 | | -``` |
82 | | -$ mdtool insert INDEX |
83 | | -
|
84 | | -# e.g.: |
85 | | -$ mdtool insert 2 |
86 | | -
|
87 | | -# Result: for files 01-a, 02-b, 03-c, and 04-d; 03-c is renamed to 04-c and 04-d is renamed to 05-d so you can create a new file at index 2 |
88 | | -``` |
89 | | - |
90 | | -#### `mdtool swap` |
91 | | - |
92 | | -Swap two files; specify both filenames (prefix numbers get automatically adjusted): |
93 | | - |
94 | | -``` |
95 | | -$ mdtool swap FILENAME1 FILENAME2 |
96 | | -
|
97 | | -# e.g.: |
98 | | -$ mdtool swap 03-file1.mdx 07-file2.mdx |
99 | | -
|
100 | | -# Result: Files are now named: 03-file2.mdx 07-file1.mdx |
101 | | -``` |
102 | | - |
103 | | -#### `mdtool move` |
104 | | - |
105 | | -Move a given file to another given index |
106 | | - |
107 | | -``` |
108 | | -$ mdtool move FILENAME INDEX |
109 | | -
|
110 | | -# e.g.: |
111 | | -$ mdtool move 05-file.mdx 2 |
112 | | -
|
113 | | -# Result: 05-file.mdx is move to 02-file.mdx, plus previous files 02-*, 03-*, 04-* are incremented |
| 54 | +```bash |
| 55 | +pnpm --filter docs build |
| 56 | +pnpm --filter docs start |
114 | 57 | ``` |
115 | 58 |
|
116 | | -#### `mdtool remove` |
| 59 | +## Scripts |
117 | 60 |
|
118 | | -Shift all other items by -1 at a given index: |
| 61 | +| Script | Description | |
| 62 | +|--------|-------------| |
| 63 | +| `pnpm lint:links` | Validate internal and external links (docs) | |
| 64 | +| `pnpm lint:code` | Lint code blocks in MDX (docs) | |
| 65 | +| `pnpm lint:spellcheck` | Spell-check content (docs) | |
| 66 | +| `pnpm format` | Format code (`.md` / `.mdx` excluded β see note below) | |
119 | 67 |
|
120 | | -``` |
121 | | -$ mdtool remove INDEX |
| 68 | +## Content |
122 | 69 |
|
123 | | -# e.g.: |
124 | | -$ mdtool remove 2 |
125 | | -
|
126 | | -# Result: 01-a, 02-b, 03-c, 04-d becomes 01-a, 02-b, 02-c, 03-d; 02-b is supposed to be manually deleted |
127 | | -``` |
| 70 | +- **Docs** β `apps/docs/content/docs/` (latest), `apps/docs/content/docs.v6/` (versioned). Sidebar structure comes from `meta.json` in each folder. See [Fumadocs collections](https://fumadocs.dev/docs/mdx/collections). |
| 71 | +- **Blog** β `apps/blog/content/blog/` (MDX with authors, dates, hero images). |
| 72 | +- **Eclipse** β `apps/eclipse/content/design-system/` (component docs). |
128 | 73 |
|
129 | | -#### Thanks Luca |
| 74 | +## Note on formatting |
130 | 75 |
|
131 | | - |
| 76 | +`.md` and `.mdx` files are not formatted by Prettier because they use [MDX 3](https://mdxjs.com/blog/v3/), which Prettier does not support. See [prettier/prettier#12209](https://github.com/prettier/prettier/issues/12209). |
0 commit comments