mirror of
https://github.com/unraid/api.git
synced 2025-12-31 13:39:52 -06:00
feat: nuxt config simplification and formatting
This commit is contained in:
@@ -1,25 +1,25 @@
|
|||||||
import { readFileSync } from "fs";
|
import { readFileSync } from 'fs';
|
||||||
import { parse } from "dotenv";
|
import { parse } from 'dotenv';
|
||||||
import removeConsole from "vite-plugin-remove-console";
|
import removeConsole from 'vite-plugin-remove-console';
|
||||||
|
|
||||||
const envConfig = parse(readFileSync(".env"));
|
const envConfig = parse(readFileSync('.env'));
|
||||||
console.log("\n");
|
console.log('\n');
|
||||||
console.log("==============================");
|
console.log('==============================');
|
||||||
console.log("========= ENV VALUES =========");
|
console.log('========= ENV VALUES =========');
|
||||||
console.log("==============================");
|
console.log('==============================');
|
||||||
for (const k in envConfig) {
|
for (const k in envConfig) {
|
||||||
process.env[k] = envConfig[k];
|
process.env[k] = envConfig[k];
|
||||||
console.log(`[${k}]`, process.env[k]);
|
console.log(`[${k}]`, process.env[k]);
|
||||||
}
|
}
|
||||||
console.log("==============================");
|
console.log('==============================');
|
||||||
console.log("\n");
|
console.log('\n');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Used to avoid redeclaring variables in the webgui codebase.
|
* Used to avoid redeclaring variables in the webgui codebase.
|
||||||
* @see alt solution https://github.com/terser/terser/issues/1001, https://github.com/terser/terser/pull/1038
|
* @see alt solution https://github.com/terser/terser/issues/1001, https://github.com/terser/terser/pull/1038
|
||||||
*/
|
*/
|
||||||
function terserReservations(inputStr: string) {
|
function terserReservations(inputStr: string) {
|
||||||
const combinations = ["ace"];
|
const combinations = ['ace'];
|
||||||
|
|
||||||
// Add 1-character combinations
|
// Add 1-character combinations
|
||||||
for (let i = 0; i < inputStr.length; i++) {
|
for (let i = 0; i < inputStr.length; i++) {
|
||||||
@@ -36,118 +36,110 @@ function terserReservations(inputStr: string) {
|
|||||||
return combinations;
|
return combinations;
|
||||||
}
|
}
|
||||||
|
|
||||||
const charsToReserve =
|
const charsToReserve = '_$abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789';
|
||||||
"_$abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
|
|
||||||
|
|
||||||
// https://nuxt.com/docs/api/configuration/nuxt-config
|
// https://nuxt.com/docs/api/configuration/nuxt-config
|
||||||
export default defineNuxtConfig({
|
export default defineNuxtConfig({
|
||||||
ssr: false,
|
ssr: false,
|
||||||
|
|
||||||
devServer: {
|
devServer: {
|
||||||
port: 4321,
|
port: 4321,
|
||||||
},
|
},
|
||||||
|
|
||||||
devtools: {
|
devtools: {
|
||||||
enabled: true,
|
enabled: true,
|
||||||
},
|
},
|
||||||
|
|
||||||
modules: [
|
modules: [
|
||||||
"@vueuse/nuxt",
|
'@vueuse/nuxt',
|
||||||
"@pinia/nuxt",
|
'@pinia/nuxt',
|
||||||
"@nuxtjs/tailwindcss",
|
'@nuxtjs/tailwindcss',
|
||||||
"nuxt-custom-elements",
|
'nuxt-custom-elements',
|
||||||
"@nuxt/eslint",
|
'@nuxt/eslint',
|
||||||
"shadcn-nuxt",
|
'shadcn-nuxt',
|
||||||
],
|
],
|
||||||
|
|
||||||
components: [
|
components: [{ path: '~/components/UserProfile', prefix: 'Upc' }, '~/components'],
|
||||||
{ path: "~/components/Brand", prefix: "Brand" },
|
|
||||||
{ path: "~/components/ConnectSettings", prefix: "ConnectSettings" },
|
|
||||||
{ path: "~/components/Ui", prefix: "Ui" },
|
|
||||||
{ path: "~/components/UserProfile", prefix: "Upc" },
|
|
||||||
{ path: "~/components/UpdateOs", prefix: "UpdateOs" },
|
|
||||||
"~/components",
|
|
||||||
],
|
|
||||||
|
|
||||||
// typescript: {
|
// typescript: {
|
||||||
// typeCheck: true
|
// typeCheck: true
|
||||||
// },
|
// },
|
||||||
shadcn: {
|
shadcn: {
|
||||||
prefix: "",
|
prefix: '',
|
||||||
componentDir: "./components/shadcn",
|
componentDir: './components/shadcn',
|
||||||
},
|
},
|
||||||
|
|
||||||
vite: {
|
vite: {
|
||||||
plugins: [
|
plugins: [
|
||||||
!process.env.VITE_ALLOW_CONSOLE_LOGS &&
|
!process.env.VITE_ALLOW_CONSOLE_LOGS &&
|
||||||
removeConsole({
|
removeConsole({
|
||||||
includes: ["log", "warn", "error", "info", "debug"],
|
includes: ['log', 'warn', 'error', 'info', 'debug'],
|
||||||
}),
|
}),
|
||||||
],
|
],
|
||||||
build: {
|
build: {
|
||||||
minify: "terser",
|
minify: 'terser',
|
||||||
terserOptions: {
|
terserOptions: {
|
||||||
mangle: {
|
mangle: {
|
||||||
reserved: terserReservations(charsToReserve),
|
reserved: terserReservations(charsToReserve),
|
||||||
toplevel: true,
|
toplevel: true,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
customElements: {
|
customElements: {
|
||||||
entries: [
|
entries: [
|
||||||
{
|
{
|
||||||
name: "UnraidComponents",
|
name: 'UnraidComponents',
|
||||||
tags: [
|
tags: [
|
||||||
{
|
{
|
||||||
name: "UnraidI18nHost",
|
name: 'UnraidI18nHost',
|
||||||
path: "@/components/I18nHost.ce",
|
path: '@/components/I18nHost.ce',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "UnraidAuth",
|
name: 'UnraidAuth',
|
||||||
path: "@/components/Auth.ce",
|
path: '@/components/Auth.ce',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "UnraidConnectSettings",
|
name: 'UnraidConnectSettings',
|
||||||
path: "@/components/ConnectSettings/ConnectSettings.ce",
|
path: '@/components/ConnectSettings/ConnectSettings.ce',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "UnraidDownloadApiLogs",
|
name: 'UnraidDownloadApiLogs',
|
||||||
path: "@/components/DownloadApiLogs.ce",
|
path: '@/components/DownloadApiLogs.ce',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "UnraidHeaderOsVersion",
|
name: 'UnraidHeaderOsVersion',
|
||||||
path: "@/components/HeaderOsVersion.ce",
|
path: '@/components/HeaderOsVersion.ce',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "UnraidModals",
|
name: 'UnraidModals',
|
||||||
path: "@/components/Modals.ce",
|
path: '@/components/Modals.ce',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "UnraidUserProfile",
|
name: 'UnraidUserProfile',
|
||||||
path: "@/components/UserProfile.ce",
|
path: '@/components/UserProfile.ce',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "UnraidUpdateOs",
|
name: 'UnraidUpdateOs',
|
||||||
path: "@/components/UpdateOs.ce",
|
path: '@/components/UpdateOs.ce',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "UnraidDowngradeOs",
|
name: 'UnraidDowngradeOs',
|
||||||
path: "@/components/DowngradeOs.ce",
|
path: '@/components/DowngradeOs.ce',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "UnraidRegistration",
|
name: 'UnraidRegistration',
|
||||||
path: "@/components/Registration.ce",
|
path: '@/components/Registration.ce',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "UnraidWanIpCheck",
|
name: 'UnraidWanIpCheck',
|
||||||
path: "@/components/WanIpCheck.ce",
|
path: '@/components/WanIpCheck.ce',
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
|
|
||||||
compatibilityDate: "2024-12-05"
|
compatibilityDate: '2024-12-05',
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user