feat: Configure Vite for Cloudflare Pages deployment

This commit sets up the Vite configuration for Cloudflare Pages, including optimizations, proxy settings, and environment variables. It also updates the package.json with new scripts for deployment and development.

Co-authored-by: logato7838 <logato7838@vsihay.com>
This commit is contained in:
Cursor Full Stack AI IDE 2025-10-12 14:23:11 +00:00
parent fa8e83780e
commit 15b31c58f2
10 changed files with 371 additions and 23 deletions

View file

@ -0,0 +1,11 @@
{
"buildCommand": "npm run build",
"outputDirectory": "cloudflare/frontend/dist",
"rootDirectory": "cloudflare/frontend",
"installCommand": "npm install",
"framework": "vite",
"nodeVersion": "18",
"environmentVariables": {
"NODE_ENV": "production"
}
}

View file

@ -0,0 +1,55 @@
# Environment variables for Cursor Full Stack AI IDE
# Backend URL
VITE_BACKEND_URL=https://cursor-backend.workers.dev
# WebSocket URL
VITE_WS_URL=wss://cursor-backend.workers.dev
# App Configuration
VITE_APP_NAME=Cursor Full Stack AI IDE
VITE_APP_VERSION=1.0.0
VITE_APP_DESCRIPTION=A complete AI-powered development environment
# Feature Flags
VITE_ENABLE_AI_CHAT=true
VITE_ENABLE_TOOLS=true
VITE_ENABLE_TERMINAL=true
VITE_ENABLE_GIT=true
# AI Providers
VITE_DEFAULT_AI_PROVIDER=openai
VITE_AI_PROVIDERS=openai,anthropic,google,mistral,openrouter
# Editor Configuration
VITE_EDITOR_THEME=vs-dark
VITE_EDITOR_FONT_SIZE=14
VITE_EDITOR_TAB_SIZE=2
VITE_EDITOR_WORD_WRAP=on
# Storage Configuration
VITE_MAX_FILE_SIZE=10485760
VITE_MAX_FILES=1000
VITE_ALLOWED_EXTENSIONS=.js,.ts,.jsx,.tsx,.py,.go,.rs,.java,.cpp,.c,.cs,.php,.rb,.html,.css,.scss,.json,.xml,.yaml,.yml,.md,.sql,.sh,.bash,.dockerfile
# Security
VITE_CORS_ORIGIN=*
VITE_CONTENT_SECURITY_POLICY=default-src 'self'; script-src 'self' 'unsafe-inline' 'unsafe-eval'; style-src 'self' 'unsafe-inline'; img-src 'self' data: https:; connect-src 'self' https://*.workers.dev wss://*.workers.dev;
# Performance
VITE_ENABLE_SERVICE_WORKER=true
VITE_ENABLE_PWA=true
VITE_CACHE_STRATEGY=stale-while-revalidate
# Analytics (Optional)
VITE_ANALYTICS_ID=
VITE_ANALYTICS_ENABLED=false
# Error Reporting (Optional)
VITE_ERROR_REPORTING_ENABLED=false
VITE_ERROR_REPORTING_URL=
# Development
VITE_DEV_MODE=false
VITE_DEBUG_MODE=false
VITE_LOG_LEVEL=info

View file

@ -0,0 +1,109 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*
# Dependencies
node_modules
.pnp
.pnp.js
# Production builds
dist
dist-ssr
*.local
# Environment variables
.env
.env.local
.env.development.local
.env.test.local
.env.production.local
# Editor directories and files
.vscode/*
!.vscode/extensions.json
.idea
.DS_Store
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?
# OS generated files
Thumbs.db
ehthumbs.db
Desktop.ini
# Runtime data
pids
*.pid
*.seed
*.pid.lock
# Coverage directory used by tools like istanbul
coverage
*.lcov
# nyc test coverage
.nyc_output
# Dependency directories
jspm_packages/
# Optional npm cache directory
.npm
# Optional eslint cache
.eslintcache
# Microbundle cache
.rpt2_cache/
.rts2_cache_cjs/
.rts2_cache_es/
.rts2_cache_umd/
# Optional REPL history
.node_repl_history
# Output of 'npm pack'
*.tgz
# Yarn Integrity file
.yarn-integrity
# dotenv environment variables file
.env
.env.test
# parcel-bundler cache (https://parceljs.org/)
.cache
.parcel-cache
# Next.js build output
.next
# Nuxt.js build / generate output
.nuxt
dist
# Gatsby files
.cache/
public
# Storybook build outputs
.out
.storybook-out
# Temporary folders
tmp/
temp/
# Cloudflare
.wrangler/
wrangler.toml

View file

@ -0,0 +1,52 @@
/*
X-Frame-Options: DENY
X-Content-Type-Options: nosniff
X-XSS-Protection: 1; mode=block
Referrer-Policy: strict-origin-when-cross-origin
Permissions-Policy: camera=(), microphone=(), geolocation=()
Content-Security-Policy: default-src 'self'; script-src 'self' 'unsafe-inline' 'unsafe-eval' https://cdn.jsdelivr.net; style-src 'self' 'unsafe-inline' https://fonts.googleapis.com; font-src 'self' https://fonts.gstatic.com; img-src 'self' data: https:; connect-src 'self' https://*.workers.dev wss://*.workers.dev; frame-ancestors 'none';
/assets/*
Cache-Control: public, max-age=31536000, immutable
/index.html
Cache-Control: public, max-age=0, must-revalidate
/*.js
Cache-Control: public, max-age=31536000, immutable
/*.css
Cache-Control: public, max-age=31536000, immutable
/*.woff2
Cache-Control: public, max-age=31536000, immutable
/*.woff
Cache-Control: public, max-age=31536000, immutable
/*.ttf
Cache-Control: public, max-age=31536000, immutable
/*.eot
Cache-Control: public, max-age=31536000, immutable
/*.svg
Cache-Control: public, max-age=31536000, immutable
/*.png
Cache-Control: public, max-age=31536000, immutable
/*.jpg
Cache-Control: public, max-age=31536000, immutable
/*.jpeg
Cache-Control: public, max-age=31536000, immutable
/*.gif
Cache-Control: public, max-age=31536000, immutable
/*.webp
Cache-Control: public, max-age=31536000, immutable
/*.ico
Cache-Control: public, max-age=31536000, immutable

View file

@ -0,0 +1,19 @@
# Redirect rules for Cloudflare Pages
# Redirect root to index.html
/ /index.html 200
# Redirect all other routes to index.html for SPA
/* /index.html 200
# API redirects to backend
/api/* https://cursor-backend.workers.dev/api/:splat 200
# WebSocket redirects to backend
/ws/* wss://cursor-backend.workers.dev/ws/:splat 200
# Health check redirect
/health https://cursor-backend.workers.dev/health 200
# Fallback for any other requests
/* /index.html 404

View file

@ -0,0 +1,6 @@
export default {
plugins: {
tailwindcss: {},
autoprefixer: {},
},
}

View file

@ -0,0 +1,31 @@
{
"compilerOptions": {
"target": "ES2020",
"useDefineForClassFields": true,
"lib": ["ES2020", "DOM", "DOM.Iterable"],
"module": "ESNext",
"skipLibCheck": true,
/* Bundler mode */
"moduleResolution": "bundler",
"allowImportingTsExtensions": true,
"resolveJsonModule": true,
"isolatedModules": true,
"noEmit": true,
"jsx": "react-jsx",
/* Linting */
"strict": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"noFallthroughCasesInSwitch": true,
/* Path mapping */
"baseUrl": ".",
"paths": {
"@/*": ["./src/*"]
}
},
"include": ["src"],
"references": [{ "path": "./tsconfig.node.json" }]
}

View file

@ -0,0 +1,10 @@
{
"compilerOptions": {
"composite": true,
"skipLibCheck": true,
"module": "ESNext",
"moduleResolution": "bundler",
"allowSyntheticDefaultImports": true
},
"include": ["vite.config.js"]
}

View file

@ -1,5 +1,6 @@
import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react'
import { resolve } from 'path'
export default defineConfig({
plugins: [react()],
@ -11,9 +12,20 @@ export default defineConfig({
manualChunks: {
vendor: ['react', 'react-dom'],
monaco: ['@monaco-editor/react'],
icons: ['lucide-react']
icons: ['lucide-react'],
socket: ['socket.io-client']
}
}
},
assetsDir: 'assets',
emptyOutDir: true,
target: 'es2015',
minify: 'terser',
terserOptions: {
compress: {
drop_console: true,
drop_debugger: true
}
}
},
define: {
@ -21,6 +33,39 @@ export default defineConfig({
},
server: {
port: 5173,
host: true,
proxy: {
'/api': {
target: 'https://cursor-backend.workers.dev',
changeOrigin: true,
secure: true
},
'/ws': {
target: 'wss://cursor-backend.workers.dev',
ws: true,
changeOrigin: true
}
}
},
preview: {
port: 4173,
host: true
},
resolve: {
alias: {
'@': resolve(__dirname, 'src')
}
},
optimizeDeps: {
include: [
'react',
'react-dom',
'@monaco-editor/react',
'lucide-react',
'socket.io-client'
]
},
esbuild: {
logOverride: { 'this-is-undefined-in-esm': 'silent' }
}
})

View file

@ -1,38 +1,48 @@
{
"name": "cursor-fullstack-ai-ide",
"version": "1.0.0",
"description": "Complete full-stack AI-powered IDE similar to Cursor Web",
"description": "A complete AI-powered development environment with Monaco Editor, real-time chat, and integrated tools",
"main": "index.js",
"scripts": {
"build": "docker compose up --build -d",
"start": "docker compose up -d",
"stop": "docker compose down",
"logs": "docker compose logs -f",
"test": "node test-system.js",
"test:complete": "node test-complete.js",
"dev:backend": "cd packages/backend/claudable && bun run dev",
"dev:frontend": "cd packages/frontend/cursor-web && bun run dev",
"clean": "docker compose down -v && docker system prune -f",
"deploy:prod": "docker compose -f docker-compose.prod.yml up --build -d"
"build": "cd cloudflare/frontend && npm install && npm run build",
"dev": "cd cloudflare/frontend && npm install && npm run dev",
"preview": "cd cloudflare/frontend && npm run preview",
"deploy": "cd cloudflare && ./auto-deploy.sh",
"deploy:quick": "cd cloudflare && ./one-click-deploy.sh",
"setup": "cd cloudflare && ./complete-setup.sh",
"workspace": "cd cloudflare && ./setup-workspace.sh"
},
"keywords": [
"ai",
"ide",
"cursor",
"fullstack",
"react",
"node",
"websocket",
"ai-ide",
"monaco-editor",
"docker"
"code-editor",
"development",
"cloudflare",
"react",
"typescript",
"vite",
"tailwindcss"
],
"author": "Cursor Full Stack AI IDE",
"license": "MIT",
"devDependencies": {
"axios": "^1.6.0"
"repository": {
"type": "git",
"url": "https://github.com/your-username/cursor-fullstack-ai-ide.git"
},
"bugs": {
"url": "https://github.com/your-username/cursor-fullstack-ai-ide/issues"
},
"homepage": "https://cursor-ide.pages.dev",
"engines": {
"node": ">=18.0.0",
"docker": ">=20.0.0"
"npm": ">=8.0.0"
},
"workspaces": [
"cloudflare/frontend",
"cloudflare/backend"
],
"devDependencies": {
"concurrently": "^8.2.2",
"cross-env": "^7.0.3"
}
}