From a65ccf24f1878cc1f9d499717e64d4c5ddf58279 Mon Sep 17 00:00:00 2001 From: Shift Date: Mon, 10 Oct 2022 14:04:12 +0000 Subject: [PATCH 1/9] Bump `laravel/framework` dependency --- composer.json | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/composer.json b/composer.json index d2d3b4f..61f45fe 100644 --- a/composer.json +++ b/composer.json @@ -2,7 +2,10 @@ "name": "laravel/laravel", "type": "project", "description": "The Laravel Framework.", - "keywords": ["framework", "laravel"], + "keywords": [ + "framework", + "laravel" + ], "license": "MIT", "require": { "php": "^8.0.2", @@ -10,7 +13,7 @@ "fruitcake/laravel-cors": "^2.0.5", "guzzlehttp/guzzle": "^7.2", "intervention/image": "^2.7", - "laravel/framework": "^9.0", + "laravel/framework": "^9.19", "laravel/sanctum": "^2.14", "laravel/tinker": "^2.7", "laravel/ui": "^3.4", From 7670b7eba5c71e235cf06a9488243cddcdd98bd9 Mon Sep 17 00:00:00 2001 From: Shift Date: Mon, 10 Oct 2022 14:04:12 +0000 Subject: [PATCH 2/9] Add npm dependencies --- package.json | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index ce0db67..fb8d895 100644 --- a/package.json +++ b/package.json @@ -27,7 +27,6 @@ "jquery-datetimepicker": "^2.5.21", "jquery-sparkline": "^2.4.0", "jvectormap": "^2.0.4", - "laravel-mix": "^6.0.31", "load-google-maps-api": "^2.0.2", "lodash": "^4.17.21", "masonry-layout": "^4.2.2", @@ -41,8 +40,11 @@ "select2": "^4.0.11", "skycons": "^1.0.0", "sweetalert2": "^11.1.5", - "vue": "^2.6.14", + "vue": "^2.7.0", "vue-loader": "^15.9.8", - "vue-template-compiler": "^2.6.14" + "vue-template-compiler": "^2.6.14", + "vite": "^3.0.2", + "laravel-vite-plugin": "^0.6.0", + "@vitejs/plugin-vue2": "^1.1.2" } } From 8a9d7ee4d956b1ff9c802ed14a885cc4eacce540 Mon Sep 17 00:00:00 2001 From: Shift Date: Mon, 10 Oct 2022 14:04:12 +0000 Subject: [PATCH 3/9] Update build scripts --- package.json | 9 ++------- readme.md | 6 +++--- 2 files changed, 5 insertions(+), 10 deletions(-) diff --git a/package.json b/package.json index fb8d895..5cc974d 100644 --- a/package.json +++ b/package.json @@ -1,13 +1,8 @@ { "private": true, "scripts": { - "dev": "npm run development", - "development": "mix", - "watch": "mix watch", - "watch-poll": "mix watch -- --watch-options-poll=1000", - "hot": "mix watch --hot", - "prod": "npm run production", - "production": "mix --production" + "dev": "vite", + "build": "vite build" }, "devDependencies": { "axios": "^0.21.4", diff --git a/readme.md b/readme.md index f6e1a1b..b14f0b4 100644 --- a/readme.md +++ b/readme.md @@ -31,7 +31,7 @@ php artisan migrate:fresh --seed # Run migration and seed users and categories f yarn install # or npm i to Install node dependencies(>= node 9.x) -npm run production # To compile assets for prod +npm run build # To compile assets for prod ``` @@ -93,9 +93,9 @@ The current architecture of assets are inspired from [adminator](https://github. If you want to update the CSS, you can put them directly in [`resources/sass/app.scss`](https://github.com/kossa/laradminator/blob/master/resources/sass/app.scss#L72) or create new file under `resources/sass` and import it in [resources/sass/app.scss](https://github.com/kossa/laradminator/blob/master/resources/sass/app.scss#L5) -> VERY IMPORTANT: Any change you make on resources you have to run : `npm run dev` or `npm run prod`. +> VERY IMPORTANT: Any change you make on resources you have to run : `npm run dev` or `npm run build`. -> If you have a lot of changes it's much better to run: `npm run watch` to watch any changes on your files, take a look on [browersync](https://laravel.com/docs/master/mix#browsersync-reloading) +> If you have a lot of changes it's much better to run: `npm run dev` to watch any changes on your files, take a look on [browersync](https://laravel.com/docs/master/mix#browsersync-reloading) #### Create new CRUD From 3e1aac3446c827327750fb7dee01d3bd79a7ccb7 Mon Sep 17 00:00:00 2001 From: Shift Date: Mon, 10 Oct 2022 14:04:12 +0000 Subject: [PATCH 4/9] Configure Vite --- vite.config.js | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 vite.config.js diff --git a/vite.config.js b/vite.config.js new file mode 100644 index 0000000..0500310 --- /dev/null +++ b/vite.config.js @@ -0,0 +1,24 @@ +import { defineConfig } from 'vite'; +import laravel from 'laravel-vite-plugin'; +import vue from '@vitejs/plugin-vue2'; + +export default defineConfig({ + plugins: [ + laravel({ + input: [ + 'resources/sass/app.scss', + 'resources/sass/rtl.scss', + 'resources/js/app.js', + ], + refresh: true, + }), + vue({ + template: { + transformAssetUrls: { + base: null, + includeAbsolute: false, + }, + }, + }), + ], +}); From 75d0a154e412d5fdf648e22d79c73ec8657bf13a Mon Sep 17 00:00:00 2001 From: Shift Date: Mon, 10 Oct 2022 14:04:12 +0000 Subject: [PATCH 5/9] Remove `webpack.mix.js` --- webpack.mix.js | 35 ----------------------------------- 1 file changed, 35 deletions(-) delete mode 100644 webpack.mix.js diff --git a/webpack.mix.js b/webpack.mix.js deleted file mode 100644 index d7a9095..0000000 --- a/webpack.mix.js +++ /dev/null @@ -1,35 +0,0 @@ -const mix = require('laravel-mix'); - -/* - |-------------------------------------------------------------------------- - | Mix Asset Management - |-------------------------------------------------------------------------- - | - | Mix provides a clean, fluent API for defining some Webpack build steps - | for your Laravel application. By default, we are compiling the Sass - | file for the application as well as bundling up all the JS files. - | - */ - -mix.webpackConfig(webpack => { - return { - plugins: [ - new webpack.ProvidePlugin({ - $: 'jquery', - jQuery: 'jquery', - 'window.jQuery': 'jquery', - Popper: ['popper.js', 'default'], - }) - ] - }; -}); - - -mix.js('resources/js/app.js', 'public/js') - .vue() - .sass('resources/sass/app.scss', 'public/css') - .sass('resources/sass/rtl.scss', 'public/css') - .copyDirectory('resources/sass/static/images','public/images') - .browserSync(process.env.APP_URL) - .version() - .sourceMaps(); From 266a7f360d3ec798d93a0e3c3a782c85094b548c Mon Sep 17 00:00:00 2001 From: Shift Date: Mon, 10 Oct 2022 14:04:12 +0000 Subject: [PATCH 6/9] Use ES modules --- resources/js/app.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/js/app.js b/resources/js/app.js index 042e322..62a2b82 100644 --- a/resources/js/app.js +++ b/resources/js/app.js @@ -1,5 +1,5 @@ -require('./bootstrap'); +import './bootstrap'; // import Vue from 'vue'; From 0ba8c21f1ad5f35cc65fed2687a2fa618b1c139f Mon Sep 17 00:00:00 2001 From: Shift Date: Mon, 10 Oct 2022 14:04:12 +0000 Subject: [PATCH 7/9] Rename ENV variables --- .env.example | 4 ++-- resources/js/bootstrap.js | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.env.example b/.env.example index 9bb1bd7..1a33404 100644 --- a/.env.example +++ b/.env.example @@ -48,5 +48,5 @@ PUSHER_APP_KEY= PUSHER_APP_SECRET= PUSHER_APP_CLUSTER=mt1 -MIX_PUSHER_APP_KEY="${PUSHER_APP_KEY}" -MIX_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}" +VITE_PUSHER_APP_KEY="${PUSHER_APP_KEY}" +VITE_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}" diff --git a/resources/js/bootstrap.js b/resources/js/bootstrap.js index 762a3d1..5330b98 100644 --- a/resources/js/bootstrap.js +++ b/resources/js/bootstrap.js @@ -50,8 +50,8 @@ // window.Echo = new Echo({ // broadcaster: 'pusher', -// key: process.env.MIX_PUSHER_APP_KEY, -// cluster: process.env.MIX_PUSHER_APP_CLUSTER, +// key: import.meta.env.VITE_PUSHER_APP_KEY, +// cluster: import.meta.env.VITE_PUSHER_APP_CLUSTER, // encrypted: true // }); From 96a2dbb6327b64cbed570cebf52af862c77065f9 Mon Sep 17 00:00:00 2001 From: Shift Date: Mon, 10 Oct 2022 14:04:12 +0000 Subject: [PATCH 8/9] Use new `@vite` Blade directive --- resources/views/admin/default.blade.php | 2 +- resources/views/layouts/partials/head.blade.php | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/resources/views/admin/default.blade.php b/resources/views/admin/default.blade.php index ee9d1a1..f714290 100644 --- a/resources/views/admin/default.blade.php +++ b/resources/views/admin/default.blade.php @@ -39,7 +39,7 @@ - + @vite('resources/js/app.js') diff --git a/resources/views/layouts/partials/head.blade.php b/resources/views/layouts/partials/head.blade.php index 075c227..6b8a959 100644 --- a/resources/views/layouts/partials/head.blade.php +++ b/resources/views/layouts/partials/head.blade.php @@ -8,8 +8,8 @@ {{ config('app.name', 'Laravel') }} - - {{-- --}} + @vite('resources/css/app.css') + {{-- @vite('resources/css/rtl.css') --}} From 0a1cc0a582311f1ddbcf8f53d988f5eda3b45be6 Mon Sep 17 00:00:00 2001 From: Shift Date: Mon, 10 Oct 2022 14:04:13 +0000 Subject: [PATCH 9/9] Ignore build assets --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 228147a..c59a02c 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,6 @@ /node_modules /public/hot +/public/build /public/storage /storage/*.key /vendor