mirror of
https://github.com/logseq/logseq.git
synced 2026-02-01 22:47:36 +00:00
replace capacitor with mobile
This commit is contained in:
@@ -6,7 +6,7 @@ const version = fs.readFileSync('static/package.json', 'utf8').match(/"version":
|
||||
const config: CapacitorConfig = {
|
||||
appId: 'com.logseq.app',
|
||||
appName: 'Logseq',
|
||||
webDir: 'static/capacitor',
|
||||
webDir: 'static/mobile',
|
||||
loggingBehavior: 'debug',
|
||||
server: {
|
||||
androidScheme: 'http',
|
||||
|
||||
22
gulpfile.js
22
gulpfile.js
@@ -23,8 +23,8 @@ const css = {
|
||||
})
|
||||
},
|
||||
|
||||
watchCapacitorNewCSS () {
|
||||
return cp.spawn(`yarn css:capacitor-new-watch`, {
|
||||
watchMobileCSS () {
|
||||
return cp.spawn(`yarn css:mobile-watch`, {
|
||||
shell: true,
|
||||
stdio: 'inherit',
|
||||
})
|
||||
@@ -37,9 +37,9 @@ const css = {
|
||||
)(...params)
|
||||
},
|
||||
|
||||
buildCapacitorCSS (...params) {
|
||||
buildMobileCSS (...params) {
|
||||
return gulp.series(
|
||||
() => exec(`yarn css:capacitor-new-build`, {}),
|
||||
() => exec(`yarn css:mobile-build`, {}),
|
||||
)(...params)
|
||||
},
|
||||
|
||||
@@ -130,10 +130,10 @@ const common = {
|
||||
'packages/amplify/dist/amplify.js',
|
||||
'packages/ui/dist/ui/ui.js',
|
||||
'node_modules/@logseq/sqlite-wasm/sqlite-wasm/jswasm/sqlite3.wasm',
|
||||
]).pipe(gulp.dest(path.join(outputPath, 'capacitor', 'js'))),
|
||||
]).pipe(gulp.dest(path.join(outputPath, 'mobile', 'js'))),
|
||||
() => gulp.src([
|
||||
'packages/ui/dist/ionic/*.js',
|
||||
]).pipe(gulp.dest(path.join(outputPath, 'capacitor'))),
|
||||
]).pipe(gulp.dest(path.join(outputPath, 'mobile'))),
|
||||
)(...params)
|
||||
},
|
||||
|
||||
@@ -146,7 +146,7 @@ const common = {
|
||||
return gulp.src([
|
||||
outputFilePath,
|
||||
'!' + path.join(outputPath, 'node_modules/**'),
|
||||
'!' + path.join(outputPath, 'capacitor/**'),
|
||||
'!' + path.join(outputPath, 'mobile/**'),
|
||||
'!' + path.join(outputPath, 'android/**'),
|
||||
'!' + path.join(outputPath, 'ios/**'),
|
||||
]).pipe(gulp.dest(publicRootPath))
|
||||
@@ -275,10 +275,10 @@ exports.watch = gulp.series(
|
||||
common.syncResourceFile,
|
||||
common.syncAssetFiles, common.switchReactDevelopmentMode,
|
||||
gulp.parallel(common.keepSyncResourceFile, css.watchCSS))
|
||||
exports.watchCapacitorNew = gulp.series(
|
||||
exports.watchMobile = gulp.series(
|
||||
common.syncResourceFile, common.syncAssetFiles,
|
||||
gulp.parallel(common.keepSyncResourceFile, css.watchCapacitorNewCSS))
|
||||
gulp.parallel(common.keepSyncResourceFile, css.watchMobileCSS))
|
||||
exports.build = gulp.series(common.clean, common.syncResourceFile,
|
||||
common.syncAssetFiles, css.buildCSS)
|
||||
exports.buildCapacitorNew = gulp.series(common.clean, common.syncResourceFile,
|
||||
common.syncAssetFiles, css.buildCapacitorCSS)
|
||||
exports.buildMobile = gulp.series(common.clean, common.syncResourceFile,
|
||||
common.syncAssetFiles, css.buildMobileCSS)
|
||||
|
||||
22
package.json
22
package.json
@@ -48,34 +48,34 @@
|
||||
"watch": "run-p gulp:watch cljs:watch",
|
||||
"electron-watch": "run-p gulp:watch cljs:electron-watch",
|
||||
"app-watch": "run-p gulp:watch cljs:app-watch",
|
||||
"dev": "run-p gulp:watch gulp:capacitor-new-watch cljs:dev-watch",
|
||||
"dev": "run-p gulp:watch gulp:mobile-watch cljs:dev-watch",
|
||||
"release": "run-s gulp:build cljs:release",
|
||||
"release-app": "run-s gulp:build cljs:release-app",
|
||||
"release-capacitor-new": "run-s gulp:buildCapacitorNew cljs:release-capacitor-new",
|
||||
"release-mobile": "run-s gulp:buildMobile cljs:release-mobile",
|
||||
"dev-release-app": "run-s gulp:build cljs:dev-release-app",
|
||||
"dev-electron-app": "gulp electron",
|
||||
"release-electron": "run-s gulp:build && gulp electronMaker",
|
||||
"debug-electron": "cd static/ && yarn electron:debug",
|
||||
"e2e-test": "cross-env DEBUG=pw:api CI=true npx playwright test --reporter github",
|
||||
"sync-android-release": "yarn clean && yarn release-capacitor-new && rm -rf ./static/capacitor/**/*.map && npx cap sync android",
|
||||
"sync-ios-release": "yarn clean && yarn release-capacitor-new && rm -rf ./static/capacitor/**/*.map && npx cap sync ios",
|
||||
"sync-android-release": "yarn clean && yarn release-mobile && rm -rf ./static/mobile/**/*.map && npx cap sync android",
|
||||
"sync-ios-release": "yarn clean && yarn release-mobile && rm -rf ./static/mobile/**/*.map && npx cap sync ios",
|
||||
"clean": "gulp clean",
|
||||
"test": "run-s cljs:test cljs:run-test",
|
||||
"report": "run-s cljs:report",
|
||||
"style:lint": "stylelint \"src/**/*.css\"",
|
||||
"gulp:watch": "gulp watch",
|
||||
"gulp:build": "cross-env NODE_ENV=production gulp build",
|
||||
"gulp:buildCapacitorNew": "cross-env NODE_ENV=production gulp buildCapacitorNew",
|
||||
"gulp:buildMobile": "cross-env NODE_ENV=production gulp buildMobile",
|
||||
"css:build": "postcss tailwind.all.css -o static/css/style.css --verbose --env production",
|
||||
"css:watch": "cross-env TAILWIND_MODE=watch postcss tailwind.all.css -o static/css/style.css --verbose --watch",
|
||||
"cljs:watch": "clojure -M:cljs watch app electron",
|
||||
"cljs:storybook-watch": "clojure -M:cljs watch stories-dev",
|
||||
"gulp:capacitor-new-watch": "gulp watchCapacitorNew",
|
||||
"css:capacitor-new-build": "postcss tailwind.capacitor.css -o static/capacitor/style.css --verbose --env production",
|
||||
"css:capacitor-new-watch": "cross-env TAILWIND_MODE=watch postcss tailwind.capacitor.css -o static/capacitor/style.css --verbose --watch",
|
||||
"cljs:capacitor-new-watch": "clojure -M:cljs watch capacitor-new",
|
||||
"cljs:release-capacitor-new": "clojure -M:cljs release capacitor-new",
|
||||
"cljs:dev-watch": "clojure -M:cljs watch app electron capacitor-new",
|
||||
"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",
|
||||
"cljs:release-mobile": "clojure -M:cljs release mobile",
|
||||
"cljs:dev-watch": "clojure -M:cljs watch app electron mobile",
|
||||
"cljs:app-watch": "clojure -M:cljs watch app",
|
||||
"cljs:electron-watch": "clojure -M:cljs watch app electron --config-merge \"{:asset-path \\\"./js\\\"}\"",
|
||||
"cljs:release": "clojure -M:cljs release app publishing electron",
|
||||
|
||||
@@ -2,10 +2,10 @@
|
||||
{:deps true
|
||||
:nrepl {:port 8701}
|
||||
|
||||
;; :ssl {:password "logseq"}
|
||||
:ssl {:password "logseq"}
|
||||
;; "." for /static
|
||||
:dev-http {3001 ["static" "."]
|
||||
3002 "static/capacitor"
|
||||
3002 "static/mobile"
|
||||
8021 "static/rtc-e2e-test"}
|
||||
|
||||
:js-options {:js-package-dirs ["node_modules" "packages/tldraw/apps"]}
|
||||
@@ -69,54 +69,52 @@
|
||||
:preloads [devtools.preload
|
||||
shadow.remote.runtime.cljs.browser]}}
|
||||
|
||||
:capacitor-new {:target :browser
|
||||
:module-loader true
|
||||
:js-options {:ignore-asset-requires true
|
||||
:resolve {"react" {:target :global
|
||||
:global "React"}
|
||||
"react-dom" {:target :global
|
||||
:global "ReactDOM"}}} ;; handle `require(xxx.css)`
|
||||
:modules {:shared
|
||||
{:entries []}
|
||||
:main
|
||||
{:init-fn capacitor.core/init
|
||||
:depends-on #{:shared}}
|
||||
:code-editor
|
||||
{:entries [frontend.extensions.code]
|
||||
:depends-on #{:main}}
|
||||
:db-worker
|
||||
{:init-fn frontend.worker.db-worker/init
|
||||
:depends-on #{:shared}
|
||||
:web-worker true}}
|
||||
:mobile {:target :browser
|
||||
:module-loader true
|
||||
:js-options {:ignore-asset-requires true
|
||||
:resolve {"react" {:target :global
|
||||
:global "React"}
|
||||
"react-dom" {:target :global
|
||||
:global "ReactDOM"}}} ;; handle `require(xxx.css)`
|
||||
:modules {:shared
|
||||
{:entries []}
|
||||
:main
|
||||
{:init-fn mobile.core/init
|
||||
:depends-on #{:shared}}
|
||||
:code-editor
|
||||
{:entries [frontend.extensions.code]
|
||||
:depends-on #{:main}}
|
||||
:db-worker
|
||||
{:init-fn frontend.worker.db-worker/init
|
||||
:depends-on #{:shared}
|
||||
:web-worker true}}
|
||||
|
||||
:output-dir "./static/capacitor/js"
|
||||
:asset-path "./js"
|
||||
:release {:asset-path "http://localhost"}
|
||||
:compiler-options {:infer-externs :auto
|
||||
:output-feature-set :es-next-in
|
||||
:source-map true
|
||||
:externs ["datascript/externs.js"
|
||||
"externs.js"]
|
||||
:warnings {:fn-deprecated false
|
||||
:redef false}
|
||||
:cross-chunk-method-motion false}
|
||||
:build-hooks [(shadow.hooks/git-revision-hook "--long --always --dirty")]
|
||||
:closure-defines
|
||||
{
|
||||
;; Set to switch file sync server to dev, set this to false in `yarn watch`
|
||||
frontend.config/ENABLE-FILE-SYNC-PRODUCTION #shadow/env ["ENABLE_FILE_SYNC_PRODUCTION" :as :bool :default true]
|
||||
frontend.config/ENABLE-RTC-SYNC-PRODUCTION #shadow/env ["ENABLE_RTC_SYNC_PRODUCTION" :as :bool :default true]
|
||||
}
|
||||
:output-dir "./static/mobile/js"
|
||||
:asset-path "./js"
|
||||
:release {:asset-path "http://localhost"}
|
||||
:compiler-options {:infer-externs :auto
|
||||
:output-feature-set :es-next-in
|
||||
:source-map true
|
||||
:externs ["datascript/externs.js"
|
||||
"externs.js"]
|
||||
:warnings {:fn-deprecated false
|
||||
:redef false}
|
||||
:cross-chunk-method-motion false}
|
||||
:build-hooks [(shadow.hooks/git-revision-hook "--long --always --dirty")]
|
||||
:closure-defines
|
||||
{;; Set to switch file sync server to dev, set this to false in `yarn watch`
|
||||
frontend.config/ENABLE-FILE-SYNC-PRODUCTION #shadow/env ["ENABLE_FILE_SYNC_PRODUCTION" :as :bool :default true]
|
||||
frontend.config/ENABLE-RTC-SYNC-PRODUCTION #shadow/env ["ENABLE_RTC_SYNC_PRODUCTION" :as :bool :default true]}
|
||||
|
||||
;; NOTE: electron, browser/mobile-app use different asset-paths.
|
||||
;; 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 capacitor.core/stop! ;; before live-reloading any code call this function
|
||||
:after-load capacitor.core/render! ;; after live-reloading finishes call this function
|
||||
:watch-path "/static/capacitor"
|
||||
:preloads [devtools.preload
|
||||
shadow.remote.runtime.cljs.browser]}}
|
||||
:devtools {:before-load mobile.core/stop! ;; before live-reloading any code call this function
|
||||
:after-load mobile.core/render! ;; after live-reloading finishes call this function
|
||||
:watch-path "/static/mobile"
|
||||
:preloads [devtools.preload
|
||||
shadow.remote.runtime.cljs.browser]}}
|
||||
|
||||
:electron {:target :node-script
|
||||
:output-to "static/electron.js"
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
(ns frontend.handler.events.ui
|
||||
"UI events"
|
||||
(:require [capacitor.state :as mobile-state]
|
||||
[clojure.core.async :as async]
|
||||
(:require [clojure.core.async :as async]
|
||||
[clojure.core.async.interop :refer [p->c]]
|
||||
[frontend.components.cmdk.core :as cmdk]
|
||||
[frontend.components.file-sync :as file-sync]
|
||||
@@ -40,6 +39,7 @@
|
||||
[goog.dom :as gdom]
|
||||
[logseq.common.util :as common-util]
|
||||
[logseq.shui.ui :as shui]
|
||||
[mobile.state :as mobile-state]
|
||||
[promesa.core :as p]))
|
||||
|
||||
(defmethod events/handle :go/search [_]
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
(ns capacitor.components.app
|
||||
(ns mobile.components.app
|
||||
"App root"
|
||||
(:require ["../externals.js"]
|
||||
[capacitor.components.editor-toolbar :as editor-toolbar]
|
||||
[capacitor.components.modal :as modal]
|
||||
[capacitor.components.popup :as popup]
|
||||
[capacitor.components.search :as search]
|
||||
[capacitor.components.selection-toolbar :as selection-toolbar]
|
||||
[capacitor.components.settings :as settings]
|
||||
[capacitor.components.ui :as ui-component]
|
||||
[capacitor.ionic :as ion]
|
||||
[capacitor.state :as mobile-state]
|
||||
[mobile.components.editor-toolbar :as editor-toolbar]
|
||||
[mobile.components.modal :as modal]
|
||||
[mobile.components.popup :as popup]
|
||||
[mobile.components.search :as search]
|
||||
[mobile.components.selection-toolbar :as selection-toolbar]
|
||||
[mobile.components.settings :as settings]
|
||||
[mobile.components.ui :as ui-component]
|
||||
[mobile.ionic :as ion]
|
||||
[mobile.state :as mobile-state]
|
||||
[clojure.string :as string]
|
||||
[frontend.components.journal :as journal]
|
||||
[frontend.components.rtc.indicator :as rtc-indicator]
|
||||
@@ -1,6 +1,6 @@
|
||||
(ns capacitor.components.editor-toolbar
|
||||
(ns mobile.components.editor-toolbar
|
||||
"Mobile editor toolbar"
|
||||
(:require [capacitor.init :as init]
|
||||
(:require [mobile.init :as init]
|
||||
[frontend.commands :as commands]
|
||||
[frontend.handler.editor :as editor-handler]
|
||||
[frontend.mobile.camera :as mobile-camera]
|
||||
@@ -1,12 +1,12 @@
|
||||
(ns capacitor.components.modal
|
||||
(ns mobile.components.modal
|
||||
"Mobile modal"
|
||||
(:require ["../externals.js"]
|
||||
[capacitor.components.editor-toolbar :as mobile-bar]
|
||||
[capacitor.components.selection-toolbar :as selection-toolbar]
|
||||
[capacitor.components.ui :as mobile-ui]
|
||||
[capacitor.init :as init]
|
||||
[capacitor.ionic :as ion]
|
||||
[capacitor.state :as mobile-state]
|
||||
[mobile.components.editor-toolbar :as mobile-bar]
|
||||
[mobile.components.selection-toolbar :as selection-toolbar]
|
||||
[mobile.components.ui :as mobile-ui]
|
||||
[mobile.init :as init]
|
||||
[mobile.ionic :as ion]
|
||||
[mobile.state :as mobile-state]
|
||||
[frontend.components.page :as page]
|
||||
[frontend.db :as db]
|
||||
[frontend.handler.notification :as notification]
|
||||
@@ -1,7 +1,7 @@
|
||||
(ns capacitor.components.popup
|
||||
(ns mobile.components.popup
|
||||
"Mobile popup"
|
||||
(:require [capacitor.ionic :as ion]
|
||||
[capacitor.state :as mobile-state]
|
||||
(:require [mobile.ionic :as ion]
|
||||
[mobile.state :as mobile-state]
|
||||
[dommy.core :as dom]
|
||||
[logseq.shui.popup.core :as shui-popup]
|
||||
[logseq.shui.ui :as shui]
|
||||
@@ -1,7 +1,7 @@
|
||||
(ns capacitor.components.search
|
||||
(ns mobile.components.search
|
||||
"Mobile search"
|
||||
(:require [capacitor.ionic :as ion]
|
||||
[capacitor.state :as mobile-state]
|
||||
(:require [mobile.ionic :as ion]
|
||||
[mobile.state :as mobile-state]
|
||||
[clojure.string :as string]
|
||||
[frontend.components.cmdk.core :as cmdk]
|
||||
[frontend.db :as db]
|
||||
@@ -1,4 +1,4 @@
|
||||
(ns capacitor.components.selection-toolbar
|
||||
(ns mobile.components.selection-toolbar
|
||||
"Selection action bar, activated when swipe on a block"
|
||||
(:require [frontend.db :as db]
|
||||
[frontend.handler.editor :as editor-handler]
|
||||
@@ -1,6 +1,6 @@
|
||||
(ns capacitor.components.settings
|
||||
(ns mobile.components.settings
|
||||
"Mobile settings"
|
||||
(:require [capacitor.ionic :as ion]
|
||||
(:require [mobile.ionic :as ion]
|
||||
[frontend.components.repo :as repo]
|
||||
[frontend.components.user.login :as login]
|
||||
[frontend.handler.user :as user-handler]
|
||||
@@ -1,7 +1,7 @@
|
||||
(ns capacitor.components.ui
|
||||
(ns mobile.components.ui
|
||||
"Mobile ui"
|
||||
(:require [capacitor.ionic :as ion]
|
||||
[capacitor.state :as mobile-state]
|
||||
(:require [mobile.ionic :as ion]
|
||||
[mobile.state :as mobile-state]
|
||||
[cljs-bean.core :as bean]
|
||||
[frontend.handler.notification :as notification]
|
||||
[frontend.rum :as r]
|
||||
@@ -1,9 +1,9 @@
|
||||
(ns capacitor.core
|
||||
(ns mobile.core
|
||||
"Mobile core"
|
||||
(:require ["react-dom/client" :as rdc]
|
||||
[capacitor.components.app :as app]
|
||||
[capacitor.init :as init]
|
||||
[capacitor.state :as state]
|
||||
[mobile.components.app :as app]
|
||||
[mobile.init :as init]
|
||||
[mobile.state :as state]
|
||||
[frontend.background-tasks]
|
||||
[frontend.components.page :as page]
|
||||
[frontend.handler :as fhandler]
|
||||
@@ -1,6 +1,6 @@
|
||||
(ns capacitor.events
|
||||
(ns mobile.events
|
||||
"Mobile events"
|
||||
(:require [capacitor.init :as init]
|
||||
(:require [mobile.init :as init]
|
||||
[frontend.handler.events :as events]
|
||||
[promesa.core :as p]))
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
(ns capacitor.init
|
||||
(ns mobile.init
|
||||
"Main ns for handling mobile start"
|
||||
(:require ["@capacitor/app" :refer [^js App]]
|
||||
["@capacitor/keyboard" :refer [^js Keyboard]]
|
||||
["@capacitor/network" :refer [^js Network]]
|
||||
[capacitor.components.ui :as cc-ui]
|
||||
[capacitor.state :as mobile-state]
|
||||
[mobile.components.ui :as cc-ui]
|
||||
[mobile.state :as mobile-state]
|
||||
[frontend.handler.editor :as editor-handler]
|
||||
[frontend.mobile.deeplink :as deeplink]
|
||||
[frontend.mobile.flows :as mobile-flows]
|
||||
@@ -1,4 +1,4 @@
|
||||
(ns capacitor.ionic
|
||||
(ns mobile.ionic
|
||||
"Ionic ui"
|
||||
(:refer-clojure :exclude [list])
|
||||
(:require [logseq.shui.icon.v2 :as shui-icon]
|
||||
@@ -1,4 +1,4 @@
|
||||
(ns capacitor.state
|
||||
(ns mobile.state
|
||||
"Mobile state"
|
||||
(:require [frontend.rum :as r]))
|
||||
|
||||
@@ -31,4 +31,4 @@
|
||||
@import "src/main/frontend/components/file_sync.css";
|
||||
@import "src/main/frontend/components/table.css";
|
||||
|
||||
@import-glob "src/main/capacitor/**/[!_]*.css";
|
||||
@import-glob "src/main/mobile/**/[!_]*.css";
|
||||
Reference in New Issue
Block a user