@niyamulahsan/create-deskapp 1.2.4 → 1.2.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (104) hide show
  1. package/package.json +16 -16
  2. package/template/.env.example +20 -13
  3. package/template/AGENTS.md +699 -0
  4. package/template/package.json +3 -0
  5. package/template/src/config/app.ts +26 -24
  6. package/template/src/config/winsetup.ts +93 -91
  7. package/template/src/core/api/binding-error.ts +57 -0
  8. package/template/src/core/api/bindings.generated.ts +2 -0
  9. package/template/src/core/api/generate.manifest.ts +84 -80
  10. package/template/src/core/api/registry.ts +58 -48
  11. package/template/src/core/config.ts +101 -99
  12. package/template/src/core/database/aggregate.ts +89 -85
  13. package/template/src/core/database/config.ts +50 -48
  14. package/template/src/core/database/connection.ts +116 -114
  15. package/template/src/core/database/migrate-hooks.ts +86 -84
  16. package/template/src/core/database/paginate.ts +226 -224
  17. package/template/src/core/database/reset.ts +21 -19
  18. package/template/src/core/database/seed.ts +169 -167
  19. package/template/src/core/database/status.ts +37 -35
  20. package/template/src/core/env.ts +108 -106
  21. package/template/src/core/facade.ts +63 -61
  22. package/template/src/core/maker/db/fresh.ts +10 -8
  23. package/template/src/core/maker/db/generate.ts +13 -11
  24. package/template/src/core/maker/db/helpers.ts +92 -96
  25. package/template/src/core/maker/db/migrate.ts +37 -35
  26. package/template/src/core/maker/db/mod.ts +93 -91
  27. package/template/src/core/maker/db/module-migrate.ts +56 -54
  28. package/template/src/core/maker/db/push.ts +23 -21
  29. package/template/src/core/maker/db/reset.ts +8 -6
  30. package/template/src/core/maker/db/seed.ts +9 -7
  31. package/template/src/core/maker/db/status.ts +8 -6
  32. package/template/src/core/maker/help.ts +59 -57
  33. package/template/src/core/maker/make/controller.ts +25 -22
  34. package/template/src/core/maker/make/helpers.ts +97 -91
  35. package/template/src/core/maker/make/mod.ts +69 -67
  36. package/template/src/core/maker/make/model.ts +16 -14
  37. package/template/src/core/maker/make/module.ts +53 -39
  38. package/template/src/core/maker/make/seeder.ts +23 -21
  39. package/template/src/core/maker/make/test.ts +33 -30
  40. package/template/src/core/maker/mod.ts +85 -83
  41. package/template/src/core/maker/run/mod.ts +134 -132
  42. package/template/src/core/maker/stub.ts +26 -24
  43. package/template/src/core/maker/stubs/controller/controller.controller.stub +57 -55
  44. package/template/src/core/maker/stubs/controller/controller.schema.stub +18 -13
  45. package/template/src/core/maker/stubs/facade/facade.stub +21 -0
  46. package/template/src/core/maker/stubs/model/model.stub +10 -8
  47. package/template/src/core/maker/stubs/seeder/seeder.stub +18 -16
  48. package/template/src/core/maker/stubs/test/test.stub +9 -7
  49. package/template/src/core/maker/sync-config.ts +93 -94
  50. package/template/src/core/utils/password.ts +29 -27
  51. package/template/src/core/utils/playwright.ts +123 -121
  52. package/template/src/core/utils/queue.ts +68 -66
  53. package/template/src/core/utils/scheduler.ts +62 -60
  54. package/template/src/core/utils/storage.ts +3 -1
  55. package/template/src/core/utils/validation.ts +37 -35
  56. package/template/src/database/schema.ts +2 -0
  57. package/template/src/main.ts +120 -118
  58. package/template/src/modules/app/__tests__/demo.controller.test.ts +75 -0
  59. package/template/src/modules/app/__tests__/net.controller.test.ts +65 -0
  60. package/template/src/modules/app/__tests__/playwright.controller.test.ts +50 -0
  61. package/template/src/modules/app/__tests__/storage.controller.test.ts +114 -0
  62. package/template/src/modules/app/__tests__/window.controller.test.ts +98 -0
  63. package/template/src/modules/app/controllers/demo.controller.ts +120 -118
  64. package/template/src/modules/app/controllers/net.controller.ts +50 -48
  65. package/template/src/modules/app/controllers/playwright.controller.ts +142 -140
  66. package/template/src/modules/app/controllers/storage.controller.ts +231 -229
  67. package/template/src/modules/app/controllers/window.controller.ts +2 -0
  68. package/template/src/modules/app/facade.ts +21 -0
  69. package/template/src/preload.ts +25 -2
  70. package/template/src/ui/src/App.vue +4 -2
  71. package/template/src/ui/src/app.ts +38 -23
  72. package/template/src/ui/src/bindings.d.ts +18 -16
  73. package/template/src/ui/src/components/Button.vue +34 -32
  74. package/template/src/ui/src/components/Checkbox.vue +26 -29
  75. package/template/src/ui/src/components/Input.vue +221 -227
  76. package/template/src/ui/src/components/InputGroup.vue +141 -0
  77. package/template/src/ui/src/components/InputPasswordToggle.vue +204 -0
  78. package/template/src/ui/src/components/Modal.vue +65 -55
  79. package/template/src/ui/src/components/Spinner.vue +44 -42
  80. package/template/src/ui/src/components/Switch.vue +62 -65
  81. package/template/src/ui/src/components/TextArea.vue +108 -121
  82. package/template/src/ui/src/components/Toast.vue +55 -56
  83. package/template/src/ui/src/components/datatable/DataTableSkeleton.vue +100 -98
  84. package/template/src/ui/src/components/datatable/Pagination.vue +153 -125
  85. package/template/src/ui/src/components/datatable/SelectOpption.vue +36 -35
  86. package/template/src/ui/src/components/datatable/index.vue +336 -258
  87. package/template/src/ui/src/env.d.ts +16 -13
  88. package/template/src/ui/src/global.d.ts +21 -2
  89. package/template/src/ui/src/helpers/nformatter.ts +12 -10
  90. package/template/src/ui/src/pages/dashboard/index.vue +690 -687
  91. package/template/src/ui/src/plugins/browserDetect.ts +57 -0
  92. package/template/src/ui/src/plugins/gum.ts +576 -549
  93. package/template/src/ui/src/plugins/pulse.ts +181 -147
  94. package/template/src/ui/src/plugins/routeProgress.ts +89 -0
  95. package/template/src/ui/src/router/index.ts +44 -25
  96. package/template/src/ui/src/stores/example.ts +2 -0
  97. package/template/src/ui/vite.config.ts +40 -38
  98. package/template/src/window/app-menu.ts +89 -87
  99. package/template/src/window/config.ts +14 -12
  100. package/template/src/window/context-menu.ts +23 -21
  101. package/template/src/window/dialogs.ts +92 -90
  102. package/template/src/window/manager.ts +2 -0
  103. package/template/src/window/native.ts +47 -45
  104. package/template/src/window/tray.ts +132 -130
@@ -1,148 +1,182 @@
1
- import { io, type Socket } from "socket.io-client";
2
- import type { App } from "vue";
3
-
4
- declare const __SOCKET_ENABLED__: boolean;
5
-
6
- type EventCallback<T = unknown> = (payload: T) => void;
7
-
8
- type ChannelBinding = {
9
- event: string;
10
- callback: EventCallback;
11
- wrapped: EventCallback;
12
- };
13
-
14
- type PulseChannel = {
15
- listen: <T = unknown>(event: string, callback: EventCallback<T>) => PulseChannel;
16
- stopListening: (event: string, callback?: EventCallback) => PulseChannel;
17
- };
18
-
19
- export type PulseClient = {
20
- connect: () => PulseClient;
21
- disconnect: () => PulseClient;
22
- channel: (name: string) => PulseChannel;
23
- private: (room: string) => PulseChannel;
24
- leave: (room: string) => PulseClient;
25
- };
26
-
27
- function createPulse(): PulseClient {
28
- if (!__SOCKET_ENABLED__) {
29
- const n = (): PulseChannel => ({ listen: () => n(), stopListening: () => n() });
30
- const c: PulseClient = {
31
- connect: () => c,
32
- disconnect: () => c,
33
- channel: n,
34
- private: n,
35
- leave: () => c,
36
- };
37
- return c;
38
- }
39
-
40
- let socket: Socket | null = null;
41
- const channels = new Map<string, ChannelBinding[]>();
42
- const joinedRooms = new Set<string>();
43
-
44
- const socketUrl = () => {
45
- const explicit = import.meta.env.VITE_SOCKET_URL || import.meta.env.VITE_API_URL;
46
- if (explicit) return explicit;
47
- return window.location.origin;
48
- };
49
-
50
- const ensureConnected = () => {
51
- if (socket) return socket;
52
-
53
- socket = io(socketUrl(), {
54
- withCredentials: true,
55
- transports: ["websocket", "polling"],
56
- });
57
-
58
- socket.on("connect", () => {
59
- for (const room of joinedRooms) {
60
- socket?.emit("join", room);
61
- }
62
- });
63
-
64
- return socket;
65
- };
66
-
67
- const channel = (name: string): PulseChannel => {
68
- const room = String(name).trim();
69
- if (!room) throw new Error("Channel name is required");
70
-
71
- const currentSocket = ensureConnected();
72
- joinedRooms.add(room);
73
- currentSocket.emit("join", room);
74
-
75
- const api: PulseChannel = {
76
- listen: <T = unknown>(event: string, callback: EventCallback<T>) => {
77
- const wrapped = (payload: unknown) => callback(payload as T);
78
- const bindings = channels.get(room) || [];
79
- bindings.push({ event, callback: callback as EventCallback, wrapped });
80
- channels.set(room, bindings);
81
- currentSocket.on(event, wrapped);
82
- return api;
83
- },
84
- stopListening: (event: string, callback?: EventCallback) => {
85
- const bindings = channels.get(room) || [];
86
- const kept: ChannelBinding[] = [];
87
-
88
- for (const binding of bindings) {
89
- const matchesEvent = binding.event === event;
90
- const matchesCallback = !callback || binding.callback === callback;
91
- if (matchesEvent && matchesCallback) {
92
- currentSocket.off(binding.event, binding.wrapped);
93
- } else {
94
- kept.push(binding);
95
- }
96
- }
97
-
98
- if (kept.length > 0) channels.set(room, kept);
99
- else channels.delete(room);
100
- return api;
101
- },
102
- };
103
-
104
- return api;
105
- };
106
-
107
- const pulse: PulseClient = {
108
- connect: () => {
109
- ensureConnected();
110
- return pulse;
111
- },
112
- disconnect: () => {
113
- socket?.disconnect();
114
- socket = null;
115
- return pulse;
116
- },
117
- channel,
118
- private: (room: string) => channel(`private:${room}`),
119
- leave: (room: string) => {
120
- if (!socket) return pulse;
121
-
122
- const bindings = channels.get(room) || [];
123
- for (const binding of bindings) {
124
- socket.off(binding.event, binding.wrapped);
125
- }
126
-
127
- channels.delete(room);
128
- joinedRooms.delete(room);
129
- return pulse;
130
- },
131
- };
132
-
133
- return pulse;
134
- }
135
-
136
- export const pulse = createPulse();
137
-
138
- export const PulsePlugin = {
139
- install(app: App) {
140
- app.config.globalProperties.$pulse = pulse;
141
- },
142
- };
143
-
144
- declare module "vue" {
145
- interface ComponentCustomProperties {
146
- $pulse: PulseClient;
147
- }
1
+ // ./src/ui/src/plugins/pulse.ts
2
+
3
+ import { io, type Socket } from "socket.io-client";
4
+ import type { App } from "vue";
5
+
6
+ declare const __SOCKET_ENABLED__: boolean;
7
+
8
+ type EventCallback<T = unknown> = (payload: T) => void;
9
+
10
+ // Access token (or a getter returning one) sent with the Socket.IO handshake.
11
+ // The desktop client cannot send the httpOnly auth cookie, so the server reads
12
+ // this bare JWT from `handshake.auth.token`. A getter is preferred because it
13
+ // is resolved on every (re)connect.
14
+ export type PulseToken = string | null | (() => string | null);
15
+
16
+ type ChannelBinding = {
17
+ event: string;
18
+ callback: EventCallback;
19
+ wrapped: EventCallback;
20
+ };
21
+
22
+ type PulseChannel = {
23
+ listen: <T = unknown>(event: string, callback: EventCallback<T>) => PulseChannel;
24
+ stopListening: (event: string, callback?: EventCallback) => PulseChannel;
25
+ };
26
+
27
+ export type PulseClient = {
28
+ connect: () => PulseClient;
29
+ disconnect: () => PulseClient;
30
+ setToken: (token: PulseToken) => PulseClient;
31
+ channel: (name: string) => PulseChannel;
32
+ private: (room: string) => PulseChannel;
33
+ leave: (room: string) => PulseClient;
34
+ };
35
+
36
+ function createPulse(): PulseClient {
37
+ if (!__SOCKET_ENABLED__) {
38
+ const n = (): PulseChannel => ({ listen: () => n(), stopListening: () => n() });
39
+ const c: PulseClient = {
40
+ connect: () => c,
41
+ disconnect: () => c,
42
+ setToken: () => c,
43
+ channel: n,
44
+ private: n,
45
+ leave: () => c,
46
+ };
47
+ return c;
48
+ }
49
+
50
+ let socket: Socket | null = null;
51
+ let tokenSource: PulseToken = null;
52
+ const channels = new Map<string, ChannelBinding[]>();
53
+ const joinedRooms = new Set<string>();
54
+
55
+ // Resolve lazily so every reconnect picks up the current token.
56
+ const resolveToken = () => (typeof tokenSource === "function" ? tokenSource() : tokenSource);
57
+
58
+ const socketUrl = () => {
59
+ const explicit = import.meta.env.VITE_SOCKET_URL || import.meta.env.VITE_API_URL;
60
+ if (explicit) return explicit;
61
+ return window.location.origin;
62
+ };
63
+
64
+ const ensureConnected = () => {
65
+ if (socket) return socket;
66
+
67
+ socket = io(socketUrl(), {
68
+ withCredentials: true,
69
+ transports: ["websocket", "polling"],
70
+ auth: (callback) => {
71
+ const token = resolveToken();
72
+ callback(token ? { token } : {});
73
+ },
74
+ });
75
+
76
+ socket.on("connect", () => {
77
+ for (const room of joinedRooms) {
78
+ socket?.emit("join", room);
79
+ }
80
+ });
81
+
82
+ return socket;
83
+ };
84
+
85
+ const channel = (name: string): PulseChannel => {
86
+ const room = String(name).trim();
87
+ if (!room) throw new Error("Channel name is required");
88
+
89
+ const currentSocket = ensureConnected();
90
+ joinedRooms.add(room);
91
+ currentSocket.emit("join", room);
92
+
93
+ const api: PulseChannel = {
94
+ listen: <T = unknown>(event: string, callback: EventCallback<T>) => {
95
+ const wrapped = (payload: unknown) => callback(payload as T);
96
+ const bindings = channels.get(room) || [];
97
+ bindings.push({ event, callback: callback as EventCallback, wrapped });
98
+ channels.set(room, bindings);
99
+ currentSocket.on(event, wrapped);
100
+ return api;
101
+ },
102
+ stopListening: (event: string, callback?: EventCallback) => {
103
+ const bindings = channels.get(room) || [];
104
+ const kept: ChannelBinding[] = [];
105
+
106
+ for (const binding of bindings) {
107
+ const matchesEvent = binding.event === event;
108
+ const matchesCallback = !callback || binding.callback === callback;
109
+ if (matchesEvent && matchesCallback) {
110
+ currentSocket.off(binding.event, binding.wrapped);
111
+ } else {
112
+ kept.push(binding);
113
+ }
114
+ }
115
+
116
+ if (kept.length > 0) channels.set(room, kept);
117
+ else channels.delete(room);
118
+ return api;
119
+ },
120
+ };
121
+
122
+ return api;
123
+ };
124
+
125
+ const pulse: PulseClient = {
126
+ connect: () => {
127
+ ensureConnected();
128
+ return pulse;
129
+ },
130
+ disconnect: () => {
131
+ socket?.disconnect();
132
+ socket = null;
133
+ return pulse;
134
+ },
135
+ setToken: (token: PulseToken) => {
136
+ tokenSource = token;
137
+ if (socket) {
138
+ // Force a new handshake with the updated credentials. The connect
139
+ // handler re-joins every room in joinedRooms.
140
+ socket.disconnect().connect();
141
+ }
142
+ return pulse;
143
+ },
144
+ channel,
145
+ private: (room: string) => channel(`private:${room}`),
146
+ leave: (room: string) => {
147
+ const name = String(room).trim();
148
+ if (!name) return pulse;
149
+
150
+ joinedRooms.delete(name);
151
+ const bindings = channels.get(name) || [];
152
+ channels.delete(name);
153
+
154
+ if (socket) {
155
+ // Tell the server too: dropping listeners alone leaves the socket
156
+ // subscribed and still receiving that room's events.
157
+ socket.emit("leave", name);
158
+ for (const binding of bindings) {
159
+ socket.off(binding.event, binding.wrapped);
160
+ }
161
+ }
162
+
163
+ return pulse;
164
+ },
165
+ };
166
+
167
+ return pulse;
168
+ }
169
+
170
+ export const pulse = createPulse();
171
+
172
+ export const PulsePlugin = {
173
+ install(app: App) {
174
+ app.config.globalProperties.$pulse = pulse;
175
+ },
176
+ };
177
+
178
+ declare module "vue" {
179
+ interface ComponentCustomProperties {
180
+ $pulse: PulseClient;
181
+ }
148
182
  }
@@ -0,0 +1,89 @@
1
+ // ./src/ui/src/plugins/routeProgress.ts
2
+
3
+ import type { Router } from "vue-router";
4
+
5
+ const BAR_ID = "app-route-progress";
6
+
7
+ function ensureBar(): HTMLElement {
8
+ const existing = document.getElementById(BAR_ID);
9
+ if (existing) return existing;
10
+
11
+ const bar = document.createElement("div");
12
+ bar.id = BAR_ID;
13
+ bar.style.position = "fixed";
14
+ bar.style.top = "0";
15
+ bar.style.left = "0";
16
+ bar.style.right = "0";
17
+ bar.style.height = "2px";
18
+ bar.style.width = "100vw";
19
+ bar.style.opacity = "0";
20
+ bar.style.zIndex = "99999";
21
+ bar.style.pointerEvents = "none";
22
+ bar.style.background = "linear-gradient(90deg, #2563eb, #06b6d4)";
23
+ bar.style.boxShadow = "0 0 8px rgba(37, 99, 235, 0.5)";
24
+ bar.style.transformOrigin = "left center";
25
+ bar.style.transform = "scaleX(0)";
26
+ bar.style.transition = "transform 0.25s ease, opacity 0.2s ease";
27
+ document.body.appendChild(bar);
28
+ return bar;
29
+ }
30
+
31
+ export function setupRouteProgress(router: Router) {
32
+ if (typeof window === "undefined") return;
33
+
34
+ const bar = ensureBar();
35
+ let trickleTimer: number | null = null;
36
+ let finishTimer: number | null = null;
37
+
38
+ const clearTimers = () => {
39
+ if (trickleTimer !== null) {
40
+ window.clearInterval(trickleTimer);
41
+ trickleTimer = null;
42
+ }
43
+ if (finishTimer !== null) {
44
+ window.clearTimeout(finishTimer);
45
+ finishTimer = null;
46
+ }
47
+ };
48
+
49
+ const start = () => {
50
+ clearTimers();
51
+ bar.style.opacity = "1";
52
+ bar.dataset.progress = "0.18";
53
+ bar.style.transform = "scaleX(0.18)";
54
+
55
+ trickleTimer = window.setInterval(() => {
56
+ const current = Number.parseFloat(bar.dataset.progress || "0.18");
57
+ if (current >= 0.85) return;
58
+ const next = Math.min(current + Math.random() * 0.09, 0.85);
59
+ bar.dataset.progress = String(next);
60
+ bar.style.transform = `scaleX(${next})`;
61
+ }, 180);
62
+ };
63
+
64
+ const done = () => {
65
+ clearTimers();
66
+ bar.dataset.progress = "1";
67
+ bar.style.transform = "scaleX(1)";
68
+ finishTimer = window.setTimeout(() => {
69
+ bar.style.opacity = "0";
70
+ bar.style.transform = "scaleX(0)";
71
+ bar.dataset.progress = "0";
72
+ }, 220);
73
+ };
74
+
75
+ router.beforeEach((to, from) => {
76
+ if (to.path !== from.path) {
77
+ start();
78
+ }
79
+ return true;
80
+ });
81
+
82
+ router.afterEach(() => {
83
+ done();
84
+ });
85
+
86
+ router.onError(() => {
87
+ done();
88
+ });
89
+ }
@@ -1,25 +1,44 @@
1
- import { createRouter, createWebHashHistory } from "vue-router";
2
-
3
- /**
4
- * Router - one route for now, the dashboard at `/`. Route components are
5
- * lazy-imported from the pages folder; add routes here as your app grows:
6
- *
7
- * { path: "/posts", name: "posts", component: () => import("@/ui/pages/posts/index.vue") }
8
- *
9
- * The backend serves the built SPA (`src/ui/dist`) for every path, so SPA
10
- * routes work directly inside the desktop window.
11
- */
12
- export const routes = [
13
- {
14
- path: "/",
15
- name: "dashboard",
16
- component: () => import("@/ui/pages/dashboard/index.vue"),
17
- },
18
- ];
19
-
20
- const router = createRouter({
21
- history: createWebHashHistory(),
22
- routes,
23
- });
24
-
25
- export default router;
1
+ // ./src/ui/src/router/index.ts
2
+
3
+ import { createRouter, createWebHashHistory } from "vue-router";
4
+ import { setupRouteProgress } from "@/ui/plugins/routeProgress";
5
+
6
+ /**
7
+ * Router - one route for now, the dashboard at `/`. Route components are
8
+ * lazy-imported from the pages folder; add routes here as your app grows:
9
+ *
10
+ * { path: "/posts", name: "posts", component: () => import("@/ui/pages/posts/index.vue") }
11
+ *
12
+ * The backend serves the built SPA (`src/ui/dist`) for every path, so SPA
13
+ * routes work directly inside the desktop window.
14
+ */
15
+ export const routes = [
16
+ {
17
+ path: "/",
18
+ name: "dashboard",
19
+ component: () => import("@/ui/pages/dashboard/index.vue")
20
+ }
21
+ ];
22
+
23
+ const router = createRouter({
24
+ history: createWebHashHistory(),
25
+ routes
26
+ });
27
+
28
+ // setupRouteProgress(router);
29
+
30
+ // router.beforeEach(async (to) => {
31
+ // const auth = useAuthStore(); // first make it into pinia store and import from there
32
+
33
+ // if (to.meta.requiresAuth && !auth.isAuthenticated) {
34
+ // return { path: "/login", query: { redirect: to.fullPath } };
35
+ // }
36
+
37
+ // if (to.meta.guestOnly && auth.isAuthenticated) {
38
+ // return { path: "/" };
39
+ // }
40
+
41
+ // return true;
42
+ // });
43
+
44
+ export default router;
@@ -1,3 +1,5 @@
1
+ // ./src/ui/src/stores/example.ts
2
+
1
3
  import axios from "axios";
2
4
  import { defineStore } from "pinia";
3
5
  import { ref } from "vue";
@@ -1,38 +1,40 @@
1
- import path from "node:path";
2
- import { fileURLToPath } from "node:url";
3
- import vue from "@vitejs/plugin-vue";
4
- import { defineConfig } from "vite";
5
-
6
- const rootDir = typeof import.meta.dirname === "string"
7
- ? import.meta.dirname
8
- : path.dirname(fileURLToPath(import.meta.url));
9
-
10
- export default defineConfig({
11
- // Use path.resolve for bulletproof Windows support
12
- root: path.resolve(rootDir, "."),
13
- plugins: [vue()],
14
- base: "./",
15
- define: {
16
- __SOCKET_ENABLED__: JSON.stringify(!!process.env.VITE_SOCKET_URL || !!process.env.VITE_API_URL),
17
- },
18
- resolve: {
19
- alias: {
20
- "@/ui": path.resolve(rootDir, "./src"),
21
- "@": path.resolve(rootDir, "../../src"),
22
- },
23
- },
24
- server: {
25
- port: 5173,
26
- strictPort: true,
27
- fs: {
28
- allow: [path.resolve(rootDir, "../..")],
29
- },
30
- proxy: {
31
- "/__invoke": "http://localhost:8000",
32
- },
33
- },
34
- build: {
35
- outDir: "dist",
36
- emptyOutDir: true,
37
- },
38
- });
1
+ // ./src/ui/vite.config.ts
2
+
3
+ import path from "node:path";
4
+ import { fileURLToPath } from "node:url";
5
+ import vue from "@vitejs/plugin-vue";
6
+ import { defineConfig } from "vite";
7
+
8
+ const rootDir = typeof import.meta.dirname === "string"
9
+ ? import.meta.dirname
10
+ : path.dirname(fileURLToPath(import.meta.url));
11
+
12
+ export default defineConfig({
13
+ // Use path.resolve for bulletproof Windows support
14
+ root: path.resolve(rootDir, "."),
15
+ plugins: [vue()],
16
+ base: "./",
17
+ define: {
18
+ __SOCKET_ENABLED__: JSON.stringify(!!process.env.VITE_SOCKET_URL || !!process.env.VITE_API_URL),
19
+ },
20
+ resolve: {
21
+ alias: {
22
+ "@/ui": path.resolve(rootDir, "./src"),
23
+ "@": path.resolve(rootDir, "../../src"),
24
+ },
25
+ },
26
+ server: {
27
+ port: 5173,
28
+ strictPort: true,
29
+ fs: {
30
+ allow: [path.resolve(rootDir, "../..")],
31
+ },
32
+ proxy: {
33
+ "/__invoke": "http://localhost:8000",
34
+ },
35
+ },
36
+ build: {
37
+ outDir: "dist",
38
+ emptyOutDir: true,
39
+ },
40
+ });