Skip to content

Commit 0c4d999

Browse files
doc: update readme usage and development instructions
1 parent 12ba3f4 commit 0c4d999

File tree

4 files changed

+69
-60
lines changed

4 files changed

+69
-60
lines changed

README.md

Lines changed: 69 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -42,17 +42,77 @@ Success! 🚀
4242
| Checkbox | ? | |
4343
| Table Of Contents | ? | |
4444

45-
### Configuration
45+
## Usage
4646

47-
## Related Projects and Inspiration
47+
At the moment `notion-markdown-cms` is meant to be consumed via its node.js API from build scripts
48+
wrapping your favourite static site generator tool. You can find an example
49+
script below. Consult the [SyncConfig](./src/SyncConfig.ts) reference for documentation of available configuration options.
50+
51+
> A CLI tool could be made available later.
52+
53+
```typescript
54+
import { SyncConfig, sync } from "notion-markdown-cms";
55+
56+
const config: SyncConfig = {
57+
cmsDatabaseId: "8f1de8c578fb4590ad6fbb0dbe283338",
58+
outDir: "docs/",
59+
indexPath: "docs/.vuepress/index.ts",
60+
databases: {
61+
"fe9836a9-6557-4f17-8adb-a93d2584f35f": {
62+
parentCategory: "cfmm/",
63+
sorts: [
64+
{
65+
property: "Scope",
66+
direction: "ascending",
67+
},
68+
{
69+
property: "Cluster",
70+
direction: "ascending",
71+
},
72+
],
73+
properties: {
74+
category: "scope",
75+
include: ["Name", "Scope", "Cluster", "Journey Stage", "Summary"],
76+
},
77+
},
78+
},
79+
};
80+
81+
async function main() {
82+
const notionApiToken = process.env.NOTION_API_TOKEN;
83+
if (!notionApiToken) {
84+
throw new Error(
85+
"Required NOTION_API_TOKEN environment variable not provided."
86+
);
87+
}
88+
89+
await sync(notionApiToken, config);
90+
}
91+
92+
main();
93+
```
94+
95+
## Credits, Related Projects and Inspiration
4896

4997
There are quite a few alternatives out there already, so why did we build `notion-markdown-cms`?
5098
Below table, albeit subjective, tries to answer this.
5199

52-
| Project | Notion API | Language | Rendering Engine |
53-
| ------------------------------------------------------------------------ | ------------- | ---------- | ------------------- |
54-
| [Nortion Markdown CMS](https://github.com/meshcloud/notion-markdown-cms) | ✅ official | TypeScript | Markdown + JS Index |
55-
| [Notion2GitHub](https://github.com/narkdown/notion2github) | ⚠️ unofficial | Python | Markdown |
56-
| [notion-cms](https://github.com/n6g7/notion-cms) | ⚠️ unofficial | TypeScript | React |
57-
| [vue-notion](https://github.com/janniks/vue-notion) | ⚠️ unofficial | JavaScript | Vue.js |
58-
| [react-notion](https://github.com/janniks/react-notion) | ⚠️ unofficial | JavaScript | React |
100+
| Project | Notion API | Language | Rendering Engine | Output looks like |
101+
| ------------------------------------------------------------------------ | ------------- | ---------- | ------------------- | -------------------- |
102+
| [Nortion Markdown CMS](https://github.com/meshcloud/notion-markdown-cms) | ✅ official | TypeScript | Markdown + JS Index | Site generator theme |
103+
| [Notion2GitHub](https://github.com/narkdown/notion2github) | ⚠️ unofficial | Python | Markdown | Site generator theme |
104+
| [notion-cms](https://github.com/n6g7/notion-cms) | ⚠️ unofficial | TypeScript | React | Notion App |
105+
| [vue-notion](https://github.com/janniks/vue-notion) | ⚠️ unofficial | JavaScript | Vue.js | Notion App |
106+
| [react-notion](https://github.com/janniks/react-notion) | ⚠️ unofficial | JavaScript | React | Notion App |
107+
108+
## Development
109+
110+
For convenient development you can use
111+
112+
- `nix-shell` to set up a development environemnt
113+
- You'll need a Notion database for testing. You can e.g. copy one of these to your own Notion Workspace
114+
- [Notion Kit Test Suite](https://www.notion.so/Notion-Test-Suite-067dd719a912471ea9a3ac10710e7fdf)
115+
- [Narkdown's Test Suite](https://www.notion.so/acc3dfd0339e4cacb5baae8673fddfad?v=be43c1c8dd644cfb9df9efd97d8af60a)
116+
- A [Notion API Token](https://developers.notion.com/docs/authorization)
117+
118+
> As this project is still in its very early stages, `notion-markdown-cms` does not come with its own demo, example or test cases yet.

config.json.example

Lines changed: 0 additions & 27 deletions
This file was deleted.

package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424
"dependencies": {
2525
"@notionhq/client": "^0.3.2",
2626
"chalk": "^4.1.2",
27-
"dotenv": "^10.0.0",
2827
"got": "^11.8.2",
2928
"js-yaml": "^4.1.0",
3029
"keyv-file": "^0.2.0",

src/main.ts

Lines changed: 0 additions & 23 deletions
This file was deleted.

0 commit comments

Comments
 (0)