@@ -22,9 +22,10 @@ class VuetifyPreset extends Preset
2222 public static function install ($ withAuth = false )
2323 {
2424 static ::updatePackages ();
25- static ::removeSass (); // or static::updateLess()
25+ static ::updateSass ();
2626 static ::updateBootstrapping ();
2727 static ::updateWelcomePage ();
28+ static ::extraFiles ();
2829
2930 if ($ withAuth )
3031 {
@@ -39,10 +40,12 @@ protected static function updatePackageArray(array $packages)
3940 return array_merge ([
4041 'vuetify ' => '^1.0 ' ,
4142 'gravatar ' => '^1.0 ' ,
43+ 'vuex ' => '^3.0 ' ,
4244 ], Arr::except ($ packages , [
4345 'bootstrap ' ,
4446 'bootstrap-sass ' ,
4547 'jquery ' ,
48+ 'lodash ' ,
4649 'popper.js ' ,
4750 ]));
4851 }
@@ -52,12 +55,9 @@ protected static function updatePackageArray(array $packages)
5255 *
5356 * @return void
5457 */
55- protected static function removeSass ()
58+ protected static function updateSass ()
5659 {
57- // remove sass assets
58- (new Filesystem )->delete (
59- resource_path ('assets/sass ' )
60- );
60+ copy (__DIR__ .'/vuetify-stubs/resources/assets/sass/app.scss ' , resource_path ('assets/sass/app.scss ' ));
6161 }
6262
6363 /**
@@ -68,35 +68,28 @@ protected static function removeSass()
6868 protected static function updateBootstrapping ()
6969 {
7070 (new Filesystem )->delete (
71- base_path ('webpack.min.js ' )
72- );
73- copy (__DIR__ .'/vuetify-stubs/webpack.min.js ' , base_path ('webpack.min.js ' ));
74- (new Filesystem )->delete (
75- resource_path ('assets/js/bootstrap.js ' )
71+ resource_path ('assets/js ' )
7672 );
77- copy (__DIR__ .'/vuetify-stubs/js/bootstrap.js ' , resource_path ('assets/js/bootstrap.js ' ));
78- (new Filesystem )->delete (
79- resource_path ('assets/js/app.js ' )
80- );
81- copy (__DIR__ .'/vuetify-stubs/js/app.js ' , resource_path ('assets/js/app.js ' ));
73+ (new Filesystem )->copyDirectory (__DIR__ .'/vuetify-stubs/resources/assets/js ' , resource_path ('assets/js ' ));
8274
83- (new Filesystem )->delete (
84- resource_path ('assets/js/components/ExampleComponent.vue ' )
85- );
86- copy (__DIR__ .'/vuetify-stubs/js/components/LoginButtonComponent.js ' , resource_path ('assets/js/components/LoginButtonComponent.js ' ));
87- copy (__DIR__ .'/vuetify-stubs/js/components/RegisterButtonComponent.js ' , resource_path ('assets/js/components/RegisterButtonComponent.js ' ));
8875 }
8976
9077 protected static function updateWelcomePage ()
9178 {
9279 mkdir (public_path ('img ' ));
93- copy (__DIR__ .'/vuetify-tasks/img/hero.jpeg ' , public_path ('img/hero.jpeg ' ));
94- copy (__DIR__ .'/vuetify-tasks/img/hero.jpeg ' , public_path ('img/logo.png ' ));
95- copy (__DIR__ .'/vuetify-tasks/img/hero.jpeg ' , public_path ('img/plane.jpg ' ));
96- copy (__DIR__ .'/vuetify-tasks/img/hero.jpeg ' , public_path ('img/section.jpg ' ));
97- copy (__DIR__ .'/vuetify-tasks/img/hero.jpeg ' , public_path ('img/vuetify.ǹg ' ));
98- (new Filesystem )->delete (resource_path ('views/welcome.blade.php ' ));
99- copy (__DIR__ .'/vuetify-stubs/views/welcome.blade.php ' , resource_path ('views/welcome.blade.php ' ));
80+ copy (__DIR__ .'/vuetify-tasks/public/img/hero.jpeg ' , public_path ('img/hero.jpeg ' ));
81+ copy (__DIR__ .'/vuetify-tasks/public/img/hero.jpeg ' , public_path ('img/logo.png ' ));
82+ copy (__DIR__ .'/vuetify-tasks/public/img/hero.jpeg ' , public_path ('img/plane.jpg ' ));
83+ copy (__DIR__ .'/vuetify-tasks/public/img/hero.jpeg ' , public_path ('img/section.jpg ' ));
84+ copy (__DIR__ .'/vuetify-tasks/public/img/hero.jpeg ' , public_path ('img/vuetify.ǹg ' ));
85+ copy (__DIR__ .'/vuetify-stubs/resources/views/welcome.blade.php ' , resource_path ('views/welcome.blade.php ' ));
86+ }
87+
88+ protected function extraFiles ()
89+ {
90+ copy (__DIR__ .'/vuetify-tasks/.editorconfig ' , base_path ('' ));
91+ copy (__DIR__ .'/vuetify-tasks/.eslintignore ' , base_path ('' ));
92+ copy (__DIR__ .'/vuetify-tasks/.eslinrc.js ' , base_path ('' ));
10093 }
10194
10295 /**
@@ -107,13 +100,33 @@ protected static function updateWelcomePage()
107100 protected static function addAuthTemplates ()
108101 {
109102 // Add Home controller
110- copy (__DIR__ .'/vuetify-stubs/Controllers/HomeController.php ' , app_path ('Http/Controllers/HomeController.php ' ));
103+ copy (__DIR__ .'/vuetify-stubs/app/Http/ Controllers/HomeController.php ' , app_path ('Http/Controllers/HomeController.php ' ));
111104
112105 // Add Auth routes in 'routes/web.php'
113106 $ auth_route_entry = "Auth::routes(); \n\nRoute::get('/home', 'HomeController@index')->name('home'); \n\n" ;
114107 file_put_contents ('./routes/web.php ' , $ auth_route_entry , FILE_APPEND );
115108
116109 // Copy Skeleton auth views from the stubs folder
117- (new Filesystem )->copyDirectory (__DIR__ .'/vuetify-stubs/views ' , resource_path ('views ' ));
110+ (new Filesystem )->copyDirectory (__DIR__ .'/vuetify-stubs/resources/views ' , resource_path ('views ' ));
111+
112+ //Overwrite default Auth controllers:
113+ copy (__DIR__ .'/vuetify-stubs/app/Http/Controllers/Auth/ForgotPasswordController.php ' , app_path ('Http/Controllers/Auth ' ));
114+ copy (__DIR__ .'/vuetify-stubs/app/Http/Controllers/Auth/LoginController.php ' , app_path ('Http/Controllers/Auth ' ));
115+ copy (__DIR__ .'/vuetify-stubs/app/Http/Controllers/Auth/RegisterController.php ' , app_path ('Http/Controllers/Auth ' ));
116+ copy (__DIR__ .'/vuetify-stubs/app/Http/Controllers/Auth/ResetPasswordController.php ' , app_path ('Http/Controllers/Auth ' ));
117+
118+ // Add LoggedUserController and test
119+ copy (__DIR__ .'/vuetify-stubs/app/Http/Controllers/LoggedUserController.php ' , app_path ('Http/Controllers ' ));
120+ copy (__DIR__ .'/vuetify-stubs/tests/Feature/LoggedUserControllerTest.php ' , base_path ('tests/Feature ' ));
121+
122+ // Add Logged user route in 'routes/api.php'
123+ $ logged_user_route_entry = "Route::group('['prefix'=>'v1','middleware' => 'auth:api'], function() { \nRoute::put('/user', 'LoggedUserController@update'); \n}); \n" ;
124+ file_put_contents ('./routes/api.php ' , $ logged_user_route_entry , FILE_APPEND );
125+
126+ // Laravel Passport
127+ copy (__DIR__ .'/vuetify-stubs/app/User.php ' , app_path ('' ));
128+ copy (__DIR__ .'/vuetify-stubs/app/Providers/AuthServiceProvider.php ' , app_path ('Providers ' ));
129+ copy (__DIR__ .'/vuetify-stubs/config/auth.php ' , base_path ('config ' ));
130+ copy (__DIR__ .'/vuetify-stubs/app/Http/Kernel.php ' , app_path ('Http ' ));
118131 }
119132}
0 commit comments