Skip to content

Commit 02ffde2

Browse files
committed
feat: nuxt config simplification and formatting
1 parent 848233f commit 02ffde2

File tree

1 file changed

+107
-115
lines changed

1 file changed

+107
-115
lines changed

web/nuxt.config.ts

Lines changed: 107 additions & 115 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,25 @@
1-
import { readFileSync } from "fs";
2-
import { parse } from "dotenv";
3-
import removeConsole from "vite-plugin-remove-console";
1+
import { readFileSync } from 'fs';
2+
import { parse } from 'dotenv';
3+
import removeConsole from 'vite-plugin-remove-console';
44

5-
const envConfig = parse(readFileSync(".env"));
6-
console.log("\n");
7-
console.log("==============================");
8-
console.log("========= ENV VALUES =========");
9-
console.log("==============================");
5+
const envConfig = parse(readFileSync('.env'));
6+
console.log('\n');
7+
console.log('==============================');
8+
console.log('========= ENV VALUES =========');
9+
console.log('==============================');
1010
for (const k in envConfig) {
1111
process.env[k] = envConfig[k];
1212
console.log(`[${k}]`, process.env[k]);
1313
}
14-
console.log("==============================");
15-
console.log("\n");
14+
console.log('==============================');
15+
console.log('\n');
1616

1717
/**
1818
* Used to avoid redeclaring variables in the webgui codebase.
1919
* @see alt solution https://github.com/terser/terser/issues/1001, https://github.com/terser/terser/pull/1038
2020
*/
2121
function terserReservations(inputStr: string) {
22-
const combinations = ["ace"];
22+
const combinations = ['ace'];
2323

2424
// Add 1-character combinations
2525
for (let i = 0; i < inputStr.length; i++) {
@@ -36,118 +36,110 @@ function terserReservations(inputStr: string) {
3636
return combinations;
3737
}
3838

39-
const charsToReserve =
40-
"_$abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
39+
const charsToReserve = '_$abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789';
4140

4241
// https://nuxt.com/docs/api/configuration/nuxt-config
4342
export default defineNuxtConfig({
44-
ssr: false,
43+
ssr: false,
4544

46-
devServer: {
47-
port: 4321,
48-
},
45+
devServer: {
46+
port: 4321,
47+
},
4948

50-
devtools: {
51-
enabled: true,
52-
},
49+
devtools: {
50+
enabled: true,
51+
},
5352

54-
modules: [
55-
"@vueuse/nuxt",
56-
"@pinia/nuxt",
57-
"@nuxtjs/tailwindcss",
58-
"nuxt-custom-elements",
59-
"@nuxt/eslint",
60-
"shadcn-nuxt",
61-
],
53+
modules: [
54+
'@vueuse/nuxt',
55+
'@pinia/nuxt',
56+
'@nuxtjs/tailwindcss',
57+
'nuxt-custom-elements',
58+
'@nuxt/eslint',
59+
'shadcn-nuxt',
60+
],
6261

63-
components: [
64-
{ path: "~/components/Brand", prefix: "Brand" },
65-
{ path: "~/components/ConnectSettings", prefix: "ConnectSettings" },
66-
{ path: "~/components/Ui", prefix: "Ui" },
67-
{ path: "~/components/UserProfile", prefix: "Upc" },
68-
{ path: "~/components/UpdateOs", prefix: "UpdateOs" },
69-
"~/components",
70-
],
62+
components: [{ path: '~/components/UserProfile', prefix: 'Upc' }, '~/components'],
7163

72-
// typescript: {
73-
// typeCheck: true
74-
// },
75-
shadcn: {
76-
prefix: "",
77-
componentDir: "./components/shadcn",
78-
},
64+
// typescript: {
65+
// typeCheck: true
66+
// },
67+
shadcn: {
68+
prefix: '',
69+
componentDir: './components/shadcn',
70+
},
7971

80-
vite: {
81-
plugins: [
82-
!process.env.VITE_ALLOW_CONSOLE_LOGS &&
83-
removeConsole({
84-
includes: ["log", "warn", "error", "info", "debug"],
85-
}),
86-
],
87-
build: {
88-
minify: "terser",
89-
terserOptions: {
90-
mangle: {
91-
reserved: terserReservations(charsToReserve),
92-
toplevel: true,
93-
},
94-
},
95-
},
96-
},
72+
vite: {
73+
plugins: [
74+
!process.env.VITE_ALLOW_CONSOLE_LOGS &&
75+
removeConsole({
76+
includes: ['log', 'warn', 'error', 'info', 'debug'],
77+
}),
78+
],
79+
build: {
80+
minify: 'terser',
81+
terserOptions: {
82+
mangle: {
83+
reserved: terserReservations(charsToReserve),
84+
toplevel: true,
85+
},
86+
},
87+
},
88+
},
9789

98-
customElements: {
99-
entries: [
100-
{
101-
name: "UnraidComponents",
102-
tags: [
103-
{
104-
name: "UnraidI18nHost",
105-
path: "@/components/I18nHost.ce",
106-
},
107-
{
108-
name: "UnraidAuth",
109-
path: "@/components/Auth.ce",
110-
},
111-
{
112-
name: "UnraidConnectSettings",
113-
path: "@/components/ConnectSettings/ConnectSettings.ce",
114-
},
115-
{
116-
name: "UnraidDownloadApiLogs",
117-
path: "@/components/DownloadApiLogs.ce",
118-
},
119-
{
120-
name: "UnraidHeaderOsVersion",
121-
path: "@/components/HeaderOsVersion.ce",
122-
},
123-
{
124-
name: "UnraidModals",
125-
path: "@/components/Modals.ce",
126-
},
127-
{
128-
name: "UnraidUserProfile",
129-
path: "@/components/UserProfile.ce",
130-
},
131-
{
132-
name: "UnraidUpdateOs",
133-
path: "@/components/UpdateOs.ce",
134-
},
135-
{
136-
name: "UnraidDowngradeOs",
137-
path: "@/components/DowngradeOs.ce",
138-
},
139-
{
140-
name: "UnraidRegistration",
141-
path: "@/components/Registration.ce",
142-
},
143-
{
144-
name: "UnraidWanIpCheck",
145-
path: "@/components/WanIpCheck.ce",
146-
},
147-
],
148-
},
149-
],
150-
},
90+
customElements: {
91+
entries: [
92+
{
93+
name: 'UnraidComponents',
94+
tags: [
95+
{
96+
name: 'UnraidI18nHost',
97+
path: '@/components/I18nHost.ce',
98+
},
99+
{
100+
name: 'UnraidAuth',
101+
path: '@/components/Auth.ce',
102+
},
103+
{
104+
name: 'UnraidConnectSettings',
105+
path: '@/components/ConnectSettings/ConnectSettings.ce',
106+
},
107+
{
108+
name: 'UnraidDownloadApiLogs',
109+
path: '@/components/DownloadApiLogs.ce',
110+
},
111+
{
112+
name: 'UnraidHeaderOsVersion',
113+
path: '@/components/HeaderOsVersion.ce',
114+
},
115+
{
116+
name: 'UnraidModals',
117+
path: '@/components/Modals.ce',
118+
},
119+
{
120+
name: 'UnraidUserProfile',
121+
path: '@/components/UserProfile.ce',
122+
},
123+
{
124+
name: 'UnraidUpdateOs',
125+
path: '@/components/UpdateOs.ce',
126+
},
127+
{
128+
name: 'UnraidDowngradeOs',
129+
path: '@/components/DowngradeOs.ce',
130+
},
131+
{
132+
name: 'UnraidRegistration',
133+
path: '@/components/Registration.ce',
134+
},
135+
{
136+
name: 'UnraidWanIpCheck',
137+
path: '@/components/WanIpCheck.ce',
138+
},
139+
],
140+
},
141+
],
142+
},
151143

152-
compatibilityDate: "2024-12-05"
153-
});
144+
compatibilityDate: '2024-12-05',
145+
});

0 commit comments

Comments
 (0)