mirror of
https://github.com/penpot/penpot.git
synced 2026-03-20 17:33:44 +00:00
* ✨ Use update-when for update dashboard state This make updates more consistent and reduces possible eventual consistency issues in out of order events execution. * 🐛 Detect stale JS modules at boot and force reload When the browser serves cached JS files from a previous deployment alongside a fresh index.html, code-split modules reference keyword constants that do not exist in the stale shared.js, causing TypeError crashes. This adds a compile-time version tag (via goog-define / closure-defines) that is baked into the JS bundle. At boot, it is compared against the runtime version tag from index.html (which is always fresh due to no-cache headers). If they differ, the app forces a hard page reload before initializing, ensuring all JS modules come from the same build. * 📎 Ensure consistent version across builds on github e2e test workflow --------- Signed-off-by: Andrey Antukh <niwi@niwi.nz>
172 lines
4.8 KiB
Clojure
172 lines
4.8 KiB
Clojure
{:deps {:aliases [:dev]}
|
|
:http {:port #shadow/env ["HTTP_PORT" :as :int :default 3448]}
|
|
:nrepl {:port #shadow/env ["NREPL_PORT" :as :int :default 3447] :host "0.0.0.0"}
|
|
:dev-http {#shadow/env ["DEV_PORT" :as :int :default 8888] "classpath:public"}
|
|
:cache-dir #shadow/env ["CACHE" :default ".shadow-cljs"]
|
|
|
|
:builds
|
|
{:main
|
|
{:target :esm
|
|
:output-dir "resources/public/js/"
|
|
:asset-path "/js"
|
|
:devtools {:watch-dir "resources/public"
|
|
:reload-strategy :full}
|
|
:build-options {:manifest-name "manifest.json"}
|
|
:modules
|
|
{:shared
|
|
{:entries []}
|
|
|
|
:main
|
|
{:entries [app.main app.plugins.api]
|
|
:depends-on #{:shared}
|
|
:exports {init app.main/init}}
|
|
|
|
:util-highlight
|
|
{:entries [app.util.code-highlight]
|
|
:depends-on #{:shared}}
|
|
|
|
:main-auth
|
|
{:entries [app.main.ui.auth
|
|
app.main.ui.auth.verify-token]
|
|
:depends-on #{:shared}}
|
|
|
|
:main-viewer
|
|
{:entries [app.main.ui.viewer]
|
|
:depends-on #{:shared :main-auth}}
|
|
|
|
:main-workspace
|
|
{:entries [app.main.ui.workspace]
|
|
:depends-on #{:shared}}
|
|
|
|
:main-dashboard
|
|
{:entries [app.main.ui.dashboard]
|
|
:depends-on #{:shared}}
|
|
|
|
:main-settings
|
|
{:entries [app.main.ui.settings]
|
|
:depends-on #{:shared}}
|
|
|
|
:render
|
|
{:entries [app.render]
|
|
:depends-on #{:shared}
|
|
:exports {init app.render/init}}
|
|
|
|
:rasterizer
|
|
{:entries [app.rasterizer]
|
|
:depends-on #{:shared}
|
|
:exports {init app.rasterizer/init}}}
|
|
|
|
:js-options
|
|
{:entry-keys ["module" "browser" "main"]
|
|
:export-conditions ["module" "import", "browser" "require" "default"]
|
|
:js-provider :external
|
|
:external-index "target/index.js"
|
|
:external-index-format :esm}
|
|
|
|
:compiler-options
|
|
{:output-feature-set :es2020
|
|
:output-wrapper false
|
|
:warnings {:fn-deprecated false}}
|
|
|
|
:release
|
|
{:closure-defines {goog.DEBUG false
|
|
goog.debug.LOGGING_ENABLED true
|
|
app.config/compiled-version-tag #shadow/env ["VERSION_TAG" :default "develop"]}
|
|
:compiler-options
|
|
{:fn-invoke-direct true
|
|
:optimizations #shadow/env ["PENPOT_BUILD_OPTIMIZATIONS" :as :keyword :default :advanced]
|
|
:source-map true
|
|
:pseudo-names true
|
|
:elide-asserts true
|
|
:anon-fn-naming-policy :off
|
|
:cross-chunk-method-motion false
|
|
:source-map-detail-level :all}}}
|
|
|
|
:worker
|
|
{:target :browser
|
|
:output-dir "resources/public/js/worker/"
|
|
:asset-path "/js/worker"
|
|
:devtools {:browser-inject :main
|
|
:watch-dir "resources/public"
|
|
:reload-strategy :full}
|
|
:build-options {:manifest-name "manifest.json"}
|
|
:modules
|
|
{:main
|
|
{:entries [app.worker]
|
|
:web-worker true
|
|
:prepend-js "importScripts('./render.js');"
|
|
:depends-on #{}}}
|
|
|
|
:js-options
|
|
{:entry-keys ["module" "browser" "main"]
|
|
:export-conditions ["module" "import", "browser" "require" "default"]}
|
|
|
|
:compiler-options
|
|
{:output-feature-set :es2020
|
|
:output-wrapper false
|
|
:warnings {:fn-deprecated false}}
|
|
|
|
:release
|
|
{:compiler-options
|
|
{:fn-invoke-direct true
|
|
:optimizations #shadow/env ["PENPOT_BUILD_OPTIMIZATIONS" :as :keyword :default :advanced]
|
|
:output-wrapper true
|
|
:rename-prefix-namespace "PENPOT"
|
|
:source-map true
|
|
:elide-asserts true
|
|
:anon-fn-naming-policy :off
|
|
:source-map-detail-level :all}}}
|
|
|
|
;; FIXME: maybe rename to :components ? (there are nothing storybook
|
|
;; related, is just an ESM export of components that will be used
|
|
;; initially on storybook but not limited to storybook)
|
|
:storybook
|
|
{:target :esm
|
|
:output-dir "target/storybook/"
|
|
:devtools {:enabled false
|
|
:console-support false}
|
|
:js-options
|
|
{:js-provider :import
|
|
:entry-keys ["module" "browser" "main"]
|
|
:export-conditions ["module" "import", "browser" "require" "default"]}
|
|
|
|
:modules
|
|
{:components
|
|
{:exports {default app.main.ui.ds/default
|
|
helpers app.main.ui.ds.helpers/default}
|
|
:prepend-js ";(globalThis.goog.provide = globalThis.goog.constructNamespace_);(globalThis.goog.require = globalThis.goog.module.get);"
|
|
:depends-on #{}}}
|
|
|
|
:compiler-options
|
|
{:output-feature-set :es-next
|
|
:output-wrapper false
|
|
:warnings {:fn-deprecated false}}}
|
|
|
|
:test
|
|
{:target :esm
|
|
:output-dir "target/tests"
|
|
:runtime :custom
|
|
:js-options {:js-provider :import}
|
|
|
|
|
|
:modules
|
|
{:test {:init-fn frontend-tests.runner/init
|
|
:prepend-js ";if (typeof globalThis.navigator?.userAgent === 'undefined') { globalThis.navigator = {userAgent: ''}; };"}}}
|
|
|
|
:bench
|
|
{:target :node-script
|
|
:output-to "target/bench.js"
|
|
:output-dir "target/bench/"
|
|
:main bench/main
|
|
|
|
:compiler-options
|
|
{:output-feature-set :es2020
|
|
:output-wrapper false
|
|
:warnings {:fn-deprecated false}}
|
|
|
|
:release
|
|
{:compiler-options
|
|
{:fn-invoke-direct true
|
|
:elide-asserts true
|
|
:anon-fn-naming-policy :off}}}}}
|