Просмотр исходного кода

fix: disable filename format config for db graphs

How to persist filenames and handle titles isn't relevant for db graphs.
Also updated lint to add related file-specific nss and concepts
Gabriel Horner 2 лет назад
Родитель
Сommit
3700cc37e6

+ 19 - 11
scripts/src/logseq/tasks/dev/db_and_file_graphs.clj

@@ -20,7 +20,11 @@
 (def file-graph-ns
   "Namespaces or parent namespaces _only_ for file graphs"
   (mapv escape-shell-regex
-        ["frontend.handler.file-based" "frontend.fs"]))
+        ["frontend.handler.file-based" "frontend.handler.conversion"
+         "frontend.fs"
+         "frontend.components.conversion"
+         "frontend.util.fs"
+         "frontend.modules.outliner.file"]))
 
 (def db-graph-paths
   "Paths _only_ for DB graphs"
@@ -30,7 +34,11 @@
 
 (def file-graph-paths
   "Paths _only_ for file graphs"
-  ["src/main/frontend/handler/file_based" "src/main/frontend/fs"])
+  ["src/main/frontend/handler/file_based" "src/main/frontend/handler/conversion.cljs"
+   "src/main/frontend/fs"
+   "src/main/frontend/components/conversion.cljs"
+   "src/main/frontend/util/fs.cljs"
+   "src/main/frontend/modules/outliner/file.cljs"])
 
 (defn- validate-db-ns-not-in-file
   []
@@ -63,16 +71,16 @@
       (println (:out res))
       (System/exit 1))))
 
-(defn- validate-file-attributes-not-in-db
+(defn- validate-file-concepts-not-in-db
   []
-  (let [file-attrs-str (str "("
-                            ;; from logseq.db.frontend.schema
-                            (->> [:block/properties-text-values :block/pre-block :recent/pages :file/handle :block/file :block/properties-order]
-                                 (map #(subs (str %) 1))
-                                 (string/join "|"))
-                            ")")
+  (let [file-concepts (->>
+                       ;; from logseq.db.frontend.schema
+                       [:block/properties-text-values :block/pre-block :recent/pages :file/handle :block/file :block/properties-order]
+                       (map str)
+                       ;; e.g. block/properties :title
+                       (into ["block/properties :"]))
         res (apply shell {:out :string :continue true}
-                   "git grep -E" file-attrs-str
+                   "git grep -E" (str "(" (string/join "|" file-concepts) ")")
                    db-graph-paths)]
     (when-not (and (= 1 (:exit res)) (= "" (:out res)))
       (println "The following files should not have contained file specific attributes:")
@@ -84,6 +92,6 @@
   []
   (validate-db-ns-not-in-file)
   (validate-file-ns-not-in-db)
-  (validate-file-attributes-not-in-db)
+  (validate-file-concepts-not-in-db)
   (validate-multi-graph-fns-not-in-file-or-db)
   (println "✅ All checks passed!"))

+ 4 - 1
src/main/frontend/components/settings.cljs

@@ -716,7 +716,10 @@
      (when-not (mobile-util/native-platform?) (developer-mode-row t developer-mode?))
      (when (util/electron?) (https-user-agent-row https-agent-opts))
      (when (util/electron?) (auto-chmod-row t))
-     (when (and (util/electron?) (not (config/demo-graph? current-repo))) (filename-format-row))
+     (when (and (util/electron?)
+                (not (config/demo-graph? current-repo))
+                (not (config/db-based-graph? (state/get-current-repo))))
+       (filename-format-row))
      (clear-cache-row t)
 
      (ui/admonition