|
@@ -15,13 +15,13 @@ discard block |
|
|
block discarded – undo |
|
15
|
15
|
return false; |
|
16
|
16
|
} |
|
17
|
17
|
|
|
18
|
|
- $watchPathFiles = isset($config['watch_path_files']) ? (array)$config['watch_path_files'] : []; |
|
|
18
|
+ $watchPathFiles = isset($config['watch_path_files']) ? (array) $config['watch_path_files'] : []; |
|
19
|
19
|
if (empty($watchPathFiles)) { |
|
20
|
20
|
$this->warning('No file to watch by chokidar'); |
|
21
|
21
|
return false; |
|
22
|
22
|
} |
|
23
|
23
|
|
|
24
|
|
- $callback = function (Process $worker) use ($config, $laravelConf, $watchPathFiles) { |
|
|
24
|
+ $callback = function(Process $worker) use ($config, $laravelConf, $watchPathFiles) { |
|
25
|
25
|
$log = !empty($config['log']); |
|
26
|
26
|
$watch_base_path = $config['watch_base_path']; |
|
27
|
27
|
$this->setProcessTitle(sprintf('%s laravels: chokidar process', $config['process_prefix'])); |
|
@@ -29,14 +29,14 @@ discard block |
|
|
block discarded – undo |
|
29
|
29
|
$nodeScriptPath = realpath(__DIR__.'/../../bin/file-watcher.cjs'); |
|
30
|
30
|
$this->info(sprintf('$nodeScriptPath: %s', $nodeScriptPath)); |
|
31
|
31
|
|
|
32
|
|
- $watchOptions = isset($config['watch_options']) ? (array)$config['watch_options'] : ['ignoreInitial' => true]; |
|
|
32
|
+ $watchOptions = isset($config['watch_options']) ? (array) $config['watch_options'] : ['ignoreInitial' => true]; |
|
33
|
33
|
$worker->exec($nodeExecutable, [$nodeScriptPath, |
|
34
|
34
|
json_encode(collect($watchPathFiles)->map(fn ($path) => $watch_base_path.'/'.$path)), |
|
35
|
35
|
json_encode($watchOptions), |
|
36
|
36
|
]); |
|
37
|
37
|
|
|
38
|
38
|
// 获取 Node.js 脚本的输出 |
|
39
|
|
- tap($worker->read(), function ($output) use ($log, $laravelConf) { |
|
|
39
|
+ tap($worker->read(), function($output) use ($log, $laravelConf) { |
|
40
|
40
|
Portal::runLaravelSCommand($laravelConf['root_path'], 'reload'); |
|
41
|
41
|
if ($log) { |
|
42
|
42
|
$this->info(sprintf('reloaded by chokidar, reason: %s', $output)); |