Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,6 @@ jobs:
- name: Install Node Dependencies
run: npm ci

- name: Build Assets
run: npm run build

- name: Install Dependencies
run: composer install --no-interaction --prefer-dist --optimize-autoloader

Expand All @@ -46,5 +43,8 @@ jobs:
- name: Generate Application Key
run: php artisan key:generate

- name: Build Assets
run: npm run build

- name: Tests
run: ./vendor/bin/phpunit
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
/public/build
/public/hot
/public/storage
/resources/js/actions
/resources/js/routes
/resources/js/wayfinder
/storage/*.key
/storage/pail
/vendor
Expand Down
1 change: 0 additions & 1 deletion .prettierignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
resources/js/components/ui/*
resources/js/ziggy.js
resources/views/mail/*
5 changes: 0 additions & 5 deletions app/Http/Middleware/HandleInertiaRequests.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
use Illuminate\Foundation\Inspiring;
use Illuminate\Http\Request;
use Inertia\Middleware;
use Tighten\Ziggy\Ziggy;

class HandleInertiaRequests extends Middleware
{
Expand Down Expand Up @@ -46,10 +45,6 @@ public function share(Request $request): array
'auth' => [
'user' => $request->user(),
],
'ziggy' => fn (): array => [
...(new Ziggy)->toArray(),
'location' => $request->url(),
],
];
}
}
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"inertiajs/inertia-laravel": "^2.0",
"laravel/framework": "^12.0",
"laravel/tinker": "^2.10.1",
"tightenco/ziggy": "^2.4"
"laravel/wayfinder": "^0.1.11"
},
"require-dev": {
"fakerphp/faker": "^1.23",
Expand Down
134 changes: 63 additions & 71 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
},
"devDependencies": {
"@eslint/js": "^9.19.0",
"@laravel/vite-plugin-wayfinder": "^0.1.3",
"@types/node": "^22.13.5",
"eslint": "^9.17.0",
"eslint-config-prettier": "^10.0.1",
Expand Down
16 changes: 1 addition & 15 deletions resources/js/ssr.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import { createInertiaApp } from '@inertiajs/react';
import createServer from '@inertiajs/react/server';
import { resolvePageComponent } from 'laravel-vite-plugin/inertia-helpers';
import ReactDOMServer from 'react-dom/server';
import { type RouteName, route } from 'ziggy-js';

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

Expand All @@ -12,19 +11,6 @@ createServer((page) =>
render: ReactDOMServer.renderToString,
title: (title) => title ? `${title} - ${appName}` : appName,
resolve: (name) => resolvePageComponent(`./pages/${name}.tsx`, import.meta.glob('./pages/**/*.tsx')),
setup: ({ App, props }) => {
/* eslint-disable */
// @ts-expect-error
global.route<RouteName> = (name, params, absolute) =>
route(name, params as any, absolute, {
// @ts-expect-error
...page.props.ziggy,
// @ts-expect-error
location: new URL(page.props.ziggy.location),
});
/* eslint-enable */

return <App {...props} />;
},
setup: ({ App, props }) => <App {...props} />,
}),
);
5 changes: 0 additions & 5 deletions resources/js/types/global.d.ts

This file was deleted.

3 changes: 0 additions & 3 deletions resources/js/types/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import type { Config } from 'ziggy-js';

export interface Auth {
user: User;
}
Expand All @@ -8,7 +6,6 @@ export interface SharedData {
name: string;
quote: { message: string; author: string };
auth: Auth;
ziggy: Config & { location: string };
[key: string]: unknown;
}

Expand Down
1 change: 0 additions & 1 deletion resources/views/app.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
<link rel="preconnect" href="https://fonts.bunny.net">
<link href="https://fonts.bunny.net/css?family=instrument-sans:400,500,600" rel="stylesheet" />

@routes
@viteReactRefresh
@vite(['resources/js/app.tsx', "resources/js/pages/{$page['component']}.tsx"])
@inertiaHead
Expand Down
3 changes: 1 addition & 2 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,7 @@
"skipLibCheck": true /* Skip type checking all .d.ts files. */,
"baseUrl": ".",
"paths": {
"@/*": ["./resources/js/*"],
"ziggy-js": ["./vendor/tightenco/ziggy"]
"@/*": ["./resources/js/*"]
},
"jsx": "react-jsx"
},
Expand Down
10 changes: 4 additions & 6 deletions vite.config.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { wayfinder } from '@laravel/vite-plugin-wayfinder';
import tailwindcss from '@tailwindcss/vite';
import react from '@vitejs/plugin-react';
import laravel from 'laravel-vite-plugin';
import { resolve } from 'node:path';
import { defineConfig } from 'vite';

export default defineConfig({
Expand All @@ -13,13 +13,11 @@ export default defineConfig({
}),
react(),
tailwindcss(),
wayfinder({
formVariants: true,
}),
],
esbuild: {
jsx: 'automatic',
},
resolve: {
alias: {
'ziggy-js': resolve(__dirname, 'vendor/tightenco/ziggy'),
},
},
});