|
@@ -14,7 +14,7 @@ import { tauriDir, appDir } from './helpers/app-paths'
|
|
import logger from './helpers/logger'
|
|
import logger from './helpers/logger'
|
|
import onShutdown from './helpers/on-shutdown'
|
|
import onShutdown from './helpers/on-shutdown'
|
|
import { spawn, spawnSync } from './helpers/spawn'
|
|
import { spawn, spawnSync } from './helpers/spawn'
|
|
-import { exec } from 'child_process'
|
|
|
|
|
|
+import { exec, ChildProcess } from 'child_process'
|
|
import { TauriConfig } from './types/config'
|
|
import { TauriConfig } from './types/config'
|
|
import { CargoManifest } from './types/cargo'
|
|
import { CargoManifest } from './types/cargo'
|
|
import getTauriConfig from './helpers/tauri-config'
|
|
import getTauriConfig from './helpers/tauri-config'
|
|
@@ -32,7 +32,7 @@ class Runner {
|
|
tauriWatcher?: FSWatcher
|
|
tauriWatcher?: FSWatcher
|
|
devPath?: string
|
|
devPath?: string
|
|
killPromise?: Function
|
|
killPromise?: Function
|
|
- ranBeforeDevCommand?: boolean
|
|
|
|
|
|
+ beforeDevProcess?: ChildProcess
|
|
devServer?: net.Server
|
|
devServer?: net.Server
|
|
|
|
|
|
constructor() {
|
|
constructor() {
|
|
@@ -54,8 +54,7 @@ class Runner {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- if (!this.ranBeforeDevCommand && cfg.build.beforeDevCommand) {
|
|
|
|
- this.ranBeforeDevCommand = true // prevent calling it twice on recursive call on our watcher
|
|
|
|
|
|
+ if (!this.beforeDevProcess && cfg.build.beforeDevCommand) {
|
|
log('Running `' + cfg.build.beforeDevCommand + '`')
|
|
log('Running `' + cfg.build.beforeDevCommand + '`')
|
|
const ls = exec(cfg.build.beforeDevCommand, {
|
|
const ls = exec(cfg.build.beforeDevCommand, {
|
|
cwd: appDir,
|
|
cwd: appDir,
|
|
@@ -67,7 +66,8 @@ class Runner {
|
|
})
|
|
})
|
|
|
|
|
|
ls.stderr?.pipe(process.stderr)
|
|
ls.stderr?.pipe(process.stderr)
|
|
- ls.stdout?.pipe(process.stdout)
|
|
|
|
|
|
+ ls.stdout?.pipe(process.stdout)
|
|
|
|
+ this.beforeDevProcess = ls
|
|
}
|
|
}
|
|
|
|
|
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
@@ -171,7 +171,7 @@ class Runner {
|
|
}
|
|
}
|
|
|
|
|
|
if (!this.tauriWatcher) {
|
|
if (!this.tauriWatcher) {
|
|
- // eslint-disable-next-line security/detect-non-literal-fs-filename
|
|
|
|
|
|
+ // eslint-disable-next-line security/detect-non-literal-fs-filename
|
|
this.tauriWatcher = chokidar
|
|
this.tauriWatcher = chokidar
|
|
.watch(
|
|
.watch(
|
|
[
|
|
[
|