Browse Source

fix: two bug with using --roundtrip

Fails hard when db is invalid and doesn't respect
--catch-validation-errors
Gabriel Horner 2 days ago
parent
commit
df70a52bba

+ 1 - 1
deps/cli/src/logseq/cli/commands/export_edn.cljs

@@ -35,7 +35,7 @@
         (if diff
           (do (println "The exported EDN's have the following diff:")
               (pprint/pprint diff)
-              (js/process.exit 1))
+              (when-not catch-validation-errors? (js/process.exit 1)))
           (println "The exported EDN roundtrips successfully!"))))))
 
 (defn- local-export [{{:keys [graph validate roundtrip] :as options} :opts}]

+ 2 - 1
deps/db/src/logseq/db/sqlite/export.cljs

@@ -1119,7 +1119,8 @@
         (do
           (js/console.error "Exported EDN has the following invalid errors when imported into a new graph:")
           (pprint/pprint errors)
-          {:error (str "The exported EDN has " (count errors) " validation error(s)")})
+          {:error (str "The exported EDN has " (count errors) " validation error(s)")
+           :db @import-conn})
         {:db @import-conn}))
     (catch :default e
       (js/console.error "Unexpected export-edn validation error:" e)