✨ Build library files with current features and migrations

The file builder behind @penpot/library pinned the features and
migrations it writes to the ones Penpot 2.7 accepted, so its files
could open there. It now writes the current defaults: the features a
new file gets and every available migration. Generated files were
already in the current format (paths, for one, are stored as path
data), so they now declare fdata/path-data and components/swap-group
as they should, and the import runs no migration on them.

Files built this way need the Penpot version the library is built with,
or a later one.

AI-assisted-by: claude-opus-5-5
This commit is contained in:
alonso.torres 2026-10-13 12:22:50 +02:00
parent 570c1f3d29
commit 433d164074
2 changed files with 10 additions and 24 deletions

View File

@ -8,10 +8,10 @@
"Internal implementation of file builder. Mainly used as base impl
for penpot library"
(:require
;; [app.common.features :as cfeat]
[app.common.data :as d]
[app.common.data.macros :as dm]
[app.common.exceptions :as ex]
[app.common.features :as cfeat]
[app.common.files.changes :as ch]
[app.common.files.helpers :as cph]
[app.common.files.migrations :as fmig]
@ -194,32 +194,11 @@
(-> (get-current-objects state)
(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"
"variants/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
[state params]
(let [params (-> params
(assoc :features default-features)
(assoc :migrations available-migrations)
(assoc :features cfeat/default-features)
(assoc :migrations fmig/available-migrations)
(update :id default-uuid))
file (types.file/make-file params :create-page false)]
(-> state

View File

@ -1,5 +1,12 @@
# CHANGELOG
## Unreleased
- Generate files with the features and migrations of the Penpot version
the library is built with, instead of a fixed set from Penpot 2.7. The
files need that Penpot version or a later one to open.
## 1.2.0
- Update deps and build it with penpot 2.18.3