mirror of https://github.com/logseq/logseq
improve(electron): development experience
parent
d06ec5cc6e
commit
16a5974656
17
gulpfile.js
17
gulpfile.js
|
@ -1,4 +1,5 @@
|
||||||
const fs = require('fs')
|
const fs = require('fs')
|
||||||
|
const cp = require('child_process')
|
||||||
const path = require('path')
|
const path = require('path')
|
||||||
const gulp = require('gulp')
|
const gulp = require('gulp')
|
||||||
const postcss = require('gulp-postcss')
|
const postcss = require('gulp-postcss')
|
||||||
|
@ -62,7 +63,7 @@ const css = {
|
||||||
|
|
||||||
const common = {
|
const common = {
|
||||||
clean () {
|
clean () {
|
||||||
return del(outputPath)
|
return del(['./static/**/*', '!./static/yarn.lock', '!./static/node_modules'])
|
||||||
},
|
},
|
||||||
|
|
||||||
syncResourceFile () {
|
syncResourceFile () {
|
||||||
|
@ -74,6 +75,20 @@ const common = {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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.clean = common.clean
|
exports.clean = common.clean
|
||||||
exports.watch = gulp.parallel(common.keepSyncResourceFile, css.watchCSS)
|
exports.watch = gulp.parallel(common.keepSyncResourceFile, css.watchCSS)
|
||||||
exports.build = gulp.series(common.clean, common.syncResourceFile, css.buildCSS)
|
exports.build = gulp.series(common.clean, common.syncResourceFile, css.buildCSS)
|
||||||
|
|
|
@ -32,7 +32,7 @@
|
||||||
"release-app": "run-s gulp:build cljs:release-app",
|
"release-app": "run-s gulp:build cljs:release-app",
|
||||||
"release-publishing": "run-s gulp:build cljs:release-publishing",
|
"release-publishing": "run-s gulp:build cljs:release-publishing",
|
||||||
"dev-release-app": "run-s gulp:build cljs:dev-release-app",
|
"dev-release-app": "run-s gulp:build cljs:dev-release-app",
|
||||||
"dev-electron-app": "cd static/ && yarn && yarn electron:dev",
|
"dev-electron-app": "gulp electron",
|
||||||
"debug-electron-app": "cd static/ && yarn electron:debug",
|
"debug-electron-app": "cd static/ && yarn electron:debug",
|
||||||
"clean": "gulp clean",
|
"clean": "gulp clean",
|
||||||
"test": "run-s cljs:test cljs:run-test",
|
"test": "run-s cljs:test cljs:run-test",
|
||||||
|
|
Loading…
Reference in New Issue