Skip to content

Commit 426d805

Browse files
authored
Supports Laravel Nova 5.3.0 (#31)
* Supports Laravel Nova 5.3.0 Signed-off-by: Mior Muhammad Zaki <[email protected]> * wip Signed-off-by: Mior Muhammad Zaki <[email protected]> * Add `nova:enable-vue-devtool` and `nova:disable-vue-devtool` command. Signed-off-by: Mior Muhammad Zaki <[email protected]> * wip Signed-off-by: Mior Muhammad Zaki <[email protected]> * wip Signed-off-by: Mior Muhammad Zaki <[email protected]> * wip Signed-off-by: Mior Muhammad Zaki <[email protected]> * wip Signed-off-by: Mior Muhammad Zaki <[email protected]> * wip Signed-off-by: Mior Muhammad Zaki <[email protected]> * wip Signed-off-by: Mior Muhammad Zaki <[email protected]> * wip Signed-off-by: Mior Muhammad Zaki <[email protected]> * wip Signed-off-by: Mior Muhammad Zaki <[email protected]> --------- Signed-off-by: Mior Muhammad Zaki <[email protected]>
1 parent fe2c31a commit 426d805

12 files changed

+435
-256
lines changed

composer.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,15 @@
1313
"symfony/polyfill-php83": "^1.31"
1414
},
1515
"require-dev": {
16-
"laravel/nova": "^5.2.6",
16+
"laravel/nova": "^5.3.0",
1717
"laravel/pint": "^1.17",
1818
"orchestra/pest-plugin-testbench": "^2.0|^3.0",
1919
"orchestra/testbench": "^8.30|^9.8|^10.0",
2020
"phpstan/phpstan": "^2.1",
2121
"spatie/laravel-ray": "^1.39.1"
2222
},
2323
"conflict": {
24-
"laravel/nova": "<5.2.6 || >=6.0.0"
24+
"laravel/nova": "<5.3.0 || >=6.0.0"
2525
},
2626
"autoload": {
2727
"psr-4": {

dist/mixins/DependentFormField.d.ts

+6
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,12 @@ declare namespace _default {
5757
* @returns {boolean}
5858
*/
5959
function currentlyIsReadonly(): boolean;
60+
/**
61+
* Determine if the field is in immutable state.
62+
*
63+
* @return {boolean}
64+
*/
65+
function currentlyIsImmutable(): boolean;
6066
/**
6167
* @returns {string[]}
6268
*/

dist/mixins/FormField.d.ts

+7-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
declare namespace _default {
22
export { FormEvents as extends };
33
export let props: {
4-
[x: string]: any;
4+
[key: string]: any;
55
};
66
export let emits: string[];
77
export function data(): {
@@ -87,6 +87,12 @@ declare namespace _default {
8787
* @returns {boolean}
8888
*/
8989
function isReadonly(): boolean;
90+
/**
91+
* Determine if the field is in immutable state.
92+
*
93+
* @return {boolean}
94+
*/
95+
function isImmutable(): boolean;
9096
/**
9197
* Determine if the field is accessed from Action.
9298
*

dist/mixins/MetricBehavior.d.ts

+4
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,11 @@ declare namespace _default {
2929
export { _default_2 as default };
3030
}
3131
}
32+
function data(): {
33+
metricUniqueId: string;
34+
};
3235
function created(): void;
36+
function mounted(): void;
3337
function beforeUnmount(): void;
3438
namespace methods {
3539
function fetch(): void;

package-lock.json

+280-201
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+6-6
Original file line numberDiff line numberDiff line change
@@ -5,29 +5,29 @@
55
"types": "types/index.d.ts",
66
"devDependencies": {
77
"@babel/preset-typescript": "^7.24.7",
8-
"@inertiajs/vue3": "^2.0.3",
8+
"@inertiajs/vue3": "^2.0.4",
99
"axios": "^1.7.9",
1010
"lodash": "^4.17.21",
1111
"tailwindcss": "^3.4.17",
12-
"typescript": "^5.7.3",
12+
"typescript": "^5.8.2",
1313
"vue": "^3.5.13",
1414
"vuex": "^4.1.0"
1515
},
1616
"dependencies": {
1717
"@vue/compiler-sfc": "^3.5.13",
1818
"autoprefixer": "^10.4.20",
1919
"laravel-mix": "^6.0.49",
20-
"postcss": "^8.5.1",
20+
"postcss": "^8.5.3",
2121
"postcss-import": "^14.1.0",
2222
"prettier-plugin-tailwindcss": "^0.5.14",
2323
"vue-loader": "^17.4.2"
2424
},
2525
"peerDependencies": {
26-
"@inertiajs/core": "^2.0.3",
27-
"@inertiajs/vue3": "^2.0.3",
26+
"@inertiajs/core": "^2.0.4",
27+
"@inertiajs/vue3": "^2.0.4",
2828
"@tailwindcss/container-queries": "^0.1.1",
2929
"@tailwindcss/typography": "^0.5.16",
30-
"axios": "^1.7.9",
30+
"axios": "^1.8.1",
3131
"lodash": "^4.17.21",
3232
"tailwindcss": "^3.4.17",
3333
"vue": "^3.5.13",

src/Console/DevToolCommand.php

+2-43
Original file line numberDiff line numberDiff line change
@@ -154,56 +154,15 @@ protected function installNpmDependencies(Filesystem $filesystem, PackageManifes
154154
*/
155155
protected function enablesVueDevTool(Filesystem $filesystem, PackageManifest $manifest): int
156156
{
157-
$novaVendorPath = join_paths($manifest->vendorPath, 'laravel', 'nova');
158-
159-
$publicPath = join_paths($novaVendorPath, 'public');
160-
$publicCachePath = join_paths($novaVendorPath, 'public-cached');
161-
$webpackFile = join_paths($novaVendorPath, 'webpack.mix.js');
162-
163-
if (! $filesystem->isDirectory($publicCachePath)) {
164-
$filesystem->makeDirectory($publicCachePath);
165-
166-
$filesystem->copyDirectory($publicPath, $publicCachePath);
167-
$filesystem->put(join_paths($publicCachePath, '.gitignore'), '*');
168-
}
169-
170-
if (! $filesystem->isFile($webpackFile)) {
171-
$filesystem->copy("{$webpackFile}.dist", $webpackFile);
172-
}
173-
174-
$this->executeCommand(['npm set progress=false', 'npm ci'], $novaVendorPath);
175-
$filesystem->put(join_paths($novaVendorPath, 'node_modules', '.gitignore'), '*');
176-
177-
$this->executeCommand(['npm set progress=false', 'npm run dev'], $novaVendorPath);
178-
179-
$this->call('vendor:publish', ['--tag' => 'nova-assets', '--force' => true]);
180-
181-
return self::SUCCESS;
157+
return $this->call('nova:enable-vue-devtool', ['--force' => true]);
182158
}
183159

184160
/**
185161
* Disables Vue DevTool.
186162
*/
187163
protected function disablesVueDevTool(Filesystem $filesystem, PackageManifest $manifest): int
188164
{
189-
$novaVendorPath = join_paths($manifest->vendorPath, 'laravel', 'nova');
190-
191-
$publicPath = join_paths($novaVendorPath, 'public');
192-
$publicCachePath = join_paths($novaVendorPath, 'public-cached');
193-
194-
if ($filesystem->isDirectory($publicCachePath)) {
195-
if ($filesystem->isDirectory($publicPath)) {
196-
$filesystem->deleteDirectory($publicPath);
197-
}
198-
199-
$filesystem->delete(join_paths($publicCachePath, '.gitignore'));
200-
$filesystem->copyDirectory($publicCachePath, $publicPath);
201-
$filesystem->deleteDirectory($publicCachePath);
202-
}
203-
204-
$this->call('vendor:publish', ['--tag' => 'nova-assets', '--force' => true]);
205-
206-
return self::SUCCESS;
165+
return $this->call('nova:disable-vue-devtool', ['--force' => true]);
207166
}
208167

209168
/**
+58
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
<?php
2+
3+
namespace Laravel\Nova\DevTool\Console;
4+
5+
use Illuminate\Console\Command;
6+
use Illuminate\Console\ConfirmableTrait;
7+
use Illuminate\Filesystem\Filesystem;
8+
use Illuminate\Foundation\PackageManifest;
9+
use Symfony\Component\Console\Attribute\AsCommand;
10+
11+
use function Orchestra\Sidekick\join_paths;
12+
13+
#[AsCommand(name: 'nova:disable-vue-devtool', description: 'Disable Vue DevTool for Laravel Nova')]
14+
class DisableVueDevToolCommand extends Command
15+
{
16+
use Concerns\InteractsWithProcess;
17+
use ConfirmableTrait;
18+
19+
/** {@inheritDoc} */
20+
#[\Override]
21+
protected function configure()
22+
{
23+
parent::configure();
24+
25+
if (defined('TESTBENCH_WORKING_PATH')) {
26+
$this->setHidden(true);
27+
}
28+
}
29+
30+
/**
31+
* Execute the console command.
32+
*/
33+
public function handle(Filesystem $filesystem, PackageManifest $manifest): int
34+
{
35+
if (! $this->confirmToProceed()) {
36+
return self::FAILURE;
37+
}
38+
39+
$novaVendorPath = join_paths($manifest->vendorPath, 'laravel', 'nova');
40+
41+
$publicPath = join_paths($novaVendorPath, 'public');
42+
$publicCachePath = join_paths($novaVendorPath, 'public-cached');
43+
44+
if ($filesystem->isDirectory($publicCachePath)) {
45+
if ($filesystem->isDirectory($publicPath)) {
46+
$filesystem->deleteDirectory($publicPath);
47+
}
48+
49+
$filesystem->delete(join_paths($publicCachePath, '.gitignore'));
50+
$filesystem->copyDirectory($publicCachePath, $publicPath);
51+
$filesystem->deleteDirectory($publicCachePath);
52+
}
53+
54+
$this->call('vendor:publish', ['--tag' => 'nova-assets', '--force' => true]);
55+
56+
return self::SUCCESS;
57+
}
58+
}
+65
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
<?php
2+
3+
namespace Laravel\Nova\DevTool\Console;
4+
5+
use Illuminate\Console\Command;
6+
use Illuminate\Console\ConfirmableTrait;
7+
use Illuminate\Filesystem\Filesystem;
8+
use Illuminate\Foundation\PackageManifest;
9+
use Symfony\Component\Console\Attribute\AsCommand;
10+
11+
use function Orchestra\Sidekick\join_paths;
12+
13+
#[AsCommand(name: 'nova:enable-vue-devtool', description: 'Enable Vue DevTool for Laravel Nova')]
14+
class EnableVueDevToolCommand extends Command
15+
{
16+
use Concerns\InteractsWithProcess;
17+
use ConfirmableTrait;
18+
19+
/** {@inheritDoc} */
20+
#[\Override]
21+
protected function configure()
22+
{
23+
parent::configure();
24+
25+
if (defined('TESTBENCH_WORKING_PATH')) {
26+
$this->setHidden(true);
27+
}
28+
}
29+
30+
/**
31+
* Execute the console command.
32+
*/
33+
public function handle(Filesystem $filesystem, PackageManifest $manifest): int
34+
{
35+
if (! $this->confirmToProceed()) {
36+
return self::FAILURE;
37+
}
38+
39+
$novaVendorPath = join_paths($manifest->vendorPath, 'laravel', 'nova');
40+
41+
$publicPath = join_paths($novaVendorPath, 'public');
42+
$publicCachePath = join_paths($novaVendorPath, 'public-cached');
43+
$webpackFile = join_paths($novaVendorPath, 'webpack.mix.js');
44+
45+
if (! $filesystem->isDirectory($publicCachePath)) {
46+
$filesystem->makeDirectory($publicCachePath);
47+
48+
$filesystem->copyDirectory($publicPath, $publicCachePath);
49+
$filesystem->put(join_paths($publicCachePath, '.gitignore'), '*');
50+
}
51+
52+
if (! $filesystem->isFile($webpackFile)) {
53+
$filesystem->copy("{$webpackFile}.dist", $webpackFile);
54+
}
55+
56+
$this->executeCommand(['npm set progress=false', 'npm ci'], $novaVendorPath);
57+
$filesystem->put(join_paths($novaVendorPath, 'node_modules', '.gitignore'), '*');
58+
59+
$this->executeCommand(['npm set progress=false', 'npm run dev'], $novaVendorPath);
60+
61+
$this->call('vendor:publish', ['--tag' => 'nova-assets', '--force' => true]);
62+
63+
return self::SUCCESS;
64+
}
65+
}

src/DevToolServiceProvider.php

+3-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,8 @@ public function register(): void
3535
}
3636

3737
$this->commands([
38-
Console\DevToolCommand::class,
38+
Console\DisableVueDevToolCommand::class,
39+
Console\EnableVueDevToolCommand::class,
3940
]);
4041

4142
if (defined('TESTBENCH_WORKING_PATH')) {
@@ -60,6 +61,7 @@ public function register(): void
6061
Console\ActionCommand::class,
6162
Console\BaseResourceCommand::class,
6263
Console\DashboardCommand::class,
64+
Console\DevToolCommand::class,
6365
Console\FilterCommand::class,
6466
Console\LensCommand::class,
6567
Console\PartitionCommand::class,

types/@types/laravel-nova-ui/Button.vue.d.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,8 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
5757
leadingIcon: {};
5858
trailingIcon: {};
5959
}>> & Readonly<{}>, {
60-
size: string;
6160
as: string;
61+
size: string;
6262
variant: string;
6363
state: string;
6464
padding: string;

types/@types/laravel-nova-ui/Icon.vue.d.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
1515
default: string;
1616
};
1717
}>> & Readonly<{}>, {
18-
name: string;
1918
type: string;
19+
name: string;
2020
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
2121
export default _default;

0 commit comments

Comments
 (0)