feat(functions): implement Edge Function management system#20
feat(functions): implement Edge Function management system#20weroperking merged 1 commit intomainfrom
Conversation
- Add CLI commands: create, dev, build, list, logs, deploy - Implement Bun-based bundling for Cloudflare Workers and Vercel Edge - Add environment variable synchronization - Fix critical Vercel deployment bug (bundle path not passed) - Fix secret values being logged to console - Fix incorrect fallback URL in Cloudflare deployment
|
Caution Review failedThe pull request is closed. 📝 WalkthroughWalkthroughThis PR introduces a complete edge function workflow for the CLI and supporting core utilities. It adds CLI commands to create, develop, build, list, query logs, and deploy serverless functions with support for Cloudflare Workers and Vercel Edge Runtime, including environment variable synchronization and hot-reload development capabilities. Changes
Sequence DiagramsequenceDiagram
participant User as User
participant CLI as CLI
participant Bundler as Bundler
participant Deployer as Deployer
participant Wrangler as Wrangler
participant Vercel as Vercel
participant Env as Env Sync
User->>CLI: runFunctionCommand('deploy', name)
activate CLI
CLI->>Bundler: bundleFunction(name)
activate Bundler
Bundler->>Bundler: read config.ts
Bundler->>Bundler: Bun.build entry
Bundler-->>CLI: BundleResult
deactivate Bundler
CLI->>Bundler: readFunctionConfig(name)
Bundler-->>CLI: FunctionConfig
alt runtime is cloudflare-workers
CLI->>Deployer: deployToCloudflare(name, bundle, config)
activate Deployer
Deployer->>Deployer: generateWranglerToml()
Deployer->>Wrangler: spawn wrangler deploy
Wrangler-->>Deployer: deployment output
Deployer-->>CLI: DeployResult
deactivate Deployer
alt syncEnv enabled
CLI->>Env: syncEnvToCloudflare(name, config)
activate Env
Env->>Wrangler: wrangler secret put (per env var)
Wrangler-->>Env: success
Env-->>CLI: sync status
deactivate Env
end
else runtime is vercel-edge
CLI->>Deployer: deployToVercel(name, bundle, config)
activate Deployer
Deployer->>Vercel: spawn vercel deploy
Vercel-->>Deployer: deployment output
Deployer-->>CLI: DeployResult
deactivate Deployer
end
CLI->>User: Report deployment URL
deactivate CLI
Estimated code review effort🎯 4 (Complex) | ⏱️ ~55 minutes Possibly related PRs
Poem
✨ Finishing Touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Summary
Implements an Edge Function management system with CLI commands for creating, developing, building, listing, logging, and deploying edge functions.
Changes
create,dev,build,list,logs,deployFiles Changed
packages/cli/src/index.ts- Added function command registrationpackages/cli/src/commands/function.ts- CLI command implementationspackages/core/src/functions/index.ts- Module exportspackages/core/src/functions/bundler.ts- Bundling logicpackages/core/src/functions/deployer.ts- Deployment logicSummary by CodeRabbit
create,dev,build,list,logs, anddeploy.--sync-envflag.