|
@@ -6,6 +6,7 @@ const path = require('path')
|
|
|
const gulp = require('gulp')
|
|
const gulp = require('gulp')
|
|
|
const cleanCSS = require('gulp-clean-css')
|
|
const cleanCSS = require('gulp-clean-css')
|
|
|
const del = require('del')
|
|
const del = require('del')
|
|
|
|
|
+const ip = require('ip')
|
|
|
|
|
|
|
|
const outputPath = path.join(__dirname, 'static')
|
|
const outputPath = path.join(__dirname, 'static')
|
|
|
const resourcesPath = path.join(__dirname, 'resources')
|
|
const resourcesPath = path.join(__dirname, 'resources')
|
|
@@ -49,13 +50,13 @@ const common = {
|
|
|
syncAssetFiles (...params) {
|
|
syncAssetFiles (...params) {
|
|
|
return gulp.series(
|
|
return gulp.series(
|
|
|
() => gulp.src([
|
|
() => 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'))),
|
|
.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'))),
|
|
.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'))),
|
|
.pipe(gulp.dest(path.join(outputPath, 'css', 'fonts'))),
|
|
|
)(...params)
|
|
)(...params)
|
|
|
},
|
|
},
|
|
@@ -83,6 +84,41 @@ const common = {
|
|
|
path.join(outputPath, 'js/**'),
|
|
path.join(outputPath, 'js/**'),
|
|
|
path.join(outputPath, 'css/**')
|
|
path.join(outputPath, 'css/**')
|
|
|
], { ignoreInitial: true }, common.syncJS_CSSinRt)
|
|
], { ignoreInitial: true }, common.syncJS_CSSinRt)
|
|
|
|
|
+ },
|
|
|
|
|
+
|
|
|
|
|
+ async runCapWithLocalDevServerEntry (cb) {
|
|
|
|
|
+ const mode = process.env.PLATFORM || 'ios'
|
|
|
|
|
+
|
|
|
|
|
+ const IP = ip.address()
|
|
|
|
|
+ const LOGSEQ_APP_SERVER_URL = `http://${IP}:3001`
|
|
|
|
|
+
|
|
|
|
|
+ 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(`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.cap = common.runCapWithLocalDevServerEntry
|
|
|
exports.clean = common.clean
|
|
exports.clean = common.clean
|
|
|
exports.watch = gulp.series(common.syncResourceFile, common.syncAssetFiles, common.syncAllStatic,
|
|
exports.watch = gulp.series(common.syncResourceFile, common.syncAssetFiles, common.syncAllStatic,
|
|
|
gulp.parallel(common.keepSyncResourceFile, css.watchCSS))
|
|
gulp.parallel(common.keepSyncResourceFile, css.watchCSS))
|