Skip to content

Commit a354bf5

Browse files
committed
update: tasks
1 parent 758fffd commit a354bf5

File tree

9 files changed

+40
-17
lines changed

9 files changed

+40
-17
lines changed

Makefile

+3
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,8 @@ build:clean
99
dev:clean
1010
bb dev
1111

12+
nrepl:
13+
bb nrepl
14+
1215
clean:
1316
rm -rf outputs

bb.edn

+3-2
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,9 @@
22

33
:pods {org.babashka/fswatcher {:version "0.0.4"}}
44

5-
:deps {org.babashka/http-server {:mvn/version "0.1.11"}
6-
markdown-clj/markdown-clj {:mvn/version "1.11.4"}}
5+
:deps {org.babashka/http-server {:mvn/version "0.1.11"}
6+
markdown-clj/markdown-clj {:mvn/version "1.11.4"}
7+
camel-snake-kebab/camel-snake-kebab {:mvn/version "0.4.3"}}
78

89
:tasks {dev {:docs "Auto build docs for development mode!"
910
:task build/start-dev-mode!}

deps.edn

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
{:paths ["scripts"]
22
:deps {org.babashka/http-server {:mvn/version "0.1.11"}
3-
markdown-clj/markdown-clj {:mvn/version "1.11.4"}}}
3+
markdown-clj/markdown-clj {:mvn/version "1.11.4"}
4+
camel-snake-kebab {:mvn/version "0.4.3"}}}

docs/1.Onboarding/config.edn

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
1-
{:title "🔆Onboarding"
1+
{:title "🔆Onboarding"
22
:description "This is sub description"
3-
;; The children items will be constructed in Build time
3+
:color "#dd2624"
4+
5+
;; [optional] Currently, the children items will be constructed in build time
46
;; :children []
57
}

docs/2.Workflows/config.edn

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
1-
{:title "🐙Workflows"
1+
{:title "🐙Workflows"
22
:description "This is sub description"
3-
;; The children items will be constructed in Build time
3+
:color "#14a44a"
4+
5+
;; [optional] Currently, the children items will be constructed in build time
46
;; :children []
57
}

docs/3.Features/config.edn

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
{:title "🎁 Features"
2+
:color "#da7706"}

docs/config.edn

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
{:title "Logseq Handbooks"
22
:version "0.0.1"
3-
;; The children items will be constructed in Build time
3+
4+
;; [optional] Currently, the children items will be constructed in build time
45
;; :children []
56
}

package.json

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"name": "handbooks",
3+
"version": "0.0.1",
4+
"author": "Logseq teams",
5+
"dependencies": {}
6+
}

scripts/build.clj

+14-9
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@
66
[markdown.core :as md]
77
[clojure.edn :as edn]
88
[clojure.string :as string]
9-
[pod.babashka.fswatcher :as fw])
9+
[pod.babashka.fswatcher :as fw]
10+
[camel-snake-kebab.core :as csk])
1011

1112
(:import (java.time LocalDateTime)))
1213

@@ -97,16 +98,20 @@
9798
(when-let [category (or (some-> (first category)
9899
(resolve-docs-file-or-dirs!))
99100
{:title (fs/file-name f)})]
100-
(->> items'
101-
(map #(let [config (resolve-docs-file-or-dirs! %)
102-
content-file (fs/file (string/replace-first (.toString %) #".edn$" ".md"))]
103-
(-> (cond-> config
101+
(let [category-k (csk/->snake_case_string (fs/file-name f))
102+
category (assoc category :key category-k)]
104103

105-
(and (nil? (:content config))
106-
(fs/exists? content-file))
107-
(assoc :content (resolve-docs-file-or-dirs! content-file))))))
104+
(->> items'
105+
(map #(let [config (resolve-docs-file-or-dirs! %)
106+
content-file (fs/file (string/replace-first (.toString %) #".edn$" ".md"))]
107+
(-> (cond-> config
108108

109-
(assoc category :children)))))))
109+
(and (nil? (:content config))
110+
(fs/exists? content-file))
111+
(assoc :content (resolve-docs-file-or-dirs! content-file)))
112+
(assoc :key (str category-k "/" (csk/->snake_case_string (fs/file-name content-file)))))))
113+
114+
(assoc category :children))))))))
110115
(assoc output :children))
111116
results (assoc results :version (.toString (LocalDateTime/now)))]
112117

0 commit comments

Comments
 (0)