Skip to content

Commit 57c8f43

Browse files
Ziggy -> Wayfinder (#2)
* ziggy -> wayfinder * Update tests.yml * Update .gitignore --------- Co-authored-by: Taylor Otwell <[email protected]>
1 parent 587aed3 commit 57c8f43

File tree

14 files changed

+84
-113
lines changed

14 files changed

+84
-113
lines changed

.github/workflows/tests.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,6 @@ jobs:
3434
- name: Install Node Dependencies
3535
run: npm ci
3636

37-
- name: Build Assets
38-
run: npm run build
39-
4037
- name: Install Dependencies
4138
run: composer install --no-interaction --prefer-dist --optimize-autoloader
4239

@@ -46,5 +43,8 @@ jobs:
4643
- name: Generate Application Key
4744
run: php artisan key:generate
4845

46+
- name: Build Assets
47+
run: npm run build
48+
4949
- name: Tests
5050
run: ./vendor/bin/phpunit

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@
44
/public/build
55
/public/hot
66
/public/storage
7+
/resources/js/actions
8+
/resources/js/routes
9+
/resources/js/wayfinder
710
/storage/*.key
811
/storage/pail
912
/vendor

.prettierignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,2 @@
11
resources/js/components/ui/*
2-
resources/js/ziggy.js
32
resources/views/mail/*

app/Http/Middleware/HandleInertiaRequests.php

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
use Illuminate\Foundation\Inspiring;
66
use Illuminate\Http\Request;
77
use Inertia\Middleware;
8-
use Tighten\Ziggy\Ziggy;
98

109
class HandleInertiaRequests extends Middleware
1110
{
@@ -46,10 +45,6 @@ public function share(Request $request): array
4645
'auth' => [
4746
'user' => $request->user(),
4847
],
49-
'ziggy' => fn (): array => [
50-
...(new Ziggy)->toArray(),
51-
'location' => $request->url(),
52-
],
5348
];
5449
}
5550
}

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
"inertiajs/inertia-laravel": "^2.0",
1414
"laravel/framework": "^12.0",
1515
"laravel/tinker": "^2.10.1",
16-
"tightenco/ziggy": "^2.4"
16+
"laravel/wayfinder": "^0.1.11"
1717
},
1818
"require-dev": {
1919
"fakerphp/faker": "^1.23",

composer.lock

Lines changed: 63 additions & 71 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package-lock.json

Lines changed: 7 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
},
1313
"devDependencies": {
1414
"@eslint/js": "^9.19.0",
15+
"@laravel/vite-plugin-wayfinder": "^0.1.3",
1516
"@types/node": "^22.13.5",
1617
"eslint": "^9.17.0",
1718
"eslint-config-prettier": "^10.0.1",

resources/js/ssr.tsx

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import { createInertiaApp } from '@inertiajs/react';
22
import createServer from '@inertiajs/react/server';
33
import { resolvePageComponent } from 'laravel-vite-plugin/inertia-helpers';
44
import ReactDOMServer from 'react-dom/server';
5-
import { type RouteName, route } from 'ziggy-js';
65

76
const appName = import.meta.env.VITE_APP_NAME || 'Laravel';
87

@@ -12,19 +11,6 @@ createServer((page) =>
1211
render: ReactDOMServer.renderToString,
1312
title: (title) => title ? `${title} - ${appName}` : appName,
1413
resolve: (name) => resolvePageComponent(`./pages/${name}.tsx`, import.meta.glob('./pages/**/*.tsx')),
15-
setup: ({ App, props }) => {
16-
/* eslint-disable */
17-
// @ts-expect-error
18-
global.route<RouteName> = (name, params, absolute) =>
19-
route(name, params as any, absolute, {
20-
// @ts-expect-error
21-
...page.props.ziggy,
22-
// @ts-expect-error
23-
location: new URL(page.props.ziggy.location),
24-
});
25-
/* eslint-enable */
26-
27-
return <App {...props} />;
28-
},
14+
setup: ({ App, props }) => <App {...props} />,
2915
}),
3016
);

resources/js/types/global.d.ts

Lines changed: 0 additions & 5 deletions
This file was deleted.

0 commit comments

Comments
 (0)