Browse Source

fix: vite frontend tooling

Muhammad Iqbal Afandi 3 years ago
parent
commit
b9e404f6f1

+ 6
- 0
.env.example View File

46
 PUSHER_APP_ID=
46
 PUSHER_APP_ID=
47
 PUSHER_APP_KEY=
47
 PUSHER_APP_KEY=
48
 PUSHER_APP_SECRET=
48
 PUSHER_APP_SECRET=
49
+PUSHER_HOST=
50
+PUSHER_PORT=443
51
+PUSHER_SCHEME=https
49
 PUSHER_APP_CLUSTER=mt1
52
 PUSHER_APP_CLUSTER=mt1
50
 
53
 
51
 VITE_PUSHER_APP_KEY="${PUSHER_APP_KEY}"
54
 VITE_PUSHER_APP_KEY="${PUSHER_APP_KEY}"
55
+VITE_PUSHER_HOST="${PUSHER_HOST}"
56
+VITE_PUSHER_PORT="${PUSHER_PORT}"
57
+VITE_PUSHER_SCHEME="${PUSHER_SCHEME}"
52
 VITE_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}"
58
 VITE_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}"

+ 2
- 2
app/Http/Controllers/CustomerController.php View File

20
      */
20
      */
21
     public function index()
21
     public function index()
22
     {
22
     {
23
-        return inertia('Customers/Index.vue', [
23
+        return inertia('Customers/Index', [
24
             'initialSearch' => request('search'),
24
             'initialSearch' => request('search'),
25
             'customers' => Customer::filter(request()->only('search'))
25
             'customers' => Customer::filter(request()->only('search'))
26
                 ->latest()
26
                 ->latest()
79
      */
79
      */
80
     public function edit(Customer $customer)
80
     public function edit(Customer $customer)
81
     {
81
     {
82
-        return inertia('Customers/Edit.vue', compact('customer'));
82
+        return inertia('Customers/Edit', compact('customer'));
83
     }
83
     }
84
 
84
 
85
     /**
85
     /**

+ 1
- 1
app/Http/Controllers/DashboardController.php View File

14
      */
14
      */
15
     public function __invoke(Request $request)
15
     public function __invoke(Request $request)
16
     {
16
     {
17
-        return inertia('Dashboards/Index.vue');
17
+        return inertia('Dashboards/Index');
18
     }
18
     }
19
 }
19
 }

+ 1
- 1
app/Http/Controllers/PurchaseController.php View File

27
      */
27
      */
28
     public function index()
28
     public function index()
29
     {
29
     {
30
-        return inertia('Purchases/Index.vue', [
30
+        return inertia('Purchases/Index', [
31
             'initialSearch' => request('search'),
31
             'initialSearch' => request('search'),
32
             'purchases' => Purchase::filter(request()->only('search'))
32
             'purchases' => Purchase::filter(request()->only('search'))
33
                 ->latest()
33
                 ->latest()

+ 2
- 2
app/Http/Controllers/SupplierController.php View File

20
      */
20
      */
21
     public function index()
21
     public function index()
22
     {
22
     {
23
-        return inertia('Suppliers/Index.vue', [
23
+        return inertia('Suppliers/Index', [
24
             'initialSearch' => request('search'),
24
             'initialSearch' => request('search'),
25
             'suppliers' => Supplier::filter(request()->only('search'))
25
             'suppliers' => Supplier::filter(request()->only('search'))
26
                 ->latest()
26
                 ->latest()
80
      */
80
      */
81
     public function edit(Supplier $supplier)
81
     public function edit(Supplier $supplier)
82
     {
82
     {
83
-        return inertia('Suppliers/Edit.vue', compact('supplier'));
83
+        return inertia('Suppliers/Edit', compact('supplier'));
84
     }
84
     }
85
 
85
 
86
     /**
86
     /**

+ 2
- 2
composer.json View File

8
   ],
8
   ],
9
   "license": "MIT",
9
   "license": "MIT",
10
   "require": {
10
   "require": {
11
-    "php": "^8.0|^8.1",
11
+    "php": "^8.0.2",
12
     "fruitcake/laravel-cors": "^2.0.5",
12
     "fruitcake/laravel-cors": "^2.0.5",
13
     "guzzlehttp/guzzle": "^7.2",
13
     "guzzlehttp/guzzle": "^7.2",
14
     "inertiajs/inertia-laravel": "^0.5.4",
14
     "inertiajs/inertia-laravel": "^0.5.4",
15
-    "laravel/framework": "^9.0",
15
+    "laravel/framework": "^9.19",
16
     "laravel/sanctum": "^2.14",
16
     "laravel/sanctum": "^2.14",
17
     "laravel/tinker": "^2.7",
17
     "laravel/tinker": "^2.7",
18
     "maatwebsite/excel": "^3.1",
18
     "maatwebsite/excel": "^3.1",

+ 13
- 13
composer.lock View File

4
         "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
4
         "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
5
         "This file is @generated automatically"
5
         "This file is @generated automatically"
6
     ],
6
     ],
7
-    "content-hash": "c95b0e2a152a8654b1f0ff918e5d0d09",
7
+    "content-hash": "cf9797e5b5b20287f0213c45da310a85",
8
     "packages": [
8
     "packages": [
9
         {
9
         {
10
             "name": "asm89/stack-cors",
10
             "name": "asm89/stack-cors",
1709
         },
1709
         },
1710
         {
1710
         {
1711
             "name": "league/flysystem",
1711
             "name": "league/flysystem",
1712
-            "version": "3.0.23",
1712
+            "version": "3.1.0",
1713
             "source": {
1713
             "source": {
1714
                 "type": "git",
1714
                 "type": "git",
1715
                 "url": "https://github.com/thephpleague/flysystem.git",
1715
                 "url": "https://github.com/thephpleague/flysystem.git",
1716
-                "reference": "5b461a96d01144744077343908a2c196682c71e6"
1716
+                "reference": "34a68067b7ae3b836ea5e57e1fc432478372a4f5"
1717
             },
1717
             },
1718
             "dist": {
1718
             "dist": {
1719
                 "type": "zip",
1719
                 "type": "zip",
1720
-                "url": "https://api.github.com/repos/thephpleague/flysystem/zipball/5b461a96d01144744077343908a2c196682c71e6",
1721
-                "reference": "5b461a96d01144744077343908a2c196682c71e6",
1720
+                "url": "https://api.github.com/repos/thephpleague/flysystem/zipball/34a68067b7ae3b836ea5e57e1fc432478372a4f5",
1721
+                "reference": "34a68067b7ae3b836ea5e57e1fc432478372a4f5",
1722
                 "shasum": ""
1722
                 "shasum": ""
1723
             },
1723
             },
1724
             "require": {
1724
             "require": {
1779
             ],
1779
             ],
1780
             "support": {
1780
             "support": {
1781
                 "issues": "https://github.com/thephpleague/flysystem/issues",
1781
                 "issues": "https://github.com/thephpleague/flysystem/issues",
1782
-                "source": "https://github.com/thephpleague/flysystem/tree/3.0.23"
1782
+                "source": "https://github.com/thephpleague/flysystem/tree/3.1.0"
1783
             },
1783
             },
1784
             "funding": [
1784
             "funding": [
1785
                 {
1785
                 {
1795
                     "type": "tidelift"
1795
                     "type": "tidelift"
1796
                 }
1796
                 }
1797
             ],
1797
             ],
1798
-            "time": "2022-06-29T08:19:13+00:00"
1798
+            "time": "2022-06-29T17:29:54+00:00"
1799
         },
1799
         },
1800
         {
1800
         {
1801
             "name": "league/mime-type-detection",
1801
             "name": "league/mime-type-detection",
2277
         },
2277
         },
2278
         {
2278
         {
2279
             "name": "nesbot/carbon",
2279
             "name": "nesbot/carbon",
2280
-            "version": "2.59.0",
2280
+            "version": "2.59.1",
2281
             "source": {
2281
             "source": {
2282
                 "type": "git",
2282
                 "type": "git",
2283
                 "url": "https://github.com/briannesbitt/Carbon.git",
2283
                 "url": "https://github.com/briannesbitt/Carbon.git",
2284
-                "reference": "9cea2f72585a46d0651ee6d4c8c8f752e78c16c6"
2284
+                "reference": "a9000603ea337c8df16cc41f8b6be95a65f4d0f5"
2285
             },
2285
             },
2286
             "dist": {
2286
             "dist": {
2287
                 "type": "zip",
2287
                 "type": "zip",
2288
-                "url": "https://api.github.com/repos/briannesbitt/Carbon/zipball/9cea2f72585a46d0651ee6d4c8c8f752e78c16c6",
2289
-                "reference": "9cea2f72585a46d0651ee6d4c8c8f752e78c16c6",
2288
+                "url": "https://api.github.com/repos/briannesbitt/Carbon/zipball/a9000603ea337c8df16cc41f8b6be95a65f4d0f5",
2289
+                "reference": "a9000603ea337c8df16cc41f8b6be95a65f4d0f5",
2290
                 "shasum": ""
2290
                 "shasum": ""
2291
             },
2291
             },
2292
             "require": {
2292
             "require": {
2375
                     "type": "tidelift"
2375
                     "type": "tidelift"
2376
                 }
2376
                 }
2377
             ],
2377
             ],
2378
-            "time": "2022-06-26T20:26:59+00:00"
2378
+            "time": "2022-06-29T21:43:55+00:00"
2379
         },
2379
         },
2380
         {
2380
         {
2381
             "name": "nette/schema",
2381
             "name": "nette/schema",
8513
     "prefer-stable": true,
8513
     "prefer-stable": true,
8514
     "prefer-lowest": false,
8514
     "prefer-lowest": false,
8515
     "platform": {
8515
     "platform": {
8516
-        "php": "^8.0|^8.1"
8516
+        "php": "^8.0.2"
8517
     },
8517
     },
8518
     "platform-dev": [],
8518
     "platform-dev": [],
8519
     "plugin-api-version": "2.3.0"
8519
     "plugin-api-version": "2.3.0"

+ 346
- 4686
package-lock.json
File diff suppressed because it is too large
View File


+ 1
- 6
package.json View File

11
     "@inertiajs/progress": "^0.2.7",
11
     "@inertiajs/progress": "^0.2.7",
12
     "@vitejs/plugin-vue": "^2.3.3",
12
     "@vitejs/plugin-vue": "^2.3.3",
13
     "axios": "^0.25",
13
     "axios": "^0.25",
14
-    "browser-sync": "^2.27.7",
15
-    "browser-sync-webpack-plugin": "^2.3.0",
16
     "chart.js": "^3.7.1",
14
     "chart.js": "^3.7.1",
17
     "dayjs": "^1.11.0",
15
     "dayjs": "^1.11.0",
18
     "laravel-vite-plugin": "^0.2.3",
16
     "laravel-vite-plugin": "^0.2.3",
22
     "primeicons": "^5.0.0",
20
     "primeicons": "^5.0.0",
23
     "primevue": "^3.15.0",
21
     "primevue": "^3.15.0",
24
     "quill": "^1.3.7",
22
     "quill": "^1.3.7",
25
-    "resolve-url-loader": "^5.0.0",
26
     "sass": "^1.49.8",
23
     "sass": "^1.49.8",
27
-    "sass-loader": "^12.1.0",
28
     "vite": "^2.9.13",
24
     "vite": "^2.9.13",
29
-    "vue": "^3.2.31",
30
-    "vue-loader": "^16.2.0"
25
+    "vue": "^3.2.31"
31
   }
26
   }
32
 }
27
 }

+ 31
- 0
resources/js/bootstrap.js View File

1
+/**
2
+ * We'll load the axios HTTP library which allows us to easily issue requests
3
+ * to our Laravel back-end. This library automatically handles sending the
4
+ * CSRF token as a header based on the value of the "XSRF" token cookie.
5
+ */
6
+
7
+import axios from 'axios'
8
+window.axios = axios
9
+
10
+window.axios.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest'
11
+
12
+/**
13
+ * Echo exposes an expressive API for subscribing to channels and listening
14
+ * for events that are broadcast by Laravel. Echo and event broadcasting
15
+ * allows your team to easily build robust real-time web applications.
16
+ */
17
+
18
+// import Echo from 'laravel-echo';
19
+
20
+// import Pusher from 'pusher-js';
21
+// window.Pusher = Pusher;
22
+
23
+// window.Echo = new Echo({
24
+//     broadcaster: 'pusher',
25
+//     key: import.meta.env.VITE_PUSHER_APP_KEY,
26
+//     wsHost: import.meta.env.VITE_PUSHER_HOST ?? `ws-${import.meta.env.VITE_PUSHER_CLUSTER}.pusher.com`,
27
+//     wsPort: import.meta.env.VITE_PUSHER_PORT ?? 80,
28
+//     wssPort: import.meta.env.VITE_PUSHER_PORT ?? 443,
29
+//     forceTLS: (import.meta.env.VITE_PUSHER_SCHEME ?? 'https') === 'https',
30
+//     enabledTransports: ['ws', 'wss'],
31
+// });

+ 7
- 1
resources/js/vue.js View File

1
+import './bootstrap'
1
 import { createApp, h } from 'vue'
2
 import { createApp, h } from 'vue'
2
 import { createInertiaApp } from '@inertiajs/inertia-vue3'
3
 import { createInertiaApp } from '@inertiajs/inertia-vue3'
3
 import { InertiaProgress } from '@inertiajs/progress'
4
 import { InertiaProgress } from '@inertiajs/progress'
5
+import { resolvePageComponent } from 'laravel-vite-plugin/inertia-helpers'
4
 
6
 
5
 import 'primevue/resources/themes/mdc-light-indigo/theme.css'
7
 import 'primevue/resources/themes/mdc-light-indigo/theme.css'
6
 import 'primevue/resources/primevue.min.css'
8
 import 'primevue/resources/primevue.min.css'
37
 
39
 
38
 createInertiaApp({
40
 createInertiaApp({
39
   title: (title) => `${title} - Cahaya Agung`,
41
   title: (title) => `${title} - Cahaya Agung`,
40
-  resolve: (name) => import(`./pages/${name}`),
42
+  resolve: (name) =>
43
+    resolvePageComponent(
44
+      `./pages/${name}.vue`,
45
+      import.meta.glob('./pages/**/*.vue')
46
+    ),
41
   setup({ el, App, props, plugin }) {
47
   setup({ el, App, props, plugin }) {
42
     createApp({ render: () => h(App, props) })
48
     createApp({ render: () => h(App, props) })
43
       .use(plugin)
49
       .use(plugin)

+ 3
- 1
vite.config.js View File

4
 
4
 
5
 export default defineConfig({
5
 export default defineConfig({
6
   plugins: [
6
   plugins: [
7
-    laravel(['resources/js/vue.js']),
7
+    laravel({
8
+      input: 'resources/js/vue.js',
9
+    }),
8
     vue({
10
     vue({
9
       template: {
11
       template: {
10
         transformAssetUrls: {
12
         transformAssetUrls: {