mirror of
https://github.com/logseq/logseq.git
synced 2026-04-24 22:25:01 +00:00
chore(dev): just one command for ios/android development
This commit is contained in:
47
gulpfile.js
47
gulpfile.js
@@ -6,6 +6,7 @@ const path = require('path')
|
||||
const gulp = require('gulp')
|
||||
const cleanCSS = require('gulp-clean-css')
|
||||
const del = require('del')
|
||||
const ip = require('ip')
|
||||
|
||||
const outputPath = path.join(__dirname, 'static')
|
||||
const resourcesPath = path.join(__dirname, 'resources')
|
||||
@@ -49,13 +50,13 @@ const common = {
|
||||
syncAssetFiles (...params) {
|
||||
return gulp.series(
|
||||
() => gulp.src([
|
||||
"./node_modules/@excalidraw/excalidraw/dist/excalidraw-assets/**",
|
||||
"!**/*/i18n-*.js"
|
||||
])
|
||||
'./node_modules/@excalidraw/excalidraw/dist/excalidraw-assets/**',
|
||||
'!**/*/i18n-*.js'
|
||||
])
|
||||
.pipe(gulp.dest(path.join(outputPath, 'js', 'excalidraw-assets'))),
|
||||
() => gulp.src("node_modules/@tabler/icons/iconfont/tabler-icons.min.css")
|
||||
() => gulp.src('node_modules/@tabler/icons/iconfont/tabler-icons.min.css')
|
||||
.pipe(gulp.dest(path.join(outputPath, 'css'))),
|
||||
() => gulp.src("node_modules/@tabler/icons/iconfont/fonts/**")
|
||||
() => gulp.src('node_modules/@tabler/icons/iconfont/fonts/**')
|
||||
.pipe(gulp.dest(path.join(outputPath, 'css', 'fonts'))),
|
||||
)(...params)
|
||||
},
|
||||
@@ -83,6 +84,41 @@ const common = {
|
||||
path.join(outputPath, 'js/**'),
|
||||
path.join(outputPath, 'css/**')
|
||||
], { ignoreInitial: true }, common.syncJS_CSSinRt)
|
||||
},
|
||||
|
||||
async env (cb) {
|
||||
const mode = process.env.PLATFORM || 'ios'
|
||||
|
||||
const IP = ip.address()
|
||||
const LOGSEQ_APP_SERVER_URL = `http://${IP}:3001`
|
||||
|
||||
if (typeof global.fetch != null) {
|
||||
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(`npx cap run ${mode} --external`, {
|
||||
stdio: 'inherit',
|
||||
env: Object.assign(process.env, {
|
||||
LOGSEQ_APP_SERVER_URL
|
||||
})
|
||||
})
|
||||
|
||||
cb()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -130,6 +166,7 @@ exports.electronMaker = async () => {
|
||||
})
|
||||
}
|
||||
|
||||
exports.env = common.env
|
||||
exports.clean = common.clean
|
||||
exports.watch = gulp.series(common.syncResourceFile, common.syncAssetFiles, common.syncAllStatic,
|
||||
gulp.parallel(common.keepSyncResourceFile, css.watchCSS))
|
||||
|
||||
Reference in New Issue
Block a user