noblog 0.0.10 → 0.0.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -4,30 +4,31 @@ This package aims to generate static content from notion.so and provide a plugab
4
4
 
5
5
  the pattern would be like notablog (see reference), but more flexiable thanks to the mighty power of Astro
6
6
 
7
- # Usage
7
+ # Usage
8
8
 
9
9
  ```
10
10
  npm install -g noblog
11
11
  noblog
12
12
  ```
13
13
 
14
- 1. Duplicate this [database](https://www.notion.so/humbornjo/fa0faae85c504934a4a86cfa70302850?v=2abd1079ae134fbd8df2604765baa1df) and write blogs on it.
14
+ 1. \[OPTIONAL\] Duplicate this [database](https://www.notion.so/humbornjo/fa0faae85c504934a4a86cfa70302850?v=2abd1079ae134fbd8df2604765baa1df) and write blogs on it.
15
15
 
16
16
  2. Find a astro template, here is a shabby template I made: [nobloger](https://github.com/humbornjo/nobloger)
17
17
 
18
18
  3. set two env variables:
19
- ```
20
- NOBLOG_DATABASE_ID: your notion database id.
21
- NOTION_API_SECRET: your notion api secret.
22
- ```
23
19
 
24
- 3. Run `noblog` and deploy your site.
20
+ ```
21
+ NOBLOG_DATABASE_ID: your notion database id.
22
+ NOTION_API_SECRET: your notion api secret.
23
+ ```
25
24
 
26
- By default, `noblog` saves all your post (the posts at the surface og your database) under `SAVE_PATH`.
25
+ 4. Run `noblog` and deploy your site.
26
+
27
+ By default, `noblog` saves all your post (the posts at the surface og your database) under `SAVE_PATH`.
27
28
 
28
29
  The articles that are not directly posted on the database is saved under `SAVE_PATH/SUB_PATH`.
29
30
 
30
- The default value of `SAVE_PATH` is `./src/pages/posts/`, `SUB_PATH` is `nob_children/`
31
+ The default value of `SAVE_PATH` is `./src/pages/posts/`, `SUB_PATH` is `nob_children/`
31
32
 
32
33
  So if you run `noblog` only, the file structure would be,
33
34
 
@@ -65,21 +66,22 @@ description: "sometimes I hate, sometimes I love. <3"
65
66
  ---
66
67
  ```
67
68
 
68
- Layout used is hard coded in `./src/layouts/MarkdownPostLayout.astro`
69
+ Layout used is hard coded in the name of `./src/layouts/MarkdownPostLayout.astro`
69
70
 
70
71
  In addition, any astro template that offer `./src/layouts/MarkdownPostLayout.astro` and use the default blog file structure (please refer to the code block above) is compatiable with `noblog`.
71
72
 
72
-
73
73
  # Millstone
74
- * \[2024.07.08\] fuck around
75
- * \[2024.07.20\] generate github flavored markdown
76
- * \[2024.09.04\] at least it worked
77
-
78
- # Reference
79
- I really appreciate their work and effort, but their code just sucks. And I refactor some :|
80
-
81
- * [notion api](https://developers.notion.com/reference/intro)
82
- * [notion sdk](https://developers.notion.com/docs/getting-started)
83
- * [notion-to-md](https://github.com/souvikinator/notion-to-md)
84
- * [notablog](https://github.com/dragonman225/notablog)
85
- * [astro-notion-blog](https://github.com/otoyo/astro-notion-blog)
74
+
75
+ - \[2024.07.08\] fuck around
76
+ - \[2024.07.20\] generate github flavored markdown
77
+ - \[2024.09.04\] at least it worked
78
+
79
+ # Reference
80
+
81
+ I really appreciate their work and effort. I stealed and refactored some :)
82
+
83
+ - [notion api](https://developers.notion.com/reference/intro)
84
+ - [notion sdk](https://developers.notion.com/docs/getting-started)
85
+ - [notion-to-md](https://github.com/souvikinator/notion-to-md)
86
+ - [notablog](https://github.com/dragonman225/notablog)
87
+ - [astro-notion-blog](https://github.com/otoyo/astro-notion-blog)
@@ -0,0 +1,28 @@
1
+ #!/usr/bin/env node
2
+ import { Noblog } from "../lib/nomd/nomd.js";
3
+ import { GetAllPosts } from "../lib/notion/client.js";
4
+ function help() {
5
+ console.log(`\n
6
+ Usage: noblog [SAVE_PATH] [SUB_PATH]
7
+
8
+ Example:
9
+ noblog
10
+ noblog src/pages/posts/ nob_children/
11
+
12
+ Available <option>:
13
+ -v Print more messages for debugging.\n`);
14
+ }
15
+ async function main() {
16
+ const argv = process.argv.slice(2);
17
+ if (argv.length > 2) {
18
+ console.error("Error: invallid arg.");
19
+ help();
20
+ }
21
+ const save_dir = argv[0] ?? "./src/pages/posts/";
22
+ const sub_dir = argv[1] ?? "nob_children/";
23
+ const pages = await GetAllPosts();
24
+ const nob = new Noblog(pages, save_dir, sub_dir);
25
+ nob.Collect(true);
26
+ }
27
+ main();
28
+ //# sourceMappingURL=generate.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generate.js","sourceRoot":"","sources":["../../src/cmds/generate.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAC7C,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAEtD,SAAS,IAAI;IACX,OAAO,CAAC,GAAG,CAAC;;;;;;;;2CAQ6B,CAAC,CAAA;AAC5C,CAAC;AAED,KAAK,UAAU,IAAI;IACjB,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAE,CAAC;IACpC,IAAI,IAAI,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACpB,OAAO,CAAC,KAAK,CAAC,sBAAsB,CAAC,CAAC;QACtC,IAAI,EAAE,CAAC;IACT,CAAC;IAED,MAAM,QAAQ,GAAG,IAAI,CAAC,CAAC,CAAC,IAAI,oBAAoB,CAAC;IACjD,MAAM,OAAO,GAAG,IAAI,CAAC,CAAC,CAAC,IAAI,eAAe,CAAA;IAC1C,MAAM,KAAK,GAAG,MAAM,WAAW,EAAE,CAAC;IAClC,MAAM,GAAG,GAAG,IAAI,MAAM,CAAC,KAAK,EAAE,QAAQ,EAAE,OAAO,CAAC,CAAA;IAEhD,GAAG,CAAC,OAAO,CAAC,IAAI,CAAC,CAAA;AACnB,CAAC;AAED,IAAI,EAAE,CAAA"}