0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-02-03 21:09:00 -05:00

💄 Replace prn with println

This commit is contained in:
Andrés Moya 2023-09-12 16:27:13 +02:00
parent 507cb9f3de
commit afa14dd847

View file

@ -31,7 +31,7 @@
update-page (fn [page] update-page (fn [page]
(let [errors (ctf/validate-shape uuid/zero file page libs)] (let [errors (ctf/validate-shape uuid/zero file page libs)]
(when (seq errors) (when (seq errors)
(prn "******Errors in file " (:id file) " page " (:id page)) (println "******Errors in file " (:id file) " page " (:id page))
(pprint errors {:level 3}))))] (pprint errors {:level 3}))))]
(update file :data h/update-pages update-page))) (update file :data h/update-pages update-page)))
@ -103,7 +103,7 @@
([file] ([file]
(if-not (contains? (:features file) "components/v2") (if-not (contains? (:features file) "components/v2")
(do (do
(prn " This file is not v2") (println " This file is not v2")
file) file)
(let [libs (->> (files/get-file-libraries app.srepl.helpers/*conn* (:id file)) (let [libs (->> (files/get-file-libraries app.srepl.helpers/*conn* (:id file))
(cons file) (cons file)
@ -155,10 +155,10 @@
(assoc-in p [:objects id :shape-ref] shape-ref)) (assoc-in p [:objects id :shape-ref] shape-ref))
page page
updates)] updates)]
(prn (str "Page " (:name page) " - Fixing " (count updates))) (println "Page " (:name page) " - Fixing " (count updates))
updated-page))] updated-page))]
(prn (str "Updating " (:name file) " " (:id file))) (println "Updating " (:name file) (:id file))
(-> file (-> file
(update :data h/update-pages update-page) (update :data h/update-pages update-page)
(assoc ::updated true))))) (assoc ::updated true)))))
@ -185,15 +185,15 @@
(:component-root shape) (:component-root shape)
(:shape-ref parent)) (:shape-ref parent))
(do (do
(prn (str " Shape " (:name shape) " " (:id shape))) (println " Shape " (:name shape) (:id shape))
(dissoc shape :component-root)) (dissoc shape :component-root))
shape))) shape)))
update-page (fn [page] update-page (fn [page]
(prn (str "Page " (:name page))) (println "Page " (:name page))
(h/update-shapes page (partial update-shape page)))] (h/update-shapes page (partial update-shape page)))]
(prn (str "Updating " (:name file) " " (:id file))) (println "Updating " (:name file) (:id file))
(update file :data h/update-pages update-page))) (update file :data h/update-pages update-page)))
([file save?] ([file save?]
@ -212,10 +212,10 @@
(defn update-near-components (defn update-near-components
([file] ([file]
(prn (str "Updating " (:name file) " " (:id file))) (println "Updating " (:name file) (:id file))
(if-not (contains? (:features file) "components/v2") (if-not (contains? (:features file) "components/v2")
(do (do
(prn " This file is not v2") (println " This file is not v2")
file) file)
(let [libs (->> (files/get-file-libraries h/*conn* (:id file)) (let [libs (->> (files/get-file-libraries h/*conn* (:id file))
(cons file) (cons file)
@ -227,8 +227,8 @@
(if-not (:shape-ref shape) (if-not (:shape-ref shape)
shape shape
(do (do
;; Uncomment prn's to debug ;; Uncomment println's to debug
;; (prn (str " -> Shape " (:name shape) " " (:id shape) " shape-ref " (:shape-ref shape))) ;; (println " -> Shape " (:name shape) (:id shape) " shape-ref " (:shape-ref shape))
(let [root-shape (ctn/get-copy-root (:objects page) shape)] (let [root-shape (ctn/get-copy-root (:objects page) shape)]
(if root-shape (if root-shape
(let [component (ctf/get-component libs (:component-file root-shape) (:component-id root-shape) {:include-deleted? true}) (let [component (ctf/get-component libs (:component-file root-shape) (:component-id root-shape) {:include-deleted? true})
@ -237,32 +237,32 @@
ref-shape (d/seek #(= (:id %) (:shape-ref shape)) component-shapes)] ref-shape (d/seek #(= (:id %) (:shape-ref shape)) component-shapes)]
(if-not (and component component-file component-shapes) (if-not (and component component-file component-shapes)
(do (do
;; (prn (str " -> Shape " (:name shape) " " (:id shape) " shape-ref " (:shape-ref shape))) ;; (println " -> Shape " (:name shape) (:id shape) " shape-ref " (:shape-ref shape))
;; (when-not component (prn " (component not found)")) ;; (when-not component (println " (component not found)"))
;; (when-not component-file (prn " (component-file not found)")) ;; (when-not component-file (println " (component-file not found)"))
;; (when-not component-shapes (prn " (component-shapes not found)")) ;; (when-not component-shapes (println " (component-shapes not found)"))
shape) shape)
(if ref-shape (if ref-shape
shape ; This means that the copy is not nested, or this script already was run shape ; This means that the copy is not nested, or this script already was run
(let [near-shape (d/seek #(= (:shape-ref %) (:shape-ref shape)) component-shapes)] (let [near-shape (d/seek #(= (:shape-ref %) (:shape-ref shape)) component-shapes)]
(if near-shape (if near-shape
(do (do
(prn (str " -> Shape " (:name shape) " " (:id shape) " shape-ref " (:shape-ref shape))) (println " -> Shape " (:name shape) (:id shape) " shape-ref " (:shape-ref shape))
(prn (str " new ref-shape " (:id near-shape))) (println " new ref-shape " (:id near-shape))
(assoc shape :shape-ref (:id near-shape))) (assoc shape :shape-ref (:id near-shape)))
(do (do
;; We assume in this case that this is a fostered sub instance, so we do nothing ;; We assume in this case that this is a fostered sub instance, so we do nothing
;; (prn (str " -> Shape " (:name shape) " " (:id shape) " shape-ref " (:shape-ref shape))) ;; (println " -> Shape " (:name shape) (:id shape) " shape-ref " (:shape-ref shape))
;; (prn " (near-shape not found)") ;; (println (near-shape not found)")
shape)))))) shape))))))
(do (do
;; (prn (str " -> Shape " (:name shape) " " (:id shape) " shape-ref " (:shape-ref shape))) ;; (println " -> Shape " (:name shape) (:id shape) " shape-ref " (:shape-ref shape))
;; (prn " (root shape not found)") ;; (println " (root shape not found)")
shape)))))) shape))))))
update-page update-page
(fn [page] (fn [page]
(prn (str "Page " (:name page))) (println "Page " (:name page))
(h/update-shapes page (partial update-shape page)))] (h/update-shapes page (partial update-shape page)))]
(-> file (-> file
@ -285,10 +285,10 @@
(defn fix-main-shape-name (defn fix-main-shape-name
([file] ([file]
(prn (str "Updating " (:name file) " " (:id file))) (println "Updating " (:name file) (:id file))
(if-not (contains? (:features file) "components/v2") (if-not (contains? (:features file) "components/v2")
(do (do
(prn " This file is not v2") (println " This file is not v2")
file) file)
(let [libs (->> (files/get-file-libraries h/*conn* (:id file)) (let [libs (->> (files/get-file-libraries h/*conn* (:id file))
(cons file) (cons file)
@ -309,7 +309,7 @@
update-page update-page
(fn [page] (fn [page]
(prn (str "Page " (:name page))) (println "Page " (:name page))
(h/update-shapes page update-shape))] (h/update-shapes page update-shape))]
(-> file (-> file
@ -355,7 +355,7 @@
true) true)
(gsh/close-attrs? attr (get shape attr) (get ref-shape attr)))] (gsh/close-attrs? attr (get shape attr) (get ref-shape attr)))]
(when (and (not equal?) (not (cph/touched-group? shape group))) (when (and (not equal?) (not (cph/touched-group? shape group)))
(prn (str " -> set touched " (:name shape) " " (:id shape) " " attr " " group " "))) (println " -> set touched " (:name shape) (:id shape) attr group))
(cond-> shape (cond-> shape
(and (not equal?) (not (cph/touched-group? shape group))) (and (not equal?) (not (cph/touched-group? shape group)))
(update :touched cph/set-touched-group group)))))] (update :touched cph/set-touched-group group)))))]
@ -366,10 +366,10 @@
shape)) shape))
update-page (fn [page] update-page (fn [page]
(prn (str "Page " (:name page))) (println "Page " (:name page))
(h/update-shapes page (partial update-shape page)))] (h/update-shapes page (partial update-shape page)))]
(prn (str "Updating " (:name file) " " (:id file))) (println "Updating " (:name file) (:id file))
(update file :data h/update-pages update-page))) (update file :data h/update-pages update-page)))
([file save?] ([file save?]