Merge pull request 'azeem' (#10) from azeem into development
Reviewed-on: https://gitea.maskantech.in/gitea_admin/aeroresolve_frontend/pulls/10 Reviewed-by: Syed Waseem khadri Rafai <waseem.khadri@maskatech.com>
This commit is contained in:
@@ -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
|
||||
+1
-1
@@ -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
|
||||
@@ -0,0 +1,4 @@
|
||||
# Local Environment
|
||||
VITE_API_URL=http://localhost:3001/api
|
||||
VITE_ENV=local
|
||||
VITE_APP_NAME=AeroResolve
|
||||
@@ -10,8 +10,6 @@ lerna-debug.log*
|
||||
node_modules
|
||||
dist
|
||||
dist-ssr
|
||||
*.local
|
||||
|
||||
|
||||
# Editor directories and files
|
||||
.vscode/*
|
||||
|
||||
@@ -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
|
||||
```
|
||||
|
||||
+3
-3
@@ -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"
|
||||
},
|
||||
|
||||
@@ -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<HTMLInputElement> {
|
||||
interface CustomInputProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, "size"> {
|
||||
label?: string;
|
||||
type?: InputType;
|
||||
leftIcon?: React.ReactNode;
|
||||
@@ -53,7 +53,7 @@ const CustomInput = forwardRef<HTMLInputElement, CustomInputProps>(
|
||||
target.value = target.value.slice(0, maxLength);
|
||||
}
|
||||
}
|
||||
onInput?.(e);
|
||||
onInput?.(e as any);
|
||||
};
|
||||
|
||||
return (
|
||||
|
||||
+9
-3
@@ -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: [
|
||||
|
||||
Reference in New Issue
Block a user