mirror of
https://github.com/logseq/logseq.git
synced 2026-05-20 10:52:38 +00:00
commita2eee34d80Merge:3025c94d2af41e7ea3Author: Tienson Qin <tiensonqin@gmail.com> Date: Mon Aug 4 23:08:38 2025 +0800 Merge pull request #12009 from logseq/feat/hnswlib+transformer-js feat: semantic search commitaf41e7ea3dMerge:a407035d83025c94d2Author: Tienson Qin <tiensonqin@gmail.com> Date: Mon Aug 4 23:08:23 2025 +0800 Merge branch 'master' into feat/hnswlib+transformer-js commita407035d80Author: Gabriel Horner <gabriel@logseq.com> Date: Mon Aug 4 10:41:55 2025 -0400 fix: app and other builds no longer require shadow-cljs config hack Reverts bug fix for347323b7d6and for other builds. This bug no longer applies b/c :shared is no longer used or b/c of shadow-cljs update commit3025c94d28Author: Tienson Qin <tiensonqin@gmail.com> Date: Mon Aug 4 20:40:53 2025 +0800 fix: checkbox property value should be aligned center commita918e5b6f1Author: Tienson Qin <tiensonqin@gmail.com> Date: Sun Aug 3 16:58:19 2025 +0800 enhance(ux): show edit button instead of 00:00 for datetime property commitc2c8727f6cMerge:be6929234c9e446fd8Author: Tienson Qin <tiensonqin@gmail.com> Date: Sun Aug 3 16:40:22 2025 +0800 Merge branch 'master' into feat/hnswlib+transformer-js commitbe69292346Author: Tienson Qin <tiensonqin@gmail.com> Date: Sun Aug 3 16:37:45 2025 +0800 set *publishing? commit11eb0f38a6Author: Tienson Qin <tiensonqin@gmail.com> Date: Sun Aug 3 14:33:47 2025 +0800 use official @sqlite.org/sqlite-wasm instead of our fork commit74fa24cb1eAuthor: Gabriel Horner <gabriel@logseq.com> Date: Fri Aug 1 19:20:59 2025 -0400 fix: publishing no longer has bug requiring shadow-cljs config hack Reverts bug fix froma80a182a8f. Confirmed dev and release work for publishing. This bug may no longer apply b/c :shared is no longer used or b/c of shadow-cljs update commit182a51a85eAuthor: Gabriel Horner <gabriel@logseq.com> Date: Fri Aug 1 17:56:39 2025 -0400 fix: publishing app in prod mode Also fix watch-publishing-frontend which had stopped working awhile back with shadow-cljs update commitf7e32108f2Author: Gabriel Horner <gabriel@logseq.com> Date: Fri Aug 1 14:37:18 2025 -0400 enhance(dev): add more workers and db ns to linters commitcf4153b1cdAuthor: Gabriel Horner <gabriel@logseq.com> Date: Fri Aug 1 13:49:31 2025 -0400 fix: yarn watch commit1fe46682e4Merge:1e8d7de448c402676aAuthor: Tienson Qin <tiensonqin@gmail.com> Date: Fri Aug 1 00:14:28 2025 +0800 Merge branch 'master' into feat/hnswlib+transformer-js commit1e8d7de446Author: Tienson Qin <tiensonqin@gmail.com> Date: Fri Aug 1 00:03:22 2025 +0800 fix: load progress in shared worker commit1e84a21042Author: Tienson Qin <tiensonqin@gmail.com> Date: Thu Jul 31 22:38:44 2025 +0800 enhance: use sharedworker for inference to reduce memory usage commite8d6ae1a2fAuthor: Tienson Qin <tiensonqin@gmail.com> Date: Thu Jul 31 22:02:13 2025 +0800 disable qwen3 embedding commit67a0f7cd8cMerge:7e04733ac0bfb458d9Author: Tienson Qin <tiensonqin@gmail.com> Date: Thu Jul 31 20:08:29 2025 +0800 Merge branch 'master' into feat/hnswlib+transformer-js commit7e04733acfAuthor: Tienson Qin <tiensonqin@gmail.com> Date: Tue Jul 29 01:21:49 2025 +0800 fix: lint commit5ee795171cAuthor: Tienson Qin <tiensonqin@gmail.com> Date: Tue Jul 29 01:19:26 2025 +0800 enhance: display show more by default commita9e9149350Author: Tienson Qin <tiensonqin@gmail.com> Date: Tue Jul 29 01:17:22 2025 +0800 fix: add score for non-matched results commitd1cabafcc2Author: Tienson Qin <tiensonqin@gmail.com> Date: Tue Jul 29 00:53:24 2025 +0800 ensure db/id is not great than 2147483647 for embedding commit0816c6a985Author: Tienson Qin <tiensonqin@gmail.com> Date: Tue Jul 29 00:15:51 2025 +0800 remove jina embeddings for now commit74fb1194e9Author: Tienson Qin <tiensonqin@gmail.com> Date: Tue Jul 29 00:08:46 2025 +0800 adjust weights for keyword search and semantic search commit6e95bb1801Author: Tienson Qin <tiensonqin@gmail.com> Date: Mon Jul 28 19:38:53 2025 +0800 re-enable malli dev commit47132b395eAuthor: Tienson Qin <tiensonqin@gmail.com> Date: Mon Jul 28 19:23:04 2025 +0800 fix: tweet embed commit238b071b62Author: Tienson Qin <tiensonqin@gmail.com> Date: Mon Jul 28 19:11:41 2025 +0800 fix: workflows commit44fb03b0aeMerge:88dfaf8ebcb65cb88aAuthor: Tienson Qin <tiensonqin@gmail.com> Date: Mon Jul 28 18:35:20 2025 +0800 Merge branch 'master' into feat/hnswlib+transformer-js commit88dfaf8ebdAuthor: Tienson Qin <tiensonqin@gmail.com> Date: Mon Jul 28 18:31:29 2025 +0800 fix: mobile build commit7f18e941d0Author: Tienson Qin <tiensonqin@gmail.com> Date: Mon Jul 28 16:26:56 2025 +0800 separate config for app and mobile commit0c3697e972Author: Tienson Qin <tiensonqin@gmail.com> Date: Mon Jul 28 12:50:06 2025 +0800 fix: add workers to rtc test workflow commit18914d2fa2Author: Tienson Qin <tiensonqin@gmail.com> Date: Mon Jul 28 12:43:24 2025 +0800 fix: add workers to mobile and electron release commitaf33e6964bAuthor: Tienson Qin <tiensonqin@gmail.com> Date: Mon Jul 28 12:30:30 2025 +0800 fix: ns commit110f5b18e5Merge:dcd6d7414654e6d1b7Author: Tienson Qin <tiensonqin@gmail.com> Date: Mon Jul 28 12:29:32 2025 +0800 Merge branch 'master' into feat/hnswlib+transformer-js commitdcd6d74146Author: Tienson Qin <tiensonqin@gmail.com> Date: Mon Jul 28 12:26:49 2025 +0800 fix: typo commitc71e51bc78Author: Tienson Qin <tiensonqin@gmail.com> Date: Mon Jul 28 12:23:56 2025 +0800 add webpack to release-mobile commit44d6c12731Author: Tienson Qin <tiensonqin@gmail.com> Date: Mon Jul 28 12:21:35 2025 +0800 update output-feature-set to es-next-in commit65afa1e762Author: Tienson Qin <tiensonqin@gmail.com> Date: Mon Jul 28 12:20:11 2025 +0800 fix: lint commitd488c53fd6Author: Tienson Qin <tiensonqin@gmail.com> Date: Wed Jul 23 22:12:20 2025 +0800 adjust page/object sorting weight commit6a22385f0bAuthor: Tienson Qin <tiensonqin@gmail.com> Date: Wed Jul 23 20:54:29 2025 +0800 replace uuid ref with block title when embedding commit0f48207329Author: Tienson Qin <tiensonqin@gmail.com> Date: Wed Jul 23 20:48:55 2025 +0800 add tags to embedding commit48ae054ce8Author: Tienson Qin <tiensonqin@gmail.com> Date: Wed Jul 23 20:22:22 2025 +0800 fix: lint commitaeeaad3eb0Author: Tienson Qin <tiensonqin@gmail.com> Date: Wed Jul 23 20:12:19 2025 +0800 fix: embedding status commit9335281d4aAuthor: Tienson Qin <tiensonqin@gmail.com> Date: Wed Jul 23 15:25:50 2025 +0800 fix: webpack release failed to require path commit4b935df5d3Author: Tienson Qin <tiensonqin@gmail.com> Date: Wed Jul 23 14:42:54 2025 +0800 fix: katex path commit5d7f56361aAuthor: Tienson Qin <tiensonqin@gmail.com> Date: Wed Jul 23 14:36:10 2025 +0800 downgrade shadow-cljs commitf86be0f3a8Author: Tienson Qin <tiensonqin@gmail.com> Date: Wed Jul 23 13:11:15 2025 +0800 add more externs commit31004ee371Author: Tienson Qin <tiensonqin@gmail.com> Date: Wed Jul 23 12:40:25 2025 +0800 wip: webpack release build commitdbe2708e5eAuthor: Tienson Qin <tiensonqin@gmail.com> Date: Mon Jul 21 22:46:02 2025 +0800 Add webpack build commit0722688fd8Author: Tienson Qin <tiensonqin@gmail.com> Date: Mon Jul 21 21:47:36 2025 +0800 feat: hybrid search commit337b28e5d4Author: Tienson Qin <tiensonqin@gmail.com> Date: Mon Jul 21 20:53:35 2025 +0800 set batch size to 500 commit2c27aee09dAuthor: Tienson Qin <tiensonqin@gmail.com> Date: Mon Jul 21 20:14:14 2025 +0800 use db/id for hnsw label Because db/id is unique, auto-increment so that old ids are not re-used. commitf1d8e526fcAuthor: Tienson Qin <tiensonqin@gmail.com> Date: Mon Jul 21 17:44:45 2025 +0800 enhance: set embedding distance to 0.3 to keep search result related commitbf3af0feddAuthor: Tienson Qin <tiensonqin@gmail.com> Date: Mon Jul 21 17:21:20 2025 +0800 perf: skip refresh ui for embedding data transactions commit690b92c975Author: Tienson Qin <tiensonqin@gmail.com> Date: Mon Jul 21 17:15:06 2025 +0800 enhance: adjust batch embedding size to cut down resource usage commit3f20f44790Author: Tienson Qin <tiensonqin@gmail.com> Date: Mon Jul 21 17:06:17 2025 +0800 enhance: add embedding indicator commit2e65b639dcAuthor: Tienson Qin <tiensonqin@gmail.com> Date: Mon Jul 21 16:37:35 2025 +0800 fix: cancel index when switching to another model commitae78fc65c4Author: Tienson Qin <tiensonqin@gmail.com> Date: Mon Jul 21 16:22:17 2025 +0800 enhance: start embedding after selected a model commit910c8f448fAuthor: Tienson Qin <tiensonqin@gmail.com> Date: Mon Jul 21 16:13:17 2025 +0800 Use missionary clock for auto embedding commitb23f9e28a2Author: Tienson Qin <tiensonqin@gmail.com> Date: Mon Jul 21 13:30:45 2025 +0800 feat: add semantic search result when searching blocks commitf296c1e67dAuthor: Tienson Qin <tiensonqin@gmail.com> Date: Sat Jul 19 15:32:16 2025 +0800 fix: auto embedding stops when switching graph commita5270a05e1Author: Tienson Qin <tiensonqin@gmail.com> Date: Sat Jul 19 15:17:11 2025 +0800 fix: inference worker js path commit91d3ab70fbAuthor: Tienson Qin <tiensonqin@gmail.com> Date: Sat Jul 19 15:15:24 2025 +0800 enhance: don't update index info if there's no block update commitde80615c5fAuthor: Tienson Qin <tiensonqin@gmail.com> Date: Sat Jul 19 14:36:11 2025 +0800 enhance: index embedding for updated blocks every 30s commit133b5e497aAuthor: Tienson Qin <tiensonqin@gmail.com> Date: Wed Jul 16 18:59:38 2025 +0800 enhance(ux): show embedding model download progress commit00405d98d3Author: Tienson Qin <tiensonqin@gmail.com> Date: Wed Jul 16 15:59:22 2025 +0800 add local embedding model settings commit88f62e86ecAuthor: Tienson Qin <tiensonqin@gmail.com> Date: Wed Jul 16 14:40:18 2025 +0800 perf improvement commit4b0cb79d0dAuthor: Tienson Qin <tiensonqin@gmail.com> Date: Wed Jul 16 04:02:22 2025 +0800 fix: vector search commitbfed2e3bc6Author: Tienson Qin <tiensonqin@gmail.com> Date: Tue Jul 15 17:49:01 2025 +0800 Add qwen3 embedding commitf3e1da67c7Author: Tienson Qin <tiensonqin@gmail.com> Date: Tue Jul 15 16:52:30 2025 +0800 fix: infer worker doesn't work commite1147c3264Author: Tienson Qin <tiensonqin@gmail.com> Date: Tue Jul 15 15:59:01 2025 +0800 fix: c.m/run-task args commit2d50ca5ce2Merge:ca558450c24e3a08b0Author: Tienson Qin <tiensonqin@gmail.com> Date: Fri Jul 11 18:15:33 2025 +0800 Merge branch 'master' into feat/hnswlib+transformer-js commitca558450c1Merge:1f31f08bf1565e7541Author: rcmerci <rcmerci@gmail.com> Date: Fri Mar 21 15:42:50 2025 +0800 Merge remote-tracking branch 'origin/feat/db' into feat/hnswlib+transformer-js commit1f31f08bf6Author: rcmerci <rcmerci@gmail.com> Date: Fri Mar 21 15:37:34 2025 +0800 fix(vec-search): new-hnsw-index when force-reset-index commitbb226a4147Author: rcmerci <rcmerci@gmail.com> Date: Fri Mar 21 01:38:39 2025 +0800 feat(vec-search): debug ui show load-model-progress commita7273847bcAuthor: rcmerci <rcmerci@gmail.com> Date: Thu Mar 20 22:27:56 2025 +0800 feat(vec-search): debug ui support selecting model commit47c24177a6Author: rcmerci <rcmerci@gmail.com> Date: Tue Mar 18 23:37:10 2025 +0800 feat(vec-search): update debug ui commitcd44e77ac9Author: rcmerci <rcmerci@gmail.com> Date: Tue Mar 18 21:55:51 2025 +0800 feat(vec-search): add debug-ui at sidebar commit328b38db30Author: rcmerci <rcmerci@gmail.com> Date: Tue Mar 18 18:37:25 2025 +0800 feat(embedding): add vector-search-state-flows commit6b8c1dde93Author: rcmerci <rcmerci@gmail.com> Date: Tue Mar 18 15:43:44 2025 +0800 feat(embedding): check webgpu available commit624f839bbfAuthor: Tienson Qin <tiensonqin@gmail.com> Date: Sun Mar 16 12:08:11 2025 +0800 fix: can't use fuse.js commit38e4b0d9b2Merge:b19f0d91ca55137049Author: Tienson Qin <tiensonqin@gmail.com> Date: Sun Mar 16 11:52:32 2025 +0800 Merge branch 'feat/db' into feat/hnswlib+transformer-js commitb19f0d91caAuthor: rcmerci <rcmerci@gmail.com> Date: Sat Mar 15 23:48:26 2025 +0800 enhance(embedding): add user-defined class/prop commit0c82a420c7Author: rcmerci <rcmerci@gmail.com> Date: Sat Mar 15 22:56:45 2025 +0800 fix: use d/entity instead of d/pull because :block/title in entity will replace :block/uuid by its block/title commit2c88070fe0Author: rcmerci <rcmerci@gmail.com> Date: Sat Mar 15 22:43:28 2025 +0800 fix: remove outdated hnsw-label commita5db52bf37Author: rcmerci <rcmerci@gmail.com> Date: Sat Mar 15 20:56:22 2025 +0800 feat(embedding): text-embedding graph blocks and query hnsw new properties: :logseq.property.embedding/hnsw-label, :logseq.property.embedding/hnsw-label-updated-at add ns frontend.worker.embedding commit5f02b7c863Author: rcmerci <rcmerci@gmail.com> Date: Sat Mar 15 15:30:44 2025 +0800 dev: update cljfmt.edn commitd48a30000dAuthor: rcmerci <rcmerci@gmail.com> Date: Fri Mar 14 17:30:25 2025 +0800 enhance(text-embedding): add api delete-labels commiteda3928937Author: rcmerci <rcmerci@gmail.com> Date: Fri Mar 14 16:45:14 2025 +0800 enhance(text-embedding): connect db-worker and infer-worker commit53cc7485d8Author: rcmerci <rcmerci@gmail.com> Date: Thu Mar 13 22:42:31 2025 +0800 enhance(text-embedding): smaller init-max-elems, dynamically resizeIndex commit95c0f2ef1cAuthor: rcmerci <rcmerci@gmail.com> Date: Thu Mar 13 22:07:30 2025 +0800 feat: init add frontend.inference-worker.text-embedding commite2271dd03dAuthor: Tienson Qin <tiensonqin@gmail.com> Date: Thu Mar 13 21:00:35 2025 +0800 use forked sqlite-wasm commitc269046b44Author: Tienson Qin <tiensonqin@gmail.com> Date: Tue Mar 11 16:21:44 2025 +0800 Revert "disable js-toast temporally to open the app" This reverts commitda1c4dd465. commitebeeb280efAuthor: charlie <xyhp915@qq.com> Date: Tue Mar 11 16:16:37 2025 +0800 enhance(webpack): add externals for React and ReactDOM commitda1c4dd465Author: Tienson Qin <tiensonqin@gmail.com> Date: Tue Mar 11 15:57:14 2025 +0800 disable js-toast temporally to open the app commit8f1b610361Author: Tienson Qin <tiensonqin@gmail.com> Date: Tue Mar 11 15:51:22 2025 +0800 chore: remove unused package commit68426d54ebAuthor: Tienson Qin <tiensonqin@gmail.com> Date: Tue Mar 11 15:30:24 2025 +0800 get rid of shared module commit0ecf65aefbAuthor: Tienson Qin <tiensonqin@gmail.com> Date: Tue Mar 11 13:37:42 2025 +0800 chore: use official sqlite-wasm commite36543256fAuthor: Tienson Qin <tiensonqin@gmail.com> Date: Mon Mar 10 17:23:14 2025 +0800 fix: worker repl commitb122d453c2Author: Tienson Qin <tiensonqin@gmail.com> Date: Mon Mar 10 17:20:39 2025 +0800 separate :workers build commit849ffd3329Author: Tienson Qin <tiensonqin@gmail.com> Date: Mon Mar 10 16:23:52 2025 +0800 prepend bundle to worker js output commit5632c29ba0Author: Tienson Qin <tiensonqin@gmail.com> Date: Mon Mar 10 15:05:19 2025 +0800 wip: webpack integration commit1c46e0205eAuthor: rcmerci <rcmerci@gmail.com> Date: Mon Mar 10 12:08:44 2025 +0800 init add inference-worker
285 lines
9.2 KiB
JavaScript
285 lines
9.2 KiB
JavaScript
const fs = require('fs')
|
|
const utils = require('util')
|
|
const cp = require('child_process')
|
|
const exec = utils.promisify(cp.exec)
|
|
const path = require('path')
|
|
const gulp = require('gulp')
|
|
const del = require('del')
|
|
const ip = require('ip')
|
|
const replace = require('gulp-replace')
|
|
|
|
const outputPath = path.join(__dirname, 'static')
|
|
const resourcesPath = path.join(__dirname, 'resources')
|
|
const publicRootPath = path.join(__dirname, 'public')
|
|
const sourcePath = path.join(__dirname, 'src/main/frontend')
|
|
const resourceFilePath = path.join(resourcesPath, '**')
|
|
const outputFilePath = path.join(outputPath, '**')
|
|
|
|
const css = {
|
|
watchCSS () {
|
|
return cp.spawn(`yarn css:watch`, {
|
|
shell: true,
|
|
stdio: 'inherit',
|
|
})
|
|
},
|
|
|
|
watchMobileCSS () {
|
|
return cp.spawn(`yarn css:mobile-watch`, {
|
|
shell: true,
|
|
stdio: 'inherit',
|
|
})
|
|
},
|
|
|
|
buildCSS (...params) {
|
|
return gulp.series(
|
|
() => exec(`yarn css:build`, {}),
|
|
css._optimizeCSSForRelease,
|
|
)(...params)
|
|
},
|
|
|
|
buildMobileCSS (...params) {
|
|
return gulp.series(
|
|
() => exec(`yarn css:mobile-build`, {}),
|
|
)(...params)
|
|
},
|
|
|
|
_optimizeCSSForRelease () {
|
|
return gulp.src(path.join(outputPath, 'css', 'style.css')).
|
|
pipe(gulp.dest(path.join(outputPath, 'css')))
|
|
},
|
|
}
|
|
|
|
const common = {
|
|
clean () {
|
|
return del(
|
|
['./static/**/*', '!./static/node_modules'])
|
|
},
|
|
|
|
syncResourceFile () {
|
|
return gulp.src(resourceFilePath).pipe(gulp.dest(outputPath))
|
|
},
|
|
|
|
// NOTE: All assets from node_modules are copied to the output directory
|
|
syncAssetFiles (...params) {
|
|
return gulp.series(
|
|
() => gulp.src([
|
|
'./node_modules/@excalidraw/excalidraw/dist/excalidraw-assets/**',
|
|
'!**/*/i18n-*.js',
|
|
]).pipe(gulp.dest(path.join(outputPath, 'js', 'excalidraw-assets'))),
|
|
() => gulp.src([
|
|
'node_modules/katex/dist/katex.min.js',
|
|
'node_modules/katex/dist/contrib/mhchem.min.js',
|
|
'node_modules/html2canvas/dist/html2canvas.min.js',
|
|
'node_modules/interactjs/dist/interact.min.js',
|
|
'node_modules/photoswipe/dist/umd/*.js',
|
|
'node_modules/shepherd.js/dist/js/shepherd.min.js',
|
|
'node_modules/marked/marked.min.js',
|
|
'node_modules/@highlightjs/cdn-assets/highlight.min.js',
|
|
'node_modules/@isomorphic-git/lightning-fs/dist/lightning-fs.min.js',
|
|
'packages/amplify/dist/amplify.js',
|
|
'packages/ui/dist/ui/ui.js',
|
|
'node_modules/@sqlite.org/sqlite-wasm/sqlite-wasm/jswasm/sqlite3.wasm',
|
|
'node_modules/react/umd/react.production.min.js',
|
|
'node_modules/react/umd/react.development.js',
|
|
'node_modules/react-dom/umd/react-dom.production.min.js',
|
|
'node_modules/react-dom/umd/react-dom.development.js',
|
|
'node_modules/prop-types/prop-types.min.js',
|
|
'node_modules/dompurify/dist/purify.js',
|
|
]).pipe(gulp.dest(path.join(outputPath, 'js'))),
|
|
() => gulp.src([
|
|
'node_modules/@tabler/icons-react/dist/umd/tabler-icons-react.min.js',
|
|
]).
|
|
pipe(replace('"@tabler/icons-react"]={},a.react,',
|
|
'"tablerIcons"]={},a.React,')).
|
|
pipe(gulp.dest(path.join(outputPath, 'js'))),
|
|
() => gulp.src([
|
|
'node_modules/@glidejs/glide/dist/glide.min.js',
|
|
'node_modules/@glidejs/glide/dist/css/glide.core.min.css',
|
|
'node_modules/@glidejs/glide/dist/css/glide.theme.min.css',
|
|
]).pipe(gulp.dest(path.join(outputPath, 'js', 'glide'))),
|
|
() => gulp.src([
|
|
'node_modules/pdfjs-dist/legacy/build/pdf.mjs',
|
|
'node_modules/pdfjs-dist/legacy/build/pdf.worker.mjs',
|
|
'node_modules/pdfjs-dist/legacy/web/pdf_viewer.mjs',
|
|
]).pipe(gulp.dest(path.join(outputPath, 'js', 'pdfjs'))),
|
|
() => gulp.src([
|
|
'node_modules/pdfjs-dist/cmaps/*.*',
|
|
]).pipe(gulp.dest(path.join(outputPath, 'js', 'pdfjs', 'cmaps'))),
|
|
() => gulp.src([
|
|
'node_modules/inter-ui/inter.css',
|
|
]).pipe(gulp.dest(path.join(outputPath, 'css'))),
|
|
() => gulp.src('node_modules/inter-ui/Inter (web)/*.*').
|
|
pipe(gulp.dest(path.join(outputPath, 'css', 'Inter (web)'))),
|
|
() => gulp.src([
|
|
'node_modules/@tabler/icons-webfont/fonts/**',
|
|
'node_modules/katex/dist/fonts/*.woff2',
|
|
]).pipe(gulp.dest(path.join(outputPath, 'css', 'fonts'))),
|
|
() => gulp.src([
|
|
'node_modules/katex/dist/katex.min.js',
|
|
'node_modules/katex/dist/contrib/mhchem.min.js',
|
|
'node_modules/marked/marked.min.js',
|
|
'node_modules/@highlightjs/cdn-assets/highlight.min.js',
|
|
'node_modules/@isomorphic-git/lightning-fs/dist/lightning-fs.min.js',
|
|
'node_modules/react/umd/react.production.min.js',
|
|
'node_modules/react/umd/react.development.js',
|
|
'node_modules/react-dom/umd/react-dom.production.min.js',
|
|
'node_modules/react-dom/umd/react-dom.development.js',
|
|
'node_modules/prop-types/prop-types.min.js',
|
|
'node_modules/interactjs/dist/interact.min.js',
|
|
'node_modules/photoswipe/dist/umd/*.js',
|
|
'packages/amplify/dist/amplify.js',
|
|
'packages/ui/dist/ui/ui.js',
|
|
'node_modules/@sqlite.org/sqlite-wasm/sqlite-wasm/jswasm/sqlite3.wasm',
|
|
]).pipe(gulp.dest(path.join(outputPath, 'mobile', 'js'))),
|
|
() => gulp.src([
|
|
'packages/ui/dist/ionic/*.js',
|
|
]).pipe(gulp.dest(path.join(outputPath, 'mobile'))),
|
|
)(...params)
|
|
},
|
|
|
|
keepSyncResourceFile () {
|
|
return gulp.watch(resourceFilePath, { ignoreInitial: true },
|
|
common.syncResourceFile)
|
|
},
|
|
|
|
syncAllStatic () {
|
|
return gulp.src([
|
|
outputFilePath,
|
|
'!' + path.join(outputPath, 'node_modules/**'),
|
|
'!' + path.join(outputPath, 'mobile/**'),
|
|
'!' + path.join(outputPath, 'android/**'),
|
|
'!' + path.join(outputPath, 'ios/**'),
|
|
]).pipe(gulp.dest(publicRootPath))
|
|
},
|
|
|
|
syncJS_CSSinRt () {
|
|
return gulp.src([
|
|
path.join(outputPath, 'js/**'),
|
|
path.join(outputPath, 'css/**'),
|
|
], { base: outputPath }).pipe(gulp.dest(publicRootPath))
|
|
},
|
|
|
|
keepSyncStaticInRt () {
|
|
return gulp.watch([
|
|
path.join(outputPath, 'js/**'),
|
|
path.join(outputPath, 'css/**'),
|
|
], { ignoreInitial: true }, common.syncJS_CSSinRt)
|
|
},
|
|
|
|
async runCapWithLocalDevServerEntry (cb) {
|
|
const mode = process.env.PLATFORM || 'ios'
|
|
|
|
const LOGSEQ_APP_SERVER_URL = `http://localhost:3002`
|
|
|
|
if (typeof global.fetch === 'function') {
|
|
try {
|
|
await fetch(LOGSEQ_APP_SERVER_URL)
|
|
} catch (e) {
|
|
return cb(new Error(
|
|
`/* ❌ Please check if the service is ON. (${LOGSEQ_APP_SERVER_URL}) ❌ */`))
|
|
}
|
|
}
|
|
|
|
console.log(`------ Cap ${mode.toUpperCase()} -----`)
|
|
console.log(`Dev serve at: ${LOGSEQ_APP_SERVER_URL}`)
|
|
console.log(`--------------------------------------`)
|
|
|
|
cp.execSync(`npx cap sync ${mode}`, {
|
|
stdio: 'inherit',
|
|
env: Object.assign(process.env, {
|
|
LOGSEQ_APP_SERVER_URL,
|
|
}),
|
|
})
|
|
|
|
cp.execSync(`rm -rf ios/App/App/public/out`, {
|
|
stdio: 'inherit',
|
|
})
|
|
|
|
cp.execSync(`npx cap run ${mode}`, {
|
|
stdio: 'inherit',
|
|
env: Object.assign(process.env, {
|
|
LOGSEQ_APP_SERVER_URL,
|
|
}),
|
|
})
|
|
|
|
cb()
|
|
},
|
|
|
|
switchReactDevelopmentMode(cb) {
|
|
try {
|
|
const reactFrom = path.join(outputPath, 'js', 'react.development.js');
|
|
const reactTo = path.join(outputPath, 'js', 'react.production.min.js');
|
|
fs.renameSync(reactFrom, reactTo);
|
|
|
|
const reactDomFrom = path.join(outputPath, 'js', 'react-dom.development.js');
|
|
const reactDomTo = path.join(outputPath, 'js', 'react-dom.production.min.js');
|
|
fs.renameSync(reactDomFrom, reactDomTo);
|
|
|
|
cb();
|
|
} catch (err) {
|
|
console.error("Error during switchReactDevelopmentMode:", err);
|
|
cb(err);
|
|
}
|
|
},
|
|
}
|
|
|
|
exports.electron = () => {
|
|
if (!fs.existsSync(path.join(outputPath, 'node_modules'))) {
|
|
cp.execSync('yarn', {
|
|
cwd: outputPath,
|
|
stdio: 'inherit',
|
|
})
|
|
}
|
|
|
|
cp.execSync('yarn electron:dev', {
|
|
cwd: outputPath,
|
|
stdio: 'inherit',
|
|
})
|
|
}
|
|
|
|
exports.electronMaker = async () => {
|
|
cp.execSync('yarn cljs:release-electron', {
|
|
stdio: 'inherit',
|
|
})
|
|
|
|
const pkgPath = path.join(outputPath, 'package.json')
|
|
const pkg = require(pkgPath)
|
|
const version = fs.readFileSync(
|
|
path.join(__dirname, 'src/main/frontend/version.cljs')).
|
|
toString().
|
|
match(/[0-9.]{3,}/)[0]
|
|
|
|
if (!version) {
|
|
throw new Error('release version error in src/**/*/version.cljs')
|
|
}
|
|
|
|
pkg.version = version
|
|
fs.writeFileSync(pkgPath, JSON.stringify(pkg, null, 2))
|
|
|
|
if (!fs.existsSync(path.join(outputPath, 'node_modules'))) {
|
|
cp.execSync('yarn', {
|
|
cwd: outputPath,
|
|
stdio: 'inherit',
|
|
})
|
|
}
|
|
|
|
cp.execSync('yarn electron:make', {
|
|
cwd: outputPath,
|
|
stdio: 'inherit',
|
|
})
|
|
}
|
|
|
|
exports.cap = common.runCapWithLocalDevServerEntry
|
|
exports.clean = common.clean
|
|
exports.watch = gulp.series(
|
|
common.syncResourceFile,
|
|
common.syncAssetFiles, common.switchReactDevelopmentMode,
|
|
gulp.parallel(common.keepSyncResourceFile, css.watchCSS))
|
|
exports.watchMobile = gulp.series(
|
|
common.syncResourceFile, common.syncAssetFiles,
|
|
gulp.parallel(common.keepSyncResourceFile, css.watchMobileCSS))
|
|
exports.build = gulp.series(common.clean, common.syncResourceFile,
|
|
common.syncAssetFiles, css.buildCSS)
|
|
exports.buildMobile = gulp.series(common.clean, common.syncResourceFile,
|
|
common.syncAssetFiles, css.buildMobileCSS)
|