Skip to content

Commit a7334aa

Browse files
authored
Merge pull request #33 from harold-padilla/jetstream-v3-support
Upgrading to Jetstream V3
2 parents 22436f0 + b02db76 commit a7334aa

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

58 files changed

+1072
-636
lines changed

package-lock.json

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

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@
1919
"dependencies": {
2020
"@oclif/core": "^1.6.4",
2121
"@oclif/plugin-help": "^5.1.12",
22-
"fs-extra": "^10.0.1"
22+
"fs-extra": "^10.0.1",
23+
"glob": "^8.1.0"
2324
},
2425
"devDependencies": {
2526
"@oclif/test": "^2.1.0",

src/commands/install.ts

Lines changed: 31 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { execSync } from 'child_process';
33
import * as fs from 'fs';
44
import * as path from 'path';
55
import * as fse from 'fs-extra';
6+
import { glob } from 'glob';
67

78
export default class Install extends Command {
89
static description = 'Replaces vue with react in a fresh installation';
@@ -18,6 +19,7 @@ export default class Install extends Command {
1819
teams: Flags.boolean({ default: false }),
1920
ssr: Flags.boolean({ default: false }),
2021
force: Flags.boolean({ default: false }),
22+
dark: Flags.boolean({ default: false }),
2123
};
2224

2325
static args = [];
@@ -30,21 +32,20 @@ export default class Install extends Command {
3032
'@types/react': '^18.0.25',
3133
'@types/react-dom': '^18.0.8',
3234
'@types/ziggy-js': '^1.3.0',
33-
'@vitejs/plugin-react': '^2.0.0',
35+
'@vitejs/plugin-react': '^2.2.0',
3436
autoprefixer: '^10.4.7',
35-
'laravel-vite-plugin': '^0.5.0',
37+
'laravel-vite-plugin': '^0.5.4',
3638
postcss: '^8.4.14',
37-
prettier: '^2.6.2',
38-
tailwindcss: '^3.1.0',
39+
prettier: '^2.8.4',
40+
tailwindcss: '^3.2.7',
3941
typescript: '^4.6.3',
4042
vite: '^3.0.0',
4143
};
4244

4345
private deps = {
44-
'@headlessui/react': '^1.5.0',
45-
'@inertiajs/inertia': '^0.11.1',
46-
'@inertiajs/inertia-react': '^0.8.1',
47-
'@inertiajs/progress': '^0.2.7',
46+
'@headlessui/react': '^1.7.11',
47+
'@inertiajs/core': '^1.0.2',
48+
'@inertiajs/react': '^1.0.2',
4849
axios: '^0.26.1',
4950
classnames: '^2.3.1',
5051
lodash: '^4.17.21',
@@ -54,10 +55,8 @@ export default class Install extends Command {
5455
};
5556

5657
private oldDeps = [
57-
'@inertiajs/inertia',
58-
'@inertiajs/inertia-vue3',
59-
'@inertiajs/progress',
60-
'@inertiajs/server',
58+
'@inertiajs/core',
59+
'@inertiajs/vue3',
6160
'@vitejs/plugin-vue',
6261
'laravel-vite-plugin',
6362
'vite',
@@ -161,6 +160,10 @@ export default class Install extends Command {
161160
fs.rmSync(path.join(process.cwd(), 'resources', 'js', 'ssr.tsx'));
162161
}
163162

163+
if (!flags.dark) {
164+
this.removeDarkMode();
165+
}
166+
164167
this.log('Replacing app.blade.php');
165168
this.moveStub(
166169
'resources/views/app.blade.php',
@@ -187,4 +190,20 @@ export default class Install extends Command {
187190
.map(([key, value]) => `"${key}@${value}"`)
188191
.join(' ');
189192
}
193+
194+
private removeDarkMode() {
195+
const paths = glob.sync(path.join(process.cwd(), 'resources/js/**/*.tsx'));
196+
for (const path of paths) {
197+
if (path.endsWith('Pages/Welcome.tsx')) {
198+
continue;
199+
}
200+
201+
const contents = fs.readFileSync(path);
202+
203+
fs.writeFileSync(
204+
path,
205+
contents.toString().replace(/\sdark:[^\s"']+/g, ''),
206+
);
207+
}
208+
}
190209
}

src/stubs/resources/js/Components/ActionMessage.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,9 @@ export default function ActionMessage({
1919
leave-from-class="opacity-100"
2020
leaveTo="opacity-0"
2121
>
22-
<div className="text-sm text-gray-600">{children}</div>
22+
<div className="text-sm text-gray-600 dark:text-gray-400">
23+
{children}
24+
</div>
2325
</Transition>
2426
</div>
2527
);

src/stubs/resources/js/Components/ActionSection.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ export default function ActionSection({
1616
<SectionTitle title={title} description={description} />
1717

1818
<div className="mt-5 md:mt-0 md:col-span-2">
19-
<div className="px-4 py-5 sm:p-6 bg-white shadow sm:rounded-lg">
19+
<div className="px-4 py-5 sm:p-6 bg-white dark:bg-gray-800 shadow sm:rounded-lg">
2020
{children}
2121
</div>
2222
</div>

src/stubs/resources/js/Components/ApplicationLogo.tsx

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
11
import React from 'react';
22

3-
export default function ApplicationLogo({
4-
className,
5-
}: {
6-
className?: string;
7-
}) {
3+
export default function ApplicationLogo({ className }: { className?: string }) {
84
return (
95
<svg
106
viewBox="0 0 317 48"
@@ -14,7 +10,7 @@ export default function ApplicationLogo({
1410
>
1511
<path
1612
d="M74.09 30.04V13h-4.14v21H82.1v-3.96h-8.01zM95.379 19v1.77c-1.08-1.35-2.7-2.19-4.89-2.19-3.99 0-7.29 3.45-7.29 7.92s3.3 7.92 7.29 7.92c2.19 0 3.81-.84 4.89-2.19V34h3.87V19h-3.87zm-4.17 11.73c-2.37 0-4.14-1.71-4.14-4.23 0-2.52 1.77-4.23 4.14-4.23 2.4 0 4.17 1.71 4.17 4.23 0 2.52-1.77 4.23-4.17 4.23zM106.628 21.58V19h-3.87v15h3.87v-7.17c0-3.15 2.55-4.05 4.56-3.81V18.7c-1.89 0-3.78.84-4.56 2.88zM124.295 19v1.77c-1.08-1.35-2.7-2.19-4.89-2.19-3.99 0-7.29 3.45-7.29 7.92s3.3 7.92 7.29 7.92c2.19 0 3.81-.84 4.89-2.19V34h3.87V19h-3.87zm-4.17 11.73c-2.37 0-4.14-1.71-4.14-4.23 0-2.52 1.77-4.23 4.14-4.23 2.4 0 4.17 1.71 4.17 4.23 0 2.52-1.77 4.23-4.17 4.23zM141.544 19l-3.66 10.5-3.63-10.5h-4.26l5.7 15h4.41l5.7-15h-4.26zM150.354 28.09h11.31c.09-.51.15-1.02.15-1.59 0-4.41-3.15-7.92-7.59-7.92-4.71 0-7.92 3.45-7.92 7.92s3.18 7.92 8.22 7.92c2.88 0 5.13-1.17 6.54-3.21l-3.12-1.8c-.66.87-1.86 1.5-3.36 1.5-2.04 0-3.69-.84-4.23-2.82zm-.06-3c.45-1.92 1.86-3.03 3.93-3.03 1.62 0 3.24.87 3.72 3.03h-7.65zM164.516 34h3.87V12.1h-3.87V34zM185.248 34.36c3.69 0 6.9-2.01 6.9-6.3V13h-2.1v15.06c0 3.03-2.07 4.26-4.8 4.26-2.19 0-3.93-.78-4.62-2.61l-1.77 1.05c1.05 2.43 3.57 3.6 6.39 3.6zM203.124 18.64c-4.65 0-7.83 3.45-7.83 7.86 0 4.53 3.24 7.86 7.98 7.86 3.03 0 5.34-1.41 6.6-3.45l-1.74-1.02c-.81 1.44-2.46 2.55-4.83 2.55-3.18 0-5.55-1.89-5.97-4.95h13.17c.03-.3.06-.63.06-.93 0-4.11-2.85-7.92-7.44-7.92zm0 1.92c2.58 0 4.98 1.71 5.4 5.01h-11.19c.39-2.94 2.64-5.01 5.79-5.01zM221.224 20.92V19h-4.32v-4.2l-1.98.6V19h-3.15v1.92h3.15v9.09c0 3.6 2.25 4.59 6.3 3.99v-1.74c-2.91.12-4.32.33-4.32-2.25v-9.09h4.32zM225.176 22.93c0-1.62 1.59-2.37 3.15-2.37 1.44 0 2.97.57 3.6 2.1l1.65-.96c-.87-1.86-2.79-3.06-5.25-3.06-3 0-5.13 1.89-5.13 4.29 0 5.52 8.76 3.39 8.76 7.11 0 1.77-1.68 2.4-3.45 2.4-2.01 0-3.57-.99-4.11-2.52l-1.68.99c.75 1.92 2.79 3.45 5.79 3.45 3.21 0 5.43-1.77 5.43-4.32 0-5.52-8.76-3.39-8.76-7.11zM244.603 20.92V19h-4.32v-4.2l-1.98.6V19h-3.15v1.92h3.15v9.09c0 3.6 2.25 4.59 6.3 3.99v-1.74c-2.91.12-4.32.33-4.32-2.25v-9.09h4.32zM249.883 21.49V19h-1.98v15h1.98v-8.34c0-3.72 2.34-4.98 4.74-4.98v-1.92c-1.92 0-3.69.63-4.74 2.73zM263.358 18.64c-4.65 0-7.83 3.45-7.83 7.86 0 4.53 3.24 7.86 7.98 7.86 3.03 0 5.34-1.41 6.6-3.45l-1.74-1.02c-.81 1.44-2.46 2.55-4.83 2.55-3.18 0-5.55-1.89-5.97-4.95h13.17c.03-.3.06-.63.06-.93 0-4.11-2.85-7.92-7.44-7.92zm0 1.92c2.58 0 4.98 1.71 5.4 5.01h-11.19c.39-2.94 2.64-5.01 5.79-5.01zM286.848 19v2.94c-1.26-2.01-3.39-3.3-6.06-3.3-4.23 0-7.74 3.42-7.74 7.86s3.51 7.86 7.74 7.86c2.67 0 4.8-1.29 6.06-3.3V34h1.98V19h-1.98zm-5.91 13.44c-3.33 0-5.91-2.61-5.91-5.94 0-3.33 2.58-5.94 5.91-5.94s5.91 2.61 5.91 5.94c0 3.33-2.58 5.94-5.91 5.94zM309.01 18.64c-1.92 0-3.75.87-4.86 2.73-.84-1.74-2.46-2.73-4.56-2.73-1.8 0-3.42.72-4.59 2.55V19h-1.98v15H295v-8.31c0-3.72 2.16-5.13 4.32-5.13 2.13 0 3.51 1.41 3.51 4.08V34h1.98v-8.31c0-3.72 1.86-5.13 4.17-5.13 2.13 0 3.66 1.41 3.66 4.08V34h1.98v-9.36c0-3.75-2.31-6-5.61-6z"
17-
fill="#000"
13+
fill="fill-black dark:fill-white"
1814
/>
1915
<path
2016
d="M11.395 44.428C4.557 40.198 0 32.632 0 24 0 10.745 10.745 0 24 0a23.891 23.891 0 0113.997 4.502c-.2 17.907-11.097 33.245-26.602 39.926z"

src/stubs/resources/js/Components/AuthenticationCard.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@ export default function AuthenticationCard({
55
children,
66
}: PropsWithChildren<Record<string, unknown>>) {
77
return (
8-
<div className="min-h-screen flex flex-col sm:justify-center items-center pt-6 sm:pt-0 bg-gray-100">
8+
<div className="min-h-screen flex flex-col sm:justify-center items-center pt-6 sm:pt-0 bg-gray-100 dark:bg-gray-900">
99
<div>
1010
<AuthenticationCardLogo />
1111
</div>
1212

13-
<div className="w-full sm:max-w-md mt-6 px-6 py-4 bg-white shadow-md overflow-hidden sm:rounded-lg">
13+
<div className="w-full sm:max-w-md mt-6 px-6 py-4 bg-white dark:bg-gray-800 shadow-md overflow-hidden sm:rounded-lg">
1414
{children}
1515
</div>
1616
</div>

src/stubs/resources/js/Components/AuthenticationCardLogo.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
import { InertiaLink } from '@inertiajs/inertia-react';
1+
import { Link } from '@inertiajs/react';
22
import React from 'react';
33

44
export default function AuthenticationCardLogo() {
55
return (
6-
<InertiaLink href="/">
6+
<Link href="/">
77
<svg
88
className="w-16 h-16"
99
viewBox="0 0 48 48"
@@ -19,6 +19,6 @@ export default function AuthenticationCardLogo() {
1919
fill="#6875F5"
2020
/>
2121
</svg>
22-
</InertiaLink>
22+
</Link>
2323
);
2424
}

src/stubs/resources/js/Components/Banner.tsx

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
1-
import { Page } from '@inertiajs/inertia';
2-
import { usePage } from '@inertiajs/inertia-react';
3-
import classNames from 'classnames';
41
import React, { useState } from 'react';
2+
import classNames from 'classnames';
3+
import useTypedPage from '@/Hooks/useTypedPage';
54

65
export default function Banner() {
76
const [show, setShow] = useState(true);
8-
const { props } = usePage<Page<{ jetstream: any }>>();
7+
const { props } = useTypedPage();
98
const style = props.jetstream.flash?.bannerStyle || 'success';
109
const message = props.jetstream.flash?.banner || '';
1110

src/stubs/resources/js/Components/Checkbox.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ export default function Checkbox(
1212
type="checkbox"
1313
{...props}
1414
className={classNames(
15-
'rounded border-gray-300 text-indigo-600 shadow-sm focus:border-indigo-300 focus:ring focus:ring-indigo-200 focus:ring-opacity-50',
15+
'rounded dark:bg-gray-900 border-gray-300 dark:border-gray-700 text-indigo-600 shadow-sm focus:ring-indigo-500 dark:focus:ring-indigo-600 dark:focus:ring-offset-gray-800',
1616
props.className,
1717
)}
1818
/>

0 commit comments

Comments
 (0)