mirror of
https://github.com/penpot/penpot.git
synced 2025-05-11 14:46:37 +02:00
✨ Add minor performance enhancements on template setup service
This commit is contained in:
parent
f5ec818fc7
commit
22757a449f
1 changed files with 14 additions and 13 deletions
|
@ -19,17 +19,18 @@
|
||||||
[datoteka.fs :as fs]
|
[datoteka.fs :as fs]
|
||||||
[integrant.core :as ig]))
|
[integrant.core :as ig]))
|
||||||
|
|
||||||
(def ^:private schema:template
|
(def ^:private
|
||||||
[:map {:title "Template"}
|
schema:template
|
||||||
[:id ::sm/word-string]
|
(sm/define
|
||||||
[:name ::sm/word-string]
|
[:map {:title "Template"}
|
||||||
[:file-uri ::sm/word-string]])
|
[:id ::sm/word-string]
|
||||||
|
[:name ::sm/word-string]
|
||||||
|
[:file-uri ::sm/word-string]]))
|
||||||
|
|
||||||
(def ^:private schema:templates
|
(def ^:private
|
||||||
[:vector schema:template])
|
schema:templates
|
||||||
|
(sm/define
|
||||||
(def check-templates!
|
[:vector schema:template]))
|
||||||
(sm/check-fn schema:templates))
|
|
||||||
|
|
||||||
(defmethod ig/init-key ::setup/templates
|
(defmethod ig/init-key ::setup/templates
|
||||||
[_ _]
|
[_ _]
|
||||||
|
@ -38,13 +39,13 @@
|
||||||
|
|
||||||
(dm/verify!
|
(dm/verify!
|
||||||
"expected a valid templates file"
|
"expected a valid templates file"
|
||||||
(check-templates! templates))
|
(sm/check! schema:templates templates))
|
||||||
|
|
||||||
(doseq [{:keys [id path] :as template} templates]
|
(doseq [{:keys [id path] :as template} templates]
|
||||||
(let [path (or path (fs/join dest id))]
|
(let [path (or path (fs/join dest id))]
|
||||||
(if (fs/exists? path)
|
(if (fs/exists? path)
|
||||||
(l/debug :hint "template file" :id id :state "present" :path (dm/str path))
|
(l/dbg :hint "template file" :id id :state "present" :path (dm/str path))
|
||||||
(l/debug :hint "template file" :id id :state "absent"))))
|
(l/dbg :hint "template file" :id id :state "absent"))))
|
||||||
|
|
||||||
templates))
|
templates))
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue