-
Notifications
You must be signed in to change notification settings - Fork 123
Expand file tree
/
Copy pathusing-in-a-monorepo.mdoc
More file actions
41 lines (35 loc) · 977 Bytes
/
using-in-a-monorepo.mdoc
File metadata and controls
41 lines (35 loc) · 977 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
---
title: Using in a monorepo
---
To use Keystatic in a monorepo there are just a few things you need to be aware of.
## Schema path
The `path` in your schema should be relative to the root of your app rather than the root of the repo. Your post collection should look like this:
```diff
const posts = collection({
label: 'Posts',
slugField: 'title',
- path: 'apps/docs/content/posts/*',
+ path: 'content/posts/*',
format: { data: 'json' },
schema: {
title: fields.slug({ name: { label: 'Title' } }),
content: fields.document({
label: 'Content',
}),
},
});
```
## Storage mode
When using Keystatic in [GitHub](/docs/github-mode) or [Cloud](/docs/cloud) mode, you will need to specify the path prefix:
```javascript
const storage: Config["storage"] =
process.env.NODE_ENV === "production"
? {
kind: "github",
pathPrefix: "apps/docs",
repo: "thinkmill/keystatic",
}
: {
kind: "local",
};
```