no log: fix vite configuration linter

This commit is contained in:
Anderson Shindy Oki 2025-04-01 23:22:48 +09:00
parent 74494d2edc
commit d4efdedd4d
2 changed files with 7 additions and 7 deletions

View file

@ -1,7 +1,7 @@
/* eslint-disable no-console */
/// <reference types="node" />
import { readFile } from "fs/promises";
import { readFileSync } from "fs";
import { get } from "lodash";
import { parse } from "yaml";
@ -12,9 +12,9 @@ class ConfigReader {
this.config = {};
}
async open(path: string) {
open(path: string) {
try {
const rawConfig = await readFile(path, "utf8");
const rawConfig = readFileSync(path, "utf8");
this.config = parse(rawConfig);
} catch (err) {
// We don't want to catch the error here, handle it on getValue method
@ -33,7 +33,7 @@ class ConfigReader {
}
}
export default async function overrideEnv(env: Record<string, string>) {
export default function overrideEnv(env: Record<string, string>) {
const configPath = env["VITE_BAZARR_CONFIG_FILE"];
if (configPath === undefined) {
@ -41,7 +41,7 @@ export default async function overrideEnv(env: Record<string, string>) {
}
const reader = new ConfigReader();
await reader.open(configPath);
reader.open(configPath);
if (env["VITE_API_KEY"] === undefined) {
try {

View file

@ -12,11 +12,11 @@ import { VitePWA } from "vite-plugin-pwa";
import chunks from "./config/chunks";
import overrideEnv from "./config/configReader";
export default defineConfig(async ({ mode, command }) => {
export default defineConfig(({ mode, command }) => {
const env = loadEnv(mode, process.cwd());
if (command === "serve") {
await overrideEnv(env);
overrideEnv(env);
}
const target = env.VITE_PROXY_URL;