@@ -3,6 +3,7 @@ import { execSync } from 'child_process';
33import * as fs from 'fs' ;
44import * as path from 'path' ;
55import * as fse from 'fs-extra' ;
6+ import { glob } from 'glob' ;
67
78export 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 ( / \s d a r k : [ ^ \s " ' ] + / g, '' ) ,
206+ ) ;
207+ }
208+ }
190209}
0 commit comments