Skip to content
Open

Free #76

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
c0de6c1
Update pnpm lockfile to latest package versions
cursoragent Aug 28, 2025
1f562af
chore(pages): add Cloudflare Pages redirects and headers for SPA
cursoragent Aug 28, 2025
790946a
chore(pages): correct wrangler keys (pages_build_output_dir, build_co…
cursoragent Aug 28, 2025
1c50ccf
chore(pages): remove unsupported build_command from wrangler.toml
cursoragent Aug 28, 2025
46815fe
ci(pages): add GitHub Actions workflow to build and deploy to Cloudfl…
cursoragent Aug 28, 2025
6b955d0
Add AI provider selection and dynamic model fetching
cursoragent Aug 28, 2025
b3e1ced
Add AI provider and model selection dropdowns to ChatInput
cursoragent Aug 28, 2025
e4232b4
Fetch and update models dynamically when changing AI provider
cursoragent Aug 28, 2025
45810ca
feat(ai): add robust error handling for provider/model selection (UI …
cursoragent Aug 28, 2025
7b7304f
chore(ts): enable skipLibCheck and fix local TS types in MCP and WeAP…
cursoragent Aug 28, 2025
0449b8b
feat(diff,models): restore Diff with real implementation; improve Dee…
cursoragent Aug 28, 2025
7081b1e
feat(ai): add more providers (Mistral/Cohere/Perplexity/Together/HF/F…
cursoragent Aug 28, 2025
5cdb26d
feat(ui): simplify chat UI with single combined provider·model dropdo…
cursoragent Aug 28, 2025
5adf124
feat(docs): add provider API docs links in settings and chat
cursoragent Aug 28, 2025
47aa2e2
chore(models): remove fallback lists to avoid mock data (DeepSeek)
cursoragent Aug 28, 2025
152f675
style(ui): subtle polish for scrollbars, focus, and chat model dropdo…
cursoragent Aug 28, 2025
35bbffe
feat(ui): move models list to sidebar bottom and add Save for API set…
cursoragent Aug 28, 2025
1d9a007
Fix API key refresh and model selection in chat and settings
cursoragent Aug 28, 2025
8a7e8ed
feat(api): add Cloudflare Pages function for provider model listing a…
cursoragent Aug 28, 2025
1f93ca2
feat(build): robust in-app build with multi-PM fallback, output detec…
cursoragent Aug 28, 2025
14956df
Update pnpm lockfile to version 9.0 and resolve dependencies
cursoragent Aug 28, 2025
f24644b
Merge remote-tracking branch 'upstream/main' into cursor/fixing-code-…
cursoragent Aug 28, 2025
d11a5bb
feat: add PWA support with installable app functionality
cursoragent Aug 28, 2025
e53d845
Merge pull request #2 from ai-hub-2/cursor/fixing-code-errors-b928
you112ef Aug 28, 2025
8ed3f45
Add Cloudflare Pages deployment support and web app metadata
cursoragent Aug 29, 2025
1bed180
Checkpoint before follow-up message
cursoragent Aug 29, 2025
98e818f
Optimize Cloudflare Pages deployment with advanced routing config
cursoragent Aug 29, 2025
c9787c3
Simplify web app structure and remove complex features for initial ve…
cursoragent Aug 29, 2025
df980e2
Implement web landing page with dark mode and multi-tab navigation
cursoragent Aug 30, 2025
2d33f6c
Refactor web app for limited web version with new UI and features
cursoragent Aug 30, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 47 additions & 0 deletions .github/workflows/cloudflare-pages.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: Deploy to Cloudflare Pages

on:
push:
branches:
- main
workflow_dispatch:

concurrency:
group: cf-pages-${{ github.ref }}
cancel-in-progress: true

jobs:
build-and-deploy:
runs-on: ubuntu-latest
defaults:
run:
working-directory: apps/we-dev-client

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup Node.js 20
uses: actions/setup-node@v4
with:
node-version: 20

- name: Enable corepack and pnpm
run: |
corepack enable
corepack prepare [email protected] --activate

- name: Install dependencies (skip scripts)
run: pnpm install --ignore-scripts --frozen-lockfile=false

- name: Build
run: pnpm run builds

- name: Upload to Cloudflare Pages
uses: cloudflare/pages-action@v1
with:
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
projectName: we-dev-pages
directory: apps/we-dev-client/dist
gitHubToken: ${{ secrets.GITHUB_TOKEN }}
40 changes: 40 additions & 0 deletions .github/workflows/deploy-cloudflare-pages.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Deploy to Cloudflare Pages

on:
push:
branches: [ main, master ]
pull_request:
branches: [ main, master ]

jobs:
build-and-deploy:
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '18'

- name: Setup pnpm
uses: pnpm/action-setup@v2
with:
version: 8

- name: Install dependencies
run: pnpm install

- name: Build for Cloudflare Pages
run: pnpm run build:pages

- name: Deploy to Cloudflare Pages
uses: cloudflare/pages-action@v1
with:
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
projectName: we-dev-pages
directory: apps/we-dev-client/dist
gitHubToken: ${{ secrets.GITHUB_TOKEN }}
163 changes: 163 additions & 0 deletions CLOUDFLARE_PAGES_DEPLOYMENT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,163 @@
# Cloudflare Pages Deployment Guide

This guide explains how to deploy the We Dev application to Cloudflare Pages.

## Prerequisites

- Node.js 18+ and pnpm installed
- Cloudflare account with Pages enabled
- Git repository connected to Cloudflare Pages

## Quick Deployment

### 1. Build the Application

```bash
# From the root directory
pnpm run build:pages
```

This command will:
- Build the React application using Vite
- Copy Cloudflare Pages configuration files
- Generate the `dist/` directory ready for deployment

### 2. Deploy to Cloudflare Pages

#### Option A: Using Wrangler CLI

```bash
# Install Wrangler if not already installed
npm install -g wrangler

# Login to Cloudflare
wrangler login

# Deploy to Pages
wrangler pages deploy apps/we-dev-client/dist --project-name=we-dev-pages
```

#### Option B: Using Cloudflare Dashboard

1. Go to [Cloudflare Dashboard](https://dash.cloudflare.com/)
2. Navigate to Pages
3. Create a new project or connect to existing Git repository
4. Set build settings:
- **Build command**: `pnpm run build:pages`
- **Build output directory**: `apps/we-dev-client/dist`
- **Root directory**: `/` (root of repository)

## Configuration Files

### `wrangler.toml`
```toml
name = "we-dev-pages"
pages_build_output_dir = "apps/we-dev-client/dist"
```

**Note:** Cloudflare Pages doesn't support the `[build]` section in `wrangler.toml`. Build commands should be configured in the Cloudflare Dashboard or GitHub Actions.

### `_redirects`
Handles SPA routing by redirecting all routes to `index.html`:
```
/* /index.html 200
```

### `_headers`
Sets security headers for the application:
```
/*
X-Frame-Options: DENY
X-Content-Type-Options: nosniff
Referrer-Policy: strict-origin-when-cross-origin
Permissions-Policy: camera=(), microphone=(), geolocation=()
```

### `_routes.json`
Provides advanced routing configuration for Cloudflare Pages:
```json
{
"version": 1,
"include": ["/*"],
"exclude": [
"/assets/*",
"/manifest.webmanifest",
"/sw.js",
"/workbox-*.js",
"/icon-*.svg"
],
"routes": [
{
"src": "/*",
"dest": "/index.html"
}
]
}
```

### `_worker.js`
Custom worker script for additional routing logic and SPA support.

## Build Process

The build process includes:

1. **Vite Build**: Compiles React application with optimizations for web deployment
2. **PWA Generation**: Creates service worker and manifest files
3. **Configuration Copy**: Copies all Cloudflare Pages configuration files
4. **Worker Generation**: Creates `_worker.js` for advanced routing logic
5. **Web Compatibility**: Ensures no Node.js/Electron dependencies in web build

## Troubleshooting

### Common Issues

1. **Build Failures**: Ensure all dependencies are installed with `pnpm install`
2. **Routing Issues**: Verify `_redirects` file is properly copied to `dist/`
3. **Asset Loading**: Check that `base` in Vite config is set to `/`

### Build Commands

```bash
# Clean build
rm -rf apps/we-dev-client/dist
pnpm run build:pages

# Development build
cd apps/we-dev-client && pnpm dev

# Production build only
cd apps/we-dev-client && pnpm build:web
```

## Environment Variables

If you need to set environment variables for Cloudflare Pages:

1. Go to your Pages project settings
2. Navigate to Environment variables
3. Add any required variables (e.g., API keys)

## Web Compatibility

The application has been modified for web deployment:

- **Conditional Imports**: Uses web-compatible components when building for web
- **Node.js Polyfills**: Replaces Node.js specific code with web-compatible alternatives
- **Electron Removal**: Excludes Electron-specific code from web builds
- **Mock Implementations**: Provides mock implementations for desktop-only features

## Performance Optimization

The build includes:
- Code splitting and lazy loading
- PWA capabilities with service worker
- Optimized assets with compression
- Security headers for better protection

## Support

For issues with Cloudflare Pages deployment, check:
- [Cloudflare Pages Documentation](https://developers.cloudflare.com/pages/)
- [Wrangler CLI Documentation](https://developers.cloudflare.com/workers/wrangler/)
- Build logs in Cloudflare Dashboard
34 changes: 27 additions & 7 deletions apps/we-dev-client/global.css
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,24 @@
}
@tailwind components;
@tailwind utilities;
/* Improved, unobtrusive scrollbars */
* {
/* Firefox */
scrollbar-width: none;
/* IE 10+ */
-ms-overflow-style: none;
scrollbar-width: thin; /* Firefox */
-ms-overflow-style: auto; /* IE 10+ */
}

/* Webkit (Chrome, Safari, Edge) */
*::-webkit-scrollbar {
display: none;
width: 8px;
height: 8px;
}
*::-webkit-scrollbar-track {
background: transparent;
}
*::-webkit-scrollbar-thumb {
background-color: rgba(100, 116, 139, 0.4);
border-radius: 999px;
}
.dark *::-webkit-scrollbar-thumb {
background-color: rgba(148, 163, 184, 0.35);
}
.ant-modal {
top: unset;
Expand Down Expand Up @@ -90,5 +98,17 @@
}
body {
@apply bg-background text-foreground;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
::selection {
background: hsl(var(--primary) / 0.15);
}
input, select, textarea, button {
@apply outline-none transition-colors duration-200 ease-out;
}
input:focus, select:focus, textarea:focus {
box-shadow: 0 0 0 3px hsl(var(--primary) / 0.2);
border-color: hsl(var(--primary));
}
}
21 changes: 8 additions & 13 deletions apps/we-dev-client/index.html
Original file line number Diff line number Diff line change
@@ -1,22 +1,17 @@
<!DOCTYPE html>
<html lang="en">

<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>We0</title>
<meta name="author" content="We0">
<meta name="robots" content="index,follow">
<meta name="googlebot" content="index,follow">
<meta name="bingbot" content="index,follow">
<meta name="alexa" content="index,follow">
<meta name="sitemap" content="index,follow">
<meta property="og:type" content="website">
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>We Dev</title>
<meta name="description" content="We Dev - AI-powered code generation and development tool">
<meta name="theme-color" content="#7c3aed">
<link rel="icon" type="image/svg+xml" href="/icon-192x192.svg">
<link rel="apple-touch-icon" href="/icon-192x192.svg">
<link rel="manifest" href="/manifest.webmanifest">
</head>

<body>
<div id="root"></div>
<script type="module" src="/src/main.tsx"></script>
</body>

</html>
6 changes: 5 additions & 1 deletion apps/we-dev-client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,12 @@
"scripts": {
"dev": "vite",
"build": "cross-env ELECTRON=true vite build && electron-builder --mac --config electron-builder.json",
"build:web": "cross-env ELECTRON=false vite build",
"build:pages": "./scripts/build-pages.sh",
"tsc": "tsc",
"electron:dev": "vite",
"builds": "vite build",
"build:cloudflare": "vite build",
"postinstall": "electron-rebuild -f -w node-pty --arch=x64 && vite build && electron-builder install-app-deps"
},
"main": "dist-electron/main.js",
Expand Down Expand Up @@ -114,7 +117,8 @@
"vite": "^5.0.8",
"vite-plugin-dynamic-import": "^1.6.0",
"vite-plugin-electron": "^0.15.5",
"vite-plugin-glsl": "^1.3.1"
"vite-plugin-glsl": "^1.3.1",
"vite-plugin-pwa": "^1.0.3"
},
"build": {
"appId": "com.we0.app",
Expand Down
Loading