fix: mobile build

This commit is contained in:
Tienson Qin
2025-07-28 18:31:29 +08:00
parent 7f18e941d0
commit 88dfaf8ebd
5 changed files with 91 additions and 31 deletions

87
externs/mobile.txt Normal file
View File

@@ -0,0 +1,87 @@
require
DEBUG
convertFileSrc
getPlatform
handleError
isLoggingEnabled
isNative
isNativePlatform
isPluginAvailable
platform
pluginMethodNoop
registerPlugin
registerHelper
Pass
showHint
createRef
call
setState
forceUpdate
memo
createElement
render
unmount
createContext
createPortal
createRef
createElement
ref
path
current
useState
useReducer
useEffect
useLayoutEffect
useCallback
useMemo
useRef
renderToString
idb-keyval
newStore
isError
value
CodeMirror
over
forEachNode
on
getTextArea
setUser
nativeEvent
which
multipliedBy
minus
plus
isInteger
isPositive
isLessThan
toNumber
modulo
exponentiatedBy
dividedBy
multipliedBy
negated
isZero
isGreaterThanOrEqualTo
isLessThan
shiftedBy
s
dividedToIntegerBy
abs
toFraction
e
getCursor
getLineTokens
getTokenAt
getValue
completionActive
state
mime
getWrapperElement
doc
lastLine
getLine
setOption
string
dispose
path
base64String

View File

@@ -78,8 +78,8 @@
"gulp:mobile-watch": "gulp watchMobile",
"css:mobile-build": "postcss tailwind.mobile.css -o static/mobile/style.css --verbose --env production",
"css:mobile-watch": "cross-env TAILWIND_MODE=watch postcss tailwind.mobile.css -o static/mobile/style.css --verbose --watch",
"cljs:mobile-watch": "clojure -M:cljs watch mobile workers",
"cljs:release-mobile": "clojure -M:cljs release mobile workers",
"cljs:mobile-watch": "clojure -M:cljs watch mobile workers --config-merge \"{:output-dir \\\"./static/mobile/js\\\" :asset-path \\\"/static/mobile/js\\\" :release {:asset-path \\\"http://localhost\\\"}}\"",
"cljs:release-mobile": "clojure -M:cljs release mobile workers --config-merge \"{:output-dir \\\"./static/mobile/js\\\" :asset-path \\\"/static/mobile/js\\\" :release {:asset-path \\\"http://localhost\\\"}}\"",
"cljs:dev-watch": "clojure -M:cljs watch app workers electron mobile",
"cljs:app-watch": "clojure -M:cljs watch app workers",
"cljs:electron-watch": "clojure -M:cljs watch app workers electron --config-merge \"{:asset-path \\\"./js\\\"}\"",

View File

@@ -37,7 +37,6 @@ const portal = new MagicPortal(worker);
<script defer src="./js/amplify.js"></script>
<script defer src="./ionic.js"></script>
<script defer src="./js/main-bundle.js"></script>
<script defer src="./js/shared.js"></script>
<script defer src="./js/main.js"></script>
<script>
document.addEventListener('DOMContentLoaded', () => {

View File

@@ -101,11 +101,6 @@
:redef false}
:cross-chunk-method-motion false}
:closure-defines {goog.debug.LOGGING_ENABLED true}
;; NOTE: electron, browser/mobile-app use different asset-paths.
;; For browser/mobile-app devs, assets are located in /static/js(via HTTP root).
;; For electron devs, assets are located in ./js(via relative path).
;; :dev {:asset-path "./js"}
:devtools {:before-load frontend.core/stop ;; before live-reloading any code call this function
:after-load frontend.core/start ;; after live-reloading finishes call this function
:watch-path "/static"
@@ -124,11 +119,8 @@
"react-dom" {:target :global
:global "ReactDOM"}}}
;; handle `require(xxx.css)`
:modules {:shared
{:entries []}
:main
{:init-fn mobile.core/init
:depends-on #{:shared}}
:modules {:main
{:init-fn mobile.core/init}
:code-editor
{:entries [frontend.extensions.code]
:depends-on #{:main}}}

View File

@@ -12,24 +12,6 @@
(string/trim out))
(println err))))
(defn purge-css
{:shadow.build/stage :flush}
[state {:keys [css-source
js-globs
public-dir]}]
(case (:shadow.build/mode state)
:release
(exec "purgecss --css " css-source
(for [content (if (string? js-globs) [js-globs] js-globs)]
(str "--content " content))
"-o" public-dir)
:dev
(do
(exec "mkdir -p" public-dir)
(exec "cp" css-source (str public-dir "/" (last (string/split css-source #"/"))))))
state)
(defn git-revision-hook
{:shadow.build/stage :configure}
[build-state & args]