Skip to content

Commit ba29ffd

Browse files
authored
install command should always register laravel-nova-devtool to package.json (#13)
Signed-off-by: Mior Muhammad Zaki <[email protected]>
1 parent ca1b153 commit ba29ffd

File tree

1 file changed

+16
-6
lines changed

1 file changed

+16
-6
lines changed

Diff for: src/Console/DevToolCommand.php

+16-6
Original file line numberDiff line numberDiff line change
@@ -56,16 +56,24 @@ public function handle(Filesystem $filesystem, PackageManifest $manifest): int
5656
*/
5757
protected function installNovaWorkbench(Filesystem $filesystem, PackageManifest $manifest): int
5858
{
59-
$this->executeCommand([
60-
'npm set progress=false',
61-
'npm install --save-dev "vendor/laravel/nova-devtool"',
62-
], package_path());
59+
$this->installNoveDevtoolNpmDependencies();
6360

6461
return $this->call('workbench:install', [
6562
'--devtool' => true,
6663
]);
6764
}
6865

66+
/**
67+
* Install `laravel-nova-devtool` to `package.json`.
68+
*/
69+
protected function installNoveDevtoolNpmDependencies(): void
70+
{
71+
$this->executeCommand([
72+
'npm set progress=false',
73+
'npm install --save-dev "vendor/laravel/nova-devtool"',
74+
], package_path());
75+
}
76+
6977
/**
7078
* Install `tsconfig.json` configuration.
7179
*/
@@ -116,9 +124,11 @@ protected function installNpmDependencies(Filesystem $filesystem, PackageManifes
116124
return self::SUCCESS;
117125
}
118126

127+
$this->installNoveDevtoolNpmDependencies();
128+
119129
$this->executeCommand([
120130
'npm set progress=false',
121-
'npm install --dev '.implode(' ', $dependencies),
131+
'npm install --save-dev '.implode(' ', $dependencies),
122132
], package_path());
123133

124134
if (in_array('tailwindcss', $dependencies)) {
@@ -206,7 +216,7 @@ protected function promptForMissingArgumentsUsing(): array
206216
'install' => 'Install NPM Dependencies',
207217
'enable-vue-devtool' => 'Enable Vue DevTool',
208218
'disable-vue-devtool' => 'Disable Vue DevTool',
209-
'tsconfig' => 'Install `tsconfig.json` for Nova',
219+
'tsconfig' => is_file(package_path('tsconfig.json')) ? null : 'Install `tsconfig.json` for Nova',
210220
]),
211221
default: 'owner'
212222
),

0 commit comments

Comments
 (0)