mirror of
https://github.com/penpot/penpot.git
synced 2025-05-05 09:15:53 +02:00
✨ Only print version on browser execution context.
This commit is contained in:
parent
6fc90e20e9
commit
ea2079f36f
2 changed files with 28 additions and 11 deletions
|
@ -15,13 +15,18 @@
|
||||||
|
|
||||||
(defn parse
|
(defn parse
|
||||||
[version]
|
[version]
|
||||||
(if (= version "%version%")
|
(cond
|
||||||
|
(= version "%version%")
|
||||||
{:full "develop"
|
{:full "develop"
|
||||||
:base "develop"
|
:base "develop"
|
||||||
:build 0
|
:build 0
|
||||||
:commit nil}
|
:commit nil}
|
||||||
|
|
||||||
|
(string? version)
|
||||||
(let [[base build commit] (str/split version #"-" 3)]
|
(let [[base build commit] (str/split version #"-" 3)]
|
||||||
{:full version
|
{:full version
|
||||||
:base base
|
:base base
|
||||||
:build (d/parse-integer build)
|
:build (d/parse-integer build)
|
||||||
:commit commit})))
|
:commit commit})
|
||||||
|
|
||||||
|
:else nil))
|
||||||
|
|
|
@ -48,6 +48,17 @@
|
||||||
(check-macos?) :macos
|
(check-macos?) :macos
|
||||||
:else :other)))
|
:else :other)))
|
||||||
|
|
||||||
|
(defn- parse-target
|
||||||
|
[global]
|
||||||
|
(if (some? (obj/get global "document"))
|
||||||
|
:browser
|
||||||
|
:webworker))
|
||||||
|
|
||||||
|
(defn- parse-version
|
||||||
|
[global]
|
||||||
|
(-> (obj/get global "appVersion")
|
||||||
|
(v/parse)))
|
||||||
|
|
||||||
;; --- Globar Config Vars
|
;; --- Globar Config Vars
|
||||||
|
|
||||||
(def default-theme "default")
|
(def default-theme "default")
|
||||||
|
@ -61,26 +72,27 @@
|
||||||
(def worker-uri (obj/get global "appWorkerURI" "/js/worker.js"))
|
(def worker-uri (obj/get global "appWorkerURI" "/js/worker.js"))
|
||||||
(def public-uri (or (obj/get global "appPublicURI")
|
(def public-uri (or (obj/get global "appPublicURI")
|
||||||
(.-origin ^js js/location)))
|
(.-origin ^js js/location)))
|
||||||
(def version (v/parse (obj/get global "appVersion"))))
|
|
||||||
|
|
||||||
|
|
||||||
(def media-uri (str public-uri "/media"))
|
(def media-uri (str public-uri "/media"))
|
||||||
(def browser (parse-browser))
|
(def version (delay (parse-version global)))
|
||||||
(def platform (parse-platform))
|
(def target (delay (parse-target global)))
|
||||||
|
(def browser (delay (parse-browser)))
|
||||||
|
(def platform (delay (parse-platform))))
|
||||||
|
|
||||||
|
|
||||||
|
(when (= :browser @target)
|
||||||
(js/console.log
|
(js/console.log
|
||||||
(str/format "Welcome to penpot! Version: '%s'" (:full version)))
|
(str/format "Welcome to penpot! Version: '%s'." (:full @version))))
|
||||||
|
|
||||||
;; --- Helper Functions
|
;; --- Helper Functions
|
||||||
|
|
||||||
|
|
||||||
(defn ^boolean check-browser? [candidate]
|
(defn ^boolean check-browser? [candidate]
|
||||||
(us/verify ::browser candidate)
|
(us/verify ::browser candidate)
|
||||||
(= candidate browser))
|
(= candidate @browser))
|
||||||
|
|
||||||
(defn ^boolean check-platform? [candidate]
|
(defn ^boolean check-platform? [candidate]
|
||||||
(us/verify ::platform candidate)
|
(us/verify ::platform candidate)
|
||||||
(= candidate platform))
|
(= candidate @platform))
|
||||||
|
|
||||||
(defn resolve-media-path
|
(defn resolve-media-path
|
||||||
[path]
|
[path]
|
||||||
|
|
Loading…
Add table
Reference in a new issue