chore: prepare for migration to OpenAPI

This commit is contained in:
bipproduction
2026-02-07 18:04:37 +08:00
parent d2abd9dafb
commit 6abd32650d
9 changed files with 224 additions and 96 deletions

View File

@@ -5,7 +5,7 @@
export const getEnv = (key: string, defaultValue = ""): string => {
// 1. Try Vite's import.meta.env
try {
if (typeof import.meta.env !== "undefined" && import.meta.env[key]) {
if (import.meta.env?.[key]) {
return import.meta.env[key];
}
} catch {}
@@ -20,11 +20,14 @@ export const getEnv = (key: string, defaultValue = ""): string => {
return defaultValue;
};
export const VITE_PUBLIC_URL = getEnv("VITE_PUBLIC_URL", "http://localhost:3000");
export const VITE_PUBLIC_URL = getEnv(
"VITE_PUBLIC_URL",
"http://localhost:3000",
);
export const IS_DEV = (() => {
try {
return typeof import.meta.env !== "undefined" && import.meta.env.DEV;
return import.meta.env?.DEV;
} catch {
return false;
}

View File

@@ -1,9 +1,9 @@
// open-in-editor.ts
// DEV utility: open source file in local editor
import { spawn } from "child_process";
import fs from "fs";
import path from "path";
import { spawn } from "node:child_process";
import fs from "node:fs";
import path from "node:path";
/* -------------------------------------------------------
* Types