diff --git a/.env b/.env deleted file mode 100644 index baa8378..0000000 --- a/.env +++ /dev/null @@ -1,12 +0,0 @@ -# Default environment file - DO NOT commit sensitive data -# Use environment-specific files instead: -# - .env.local (Local Development) -# - .env.dev (Development Server) -# - .env.test (Test/QA Environment) -# - .env.uat (UAT Environment) -# -# Run with: npm run dev:local | npm run dev:dev | npm run dev:test | npm run dev:uat - -VITE_API_URL=http://localhost:3001/api -VITE_ENV=local -VITE_APP_NAME=AeroResolve diff --git a/.env.example b/.env.example index 7efc5a9..4bb5458 100644 --- a/.env.example +++ b/.env.example @@ -1,5 +1,5 @@ # Example environment configuration # Copy this file to .env.local, .env.dev, .env.test, or .env.uat and update values - VITE_API_URL=http://localhost:3001/api VITE_ENV=local +VITE_APP_NAME=AeroResolve \ No newline at end of file diff --git a/.env.localhost b/.env.localhost new file mode 100644 index 0000000..a70f5dc --- /dev/null +++ b/.env.localhost @@ -0,0 +1,4 @@ +# Local Environment +VITE_API_URL=http://localhost:3001/api +VITE_ENV=local +VITE_APP_NAME=AeroResolve \ No newline at end of file diff --git a/.gitignore b/.gitignore index cc8ed43..a94f22c 100644 --- a/.gitignore +++ b/.gitignore @@ -10,8 +10,6 @@ lerna-debug.log* node_modules dist dist-ssr -*.local - # Editor directories and files .vscode/* diff --git a/README.md b/README.md index 773ca2d..cb9cf0d 100644 --- a/README.md +++ b/README.md @@ -17,14 +17,53 @@ This is the frontend application built with React and Vite. npm install ``` -### Development -Start the local development server: +### Running the Application + +Start the local development server for your desired environment: ```bash +# Development npm run dev + +# Local +npm run local + +# Test +npm run test + +# UAT +npm run uat ``` ### Build for Production -To build the application for production: + +To build the application for a specific environment: ```bash -npm run build +# Development +npm run build:dev + +# Local +npm run build:local + +# Test +npm run build:test + +# UAT +npm run build:uat +``` + +### Preview Built Application + +To preview the production build locally: +```bash +# Development +npm run preview:dev + +# Local +npm run preview:local + +# Test +npm run preview:test + +# UAT +npm run preview:uat ``` diff --git a/package.json b/package.json index 1ce7fce..1c7d32d 100644 --- a/package.json +++ b/package.json @@ -5,16 +5,16 @@ "type": "module", "scripts": { "dev": "vite --mode dev", - "local": "vite --mode local", + "local": "vite --mode localhost", "test": "vite --mode test", "uat": "vite --mode uat", "build:dev": "tsc -b && vite build --mode dev", - "build:local": "tsc -b && vite build --mode local", + "build:local": "tsc -b && vite build --mode localhost", "build:test": "tsc -b && vite build --mode test", "build:uat": "tsc -b && vite build --mode uat", "lint": "eslint .", "preview:dev": "vite preview --mode dev", - "preview:local": "vite preview --mode local", + "preview:local": "vite preview --mode localhost", "preview:test": "vite preview --mode test", "preview:uat": "vite preview --mode uat" }, diff --git a/src/components/custom/CustomInput.tsx b/src/components/custom/CustomInput.tsx index a82bbe6..c8a91bd 100644 --- a/src/components/custom/CustomInput.tsx +++ b/src/components/custom/CustomInput.tsx @@ -3,7 +3,7 @@ import { Phone, Eye, EyeOff } from "lucide-react"; type InputType = "text" | "password" | "number" | "email" | "tel" | "date" | "month" | "datetime-local"; -interface CustomInputProps extends React.InputHTMLAttributes { +interface CustomInputProps extends Omit, "size"> { label?: string; type?: InputType; leftIcon?: React.ReactNode; @@ -53,7 +53,7 @@ const CustomInput = forwardRef( target.value = target.value.slice(0, maxLength); } } - onInput?.(e); + onInput?.(e as any); }; return ( diff --git a/vite.config.ts b/vite.config.ts index baafdc3..8b54b52 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -1,4 +1,4 @@ -import { defineConfig } from 'vite' +import { defineConfig, loadEnv } from 'vite' import react from '@vitejs/plugin-react' import tailwindcss from '@tailwindcss/vite' @@ -6,7 +6,7 @@ import tailwindcss from '@tailwindcss/vite' export default defineConfig(({ mode }) => { // Environment-specific configuration const envConfig = { - local: { + localhost: { port: 5174, strictPort: false, }, @@ -24,7 +24,13 @@ export default defineConfig(({ mode }) => { }, } - const serverConfig = envConfig[mode as keyof typeof envConfig] || envConfig.local + const serverConfig = envConfig[mode as keyof typeof envConfig] || envConfig.localhost + + const env = loadEnv(mode, process.cwd(), '') + console.log(`\n======================================`) + console.log(`🚀 Starting frontend in [${mode}] mode`) + console.log(`🔗 Backend API URL: ${env.VITE_API_URL || 'NOT SET'}`) + console.log(`======================================\n`) return { plugins: [