mirror of
https://github.com/penpot/penpot.git
synced 2025-07-25 15:57:19 +02:00
🐛 Make the library generate output compatible with penpot 2.7.x
This commit is contained in:
parent
eafea7aec9
commit
4b22a0ebfb
2 changed files with 32 additions and 4 deletions
|
@ -10,7 +10,7 @@
|
||||||
(:require
|
(:require
|
||||||
[app.common.data :as d]
|
[app.common.data :as d]
|
||||||
[app.common.data.macros :as dm]
|
[app.common.data.macros :as dm]
|
||||||
[app.common.features :as cfeat]
|
;; [app.common.features :as cfeat]
|
||||||
[app.common.files.changes :as ch]
|
[app.common.files.changes :as ch]
|
||||||
[app.common.files.migrations :as fmig]
|
[app.common.files.migrations :as fmig]
|
||||||
[app.common.geom.shapes :as gsh]
|
[app.common.geom.shapes :as gsh]
|
||||||
|
@ -198,11 +198,31 @@
|
||||||
(-> (get-current-objects state)
|
(-> (get-current-objects state)
|
||||||
(get shape-id)))
|
(get shape-id)))
|
||||||
|
|
||||||
|
;; WORKAROUND: A copy of features from staging for make the library
|
||||||
|
;; generate files compatible with version released right now. This
|
||||||
|
;; should be removed and replaced with cfeat/default-features when 2.8
|
||||||
|
;; version is released
|
||||||
|
|
||||||
|
(def default-features
|
||||||
|
#{"fdata/shape-data-type"
|
||||||
|
"styles/v2"
|
||||||
|
"layout/grid"
|
||||||
|
"components/v2"
|
||||||
|
"plugins/runtime"
|
||||||
|
"design-tokens/v1"})
|
||||||
|
|
||||||
|
;; WORKAROUND: the same as features
|
||||||
|
(def available-migrations
|
||||||
|
(-> fmig/available-migrations
|
||||||
|
(disj "003-convert-path-content")
|
||||||
|
(disj "0002-clean-shape-interactions")
|
||||||
|
(disj "0003-fix-root-shape")))
|
||||||
|
|
||||||
(defn add-file
|
(defn add-file
|
||||||
[state params]
|
[state params]
|
||||||
(let [params (-> params
|
(let [params (-> params
|
||||||
(assoc :features cfeat/default-features)
|
(assoc :features default-features)
|
||||||
(assoc :migrations fmig/available-migrations)
|
(assoc :migrations available-migrations)
|
||||||
(update :id default-uuid))
|
(update :id default-uuid))
|
||||||
file (types.file/make-file params :create-page false)]
|
file (types.file/make-file params :create-page false)]
|
||||||
(-> state
|
(-> state
|
||||||
|
|
|
@ -82,6 +82,14 @@
|
||||||
:is-shared
|
:is-shared
|
||||||
:version})
|
:version})
|
||||||
|
|
||||||
|
(defn- encode-shape*
|
||||||
|
[{:keys [type] :as shape}]
|
||||||
|
(let [shape (if (or (= type :path)
|
||||||
|
(= type :bool))
|
||||||
|
(update shape :content vec)
|
||||||
|
shape)]
|
||||||
|
(-> shape encode-shape json/encode)))
|
||||||
|
|
||||||
(defn- generate-file-export-procs
|
(defn- generate-file-export-procs
|
||||||
[{:keys [id data] :as file}]
|
[{:keys [id data] :as file}]
|
||||||
(cons
|
(cons
|
||||||
|
@ -109,7 +117,7 @@
|
||||||
(map (fn [[shape-id shape]]
|
(map (fn [[shape-id shape]]
|
||||||
(let [shape (assoc shape :page-id page-id)]
|
(let [shape (assoc shape :page-id page-id)]
|
||||||
[(str "files/" id "/pages/" page-id "/" shape-id ".json")
|
[(str "files/" id "/pages/" page-id "/" shape-id ".json")
|
||||||
(delay (-> shape encode-shape json/encode))]))
|
(delay (encode-shape* shape))]))
|
||||||
objects)))))))
|
objects)))))))
|
||||||
|
|
||||||
(->> (get data :components)
|
(->> (get data :components)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue