mirror of
https://github.com/penpot/penpot.git
synced 2025-02-02 04:19:08 -05: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]
|
||||
[integrant.core :as ig]))
|
||||
|
||||
(def ^:private schema:template
|
||||
[:map {:title "Template"}
|
||||
[:id ::sm/word-string]
|
||||
[:name ::sm/word-string]
|
||||
[:file-uri ::sm/word-string]])
|
||||
(def ^:private
|
||||
schema:template
|
||||
(sm/define
|
||||
[:map {:title "Template"}
|
||||
[:id ::sm/word-string]
|
||||
[:name ::sm/word-string]
|
||||
[:file-uri ::sm/word-string]]))
|
||||
|
||||
(def ^:private schema:templates
|
||||
[:vector schema:template])
|
||||
|
||||
(def check-templates!
|
||||
(sm/check-fn schema:templates))
|
||||
(def ^:private
|
||||
schema:templates
|
||||
(sm/define
|
||||
[:vector schema:template]))
|
||||
|
||||
(defmethod ig/init-key ::setup/templates
|
||||
[_ _]
|
||||
|
@ -38,13 +39,13 @@
|
|||
|
||||
(dm/verify!
|
||||
"expected a valid templates file"
|
||||
(check-templates! templates))
|
||||
(sm/check! schema:templates templates))
|
||||
|
||||
(doseq [{:keys [id path] :as template} templates]
|
||||
(let [path (or path (fs/join dest id))]
|
||||
(if (fs/exists? path)
|
||||
(l/debug :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 "present" :path (dm/str path))
|
||||
(l/dbg :hint "template file" :id id :state "absent"))))
|
||||
|
||||
templates))
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue