add timestamp version to invalid cache

This commit is contained in:
Tienson Qin
2025-12-29 20:40:20 +08:00
parent 7b7ec47069
commit 8c4be25e92
3 changed files with 24 additions and 4 deletions

View File

@@ -7,7 +7,8 @@
"watch": "clojure -M:cljs watch publish-worker",
"release": "clojure -M:cljs release publish-worker",
"clean": "rm -rf ./worker/dist/",
"deploy": "yarn clean && yarn release && cd ./worker && wrangler deploy --env prod"
"bump-publish-version": "node ./scripts/bump-publish-version.js",
"deploy": "yarn bump-publish-version && yarn clean && yarn release && cd ./worker && wrangler deploy --env prod"
},
"dependencies": {
"shadow-cljs": "^3.3.4"

View File

@@ -0,0 +1,17 @@
const fs = require("fs");
const path = require("path");
const renderPath = path.join(__dirname, "..", "src", "logseq", "publish", "render.cljs");
const source = fs.readFileSync(renderPath, "utf8");
const timestamp = Date.now();
const next = source.replace(
/\(defonce version [^)]+\)/,
`(defonce version ${timestamp})`
);
if (next === source) {
throw new Error("Failed to update logseq.publish.render/version.");
}
fs.writeFileSync(renderPath, next);

View File

@@ -9,6 +9,8 @@
[logseq.publish.common :as publish-common]
[logseq.publish.model :as publish-model]))
(defonce version 1767012226301)
(def ref-regex
(js/RegExp. "\\[\\[([0-9a-fA-F-]{36})\\]\\]|\\(\\(([0-9a-fA-F-]{36})\\)\\)" "g"))
@@ -133,7 +135,7 @@
(defn- publish-script
[]
[:script {:type "module" :src "/static/publish.js"}])
[:script {:type "module" :src (str "/static/publish.js?v=" version)}])
(defn- icon-runtime-script
[]
@@ -151,8 +153,8 @@
[:script {:defer true :src "/static/tabler.ext.js"}]
[:link {:rel "stylesheet"
:href "https://cdn.jsdelivr.net/npm/@tabler/icons-webfont@3.0/dist/tabler-icons.min.css"}]
[:link {:rel "stylesheet" :href "/static/tabler-extension.css"}]
[:link {:rel "stylesheet" :href "/static/publish.css"}]])
[:link {:rel "stylesheet" :href (str "/static/tabler-extension.css?v=" version)}]
[:link {:rel "stylesheet" :href (str "/static/publish.css?v=" version)}]])
(defn property-type
[prop-key property-type-by-ident]