-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathnuxt.config.ts
More file actions
180 lines (175 loc) · 5.26 KB
/
Copy pathnuxt.config.ts
File metadata and controls
180 lines (175 loc) · 5.26 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
// https://nuxt.com/docs/api/configuration/nuxt-config
import { execSync } from "node:child_process";
import tailwindcss from "@tailwindcss/vite";
// Build-time provenance surfaced on the ADMIN/IT-only /dev diagnostics page.
// Falls back to CI-provided env vars, then "unknown", so a git-less prod build
// (e.g. Docker without .git) never breaks the build.
function buildInfo() {
const git = (cmd: string, envKey: string) => {
try {
return execSync(cmd, { stdio: ["ignore", "pipe", "ignore"] })
.toString()
.trim();
} catch {
return process.env[envKey] || "unknown";
}
};
return {
sha: git("git rev-parse --short HEAD", "GIT_SHA"),
branch: git("git rev-parse --abbrev-ref HEAD", "GIT_BRANCH"),
time: new Date().toISOString(),
env: process.env.DEPLOY_ENV || process.env.NODE_ENV || "development",
};
}
export default defineNuxtConfig({
runtimeConfig: {
public: {
// Read on /dev via useRuntimeConfig().public.build.
build: buildInfo(),
},
},
app: {
head: {
// Favicon = the FMUA multi-colour puzzle circle (public/fmua-icon.png,
// cropped from the full logo). .ico for legacy, PNG for modern browsers.
link: [
{ rel: "icon", href: "/favicon.ico", sizes: "any" },
{ rel: "icon", type: "image/png", href: "/fmua-icon.png" },
{ rel: "apple-touch-icon", href: "/fmua-icon.png" },
],
},
},
modules: ["@nuxtjs/i18n", "@nuxt/eslint", "@nuxt/ui"],
i18n: {
locales: [
{ code: "en", iso: "en-US", file: "en.json" },
{ code: "es", iso: "es-ES", file: "es.json" },
],
defaultLocale: "en",
langDir: "locales/",
strategy: "no_prefix",
vueI18n: "./i18n.config.ts",
},
compatibilityDate: "2024-11-01",
devtools: { enabled: false },
css: ["~/assets/css/main.css"],
vite: {
plugins: [tailwindcss()],
},
imports: {
dirs: ["composables/**"],
},
components: [
{
path: "~/components",
pathPrefix: true,
},
],
hooks: {
"pages:extend"(pages) {
// Drop duplicate auto-generated routes that are superseded by the
// explicitly-gated aliases added below. Their page files are still
// reachable via the canonical gated paths (/myChildren, /myProfile,
// /patientProfile, /childProfile); these bare routes were ungated
// (surfaced by /dev) and just duplicated the same pages.
const dropRoutes = new Set([
"parent-children",
"patient-patientProfile-id",
]);
for (let i = pages.length - 1; i >= 0; i--) {
if (dropRoutes.has(pages[i].name || "")) pages.splice(i, 1);
}
// Override auto-generated routes for moved pages to maintain backward compatibility
const routeOverrides: Record<
string,
{ path: string; file: string }
> = {
"dashboard-admin": {
path: "/admin",
file: "~/pages/dashboard/admin.vue",
},
"dashboard-parentDashboard": {
path: "/parentDashboard",
file: "~/pages/dashboard/parentDashboard.vue",
},
"dashboard-patientDashboard": {
path: "/patientDashboard",
file: "~/pages/dashboard/patientDashboard.vue",
},
"dashboard-therapistDashboard": {
path: "/therapistDashboard",
file: "~/pages/dashboard/therapistDashboard.vue",
},
"dashboard-userServiceDashboard": {
path: "/userServiceDashboard",
file: "~/pages/dashboard/userServiceDashboard.vue",
},
"dashboard-iTServiceDashboard": {
path: "/iTServiceDashboard",
file: "~/pages/dashboard/iTServiceDashboard.vue",
},
"dashboard-dashboard": {
path: "/dashboard",
file: "~/pages/dashboard/dashboard.vue",
},
"patient-patientSearch": {
path: "/patientSearch",
file: "~/pages/patient/patientSearch.vue",
},
"patient-contactForm": {
path: "/contactForm",
file: "~/pages/patient/contactForm.vue",
},
"patient-viewContactForms": {
path: "/viewContactForms",
file: "~/pages/patient/viewContactForms.vue",
},
"userService-viewAppointmentRequests": {
path: "/viewAppointmentRequests",
file: "~/pages/userService/viewAppointmentRequests.vue",
},
"userService-assignNeuroSpecialist": {
path: "/assignNeuroSpecialist",
file: "~/pages/userService/assignNeuroSpecialist.vue",
},
// "admin-employeeSearch": {
// path: "/employeeSearch",
// file: "~/pages/admin/employeeSearch.vue",
// },
};
// Update existing routes
pages.forEach((page) => {
const override = routeOverrides[page.name || ""];
if (override) {
page.path = override.path;
page.file = override.file;
}
});
// Add custom patient profile routes
pages.push({
name: "myProfile-id",
path: "/myProfile/:id",
file: "~/pages/patient/patientProfile/[id].vue",
});
// Staff-facing view of any patient's profile (STAFF-gated in
// pageAccessMap). Same page file; the route param id is a User id.
pages.push({
name: "patientProfile-id",
path: "/patientProfile/:id",
file: "~/pages/patient/patientProfile/[id].vue",
});
// Parent-scoped children list + child profile view (#209). Access is
// PARENT in pageAccessMap; server enforces parent-of ownership.
pages.push({
name: "childSearch",
path: "/myChildren",
file: "~/pages/parent/children.vue",
});
pages.push({
name: "childProfile-id",
path: "/childProfile/:id",
file: "~/pages/patient/patientProfile/[id].vue",
});
},
},
});