浏览代码

enhance: add more deprecated file config keys and migrate on import

Gabriel Horner 1 年之前
父节点
当前提交
2646a4cfbc
共有 3 个文件被更改,包括 28 次插入9 次删除
  1. 1 3
      .carve/ignore
  2. 3 2
      src/main/frontend/components/imports.cljs
  3. 24 4
      src/main/frontend/handler/common/config_edn.cljs

+ 1 - 3
.carve/ignore

@@ -96,7 +96,5 @@ frontend.ui/_emoji-init-data
 frontend.db.rtc.op-mem-layer/_sync-loop
 ;; Used by shadow.cljs
 frontend.db-worker/init
-;; For defonce
-frontend.persist-db.browser/_do_not_reload_worker
 ;; WIP fn, remove when it's ready
-frontend.db.rtc.asset-sync/<loop-for-assets-sync
+frontend.db.rtc.asset-sync/<loop-for-assets-sync

+ 3 - 2
src/main/frontend/components/imports.cljs

@@ -28,7 +28,8 @@
             [promesa.core :as p]
             [borkdude.rewrite-edn :as rewrite]
             [rum.core :as rum]
-            [frontend.handler.repo :as repo-handler]))
+            [frontend.handler.repo :as repo-handler]
+            [frontend.handler.common.config-edn :as config-edn-common-handler]))
 
 ;; Can't name this component as `frontend.components.import` since shadow-cljs
 ;; will complain about it.
@@ -211,7 +212,7 @@
       (p/then (fn [content]
                 (let [migrated-content (-> (reduce rewrite/dissoc
                                                    (rewrite/parse-string (str content))
-                                                   [:preferred-format :property/separated-by-commas])
+                                                   (keys config-edn-common-handler/file-only-config))
                                            str)]
                   (p/do!
                    (db-editor-handler/save-file! "logseq/config.edn" migrated-content))

+ 24 - 4
src/main/frontend/handler/common/config_edn.cljs

@@ -86,6 +86,29 @@ nested keys or positional errors e.g. tuples"
       :else
       (validate-config-map parsed-body schema path))))
 
+(def file-only-config
+  "File only config that is deprecated in DB graphs"
+  {:preferred-format
+   "is not used in DB graphs as there is only markdown mode."
+   :property/separated-by-commas
+   "is not used in DB graphs"
+   :property-pages/enabled?
+   "is not used in DB graphs as all properties have pages"
+   :property-pages/excludelist
+   "is not used in DB graphs"
+   :hidden
+   "is not used in DB graphs"
+   :org-mode/insert-file-link?
+   "is not used in DB graphs"
+   :block-hidden-properties
+   "is not used in DB graphs as hiding a property is done in its configuration"
+   :ignored-page-references-keywords
+   "is not used in DB graphs"
+   :file/name-format
+   "is not used in DB graphs"
+   :feature/enable-block-timestamps?
+   "is not used in DB graphs as it is always enabled"})
+
 (defn detect-deprecations
   "Detects config keys that will or have been deprecated"
   [path content {:keys [db-graph?]}]
@@ -96,10 +119,7 @@ nested keys or positional errors e.g. tuples"
                    "is no longer supported. Please use '/' and report bugs on it."}
                    db-graph?
                    (merge
-                    {:preferred-format
-                     "is not used in DB graphs as there is only markdown mode."
-                     :property/separated-by-commas
-                     "is not used in DB graphs"}))]
+                    file-only-config))]
     (cond
       (= body ::failed-to-detect)
       (log/info :msg "Skip deprecation check since config is not valid edn")