Skip to content

Commit 7acbca5

Browse files
Fix TypeScript syntax error and standardize Supabase client usage
Co-authored-by: Gerome-Elassaad <186273274+Gerome-Elassaad@users.noreply.github.com>
1 parent be1d216 commit 7acbca5

File tree

4 files changed

+41
-32
lines changed

4 files changed

+41
-32
lines changed

app/api/deployments/[id]/rollback/route.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ export async function POST(
1010
{ params }: { params: { id: string } }
1111
) {
1212
try {
13-
const supabase = createServerClient()
13+
const supabase = createServerClient(true)
1414
const { data: { session } } = await supabase.auth.getSession()
1515

1616
if (!session?.user?.id) {

app/api/deployments/[id]/route.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ export async function GET(
1010
{ params }: { params: { id: string } }
1111
) {
1212
try {
13-
const supabase = createServerClient()
13+
const supabase = createServerClient(true)
1414
const { data: { session } } = await supabase.auth.getSession()
1515

1616
if (!session?.user?.id) {
@@ -42,7 +42,7 @@ export async function DELETE(
4242
{ params }: { params: { id: string } }
4343
) {
4444
try {
45-
const supabase = createServerClient()
45+
const supabase = createServerClient(true)
4646
const { data: { session } } = await supabase.auth.getSession()
4747

4848
if (!session?.user?.id) {

app/api/deployments/route.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ export const dynamic = 'force-dynamic'
88
// POST /api/deployments - Deploy fragment
99
export async function POST(request: NextRequest) {
1010
try {
11-
const supabase = createServerClient()
11+
const supabase = createServerClient(true)
1212
const { data: { session } } = await supabase.auth.getSession()
1313

1414
if (!session?.user?.id) {
@@ -50,7 +50,7 @@ export async function POST(request: NextRequest) {
5050
// GET /api/deployments - List deployments
5151
export async function GET(request: NextRequest) {
5252
try {
53-
const supabase = createServerClient()
53+
const supabase = createServerClient(true)
5454
const { data: { session } } = await supabase.auth.getSession()
5555

5656
if (!session?.user?.id) {

lib/deployment/deployment-engine.ts

Lines changed: 36 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -320,7 +320,6 @@ export const deploymentProviders: DeploymentProvider[] = [
320320
]
321321

322322
export class DeploymentEngine {
323-
[x: string]: any
324323
private deployments = new Map<string, DeploymentStatus>()
325324
private deploymentHistory = new Map<string, DeploymentResult[]>()
326325

@@ -738,48 +737,58 @@ gatherUsageStats = false
738737
// - Resource caching
739738
}
740739

741-
private async deployToProvider(
740+
private async deployToActualProvider(
742741
deployment: DeploymentStatus,
743742
fragment: FragmentSchema,
744743
config: DeploymentConfig
745744
): Promise<DeploymentResult> {
745+
const provider = config.provider
746+
const deploymentId = deployment.deploymentId
747+
746748
deployment.status = 'deploying'
747749
deployment.progress = 80
748750
deployment.currentStep = `Deploying to ${config.provider.name}`
749751
deployment.logs.push(`🚀 Deploying to ${config.provider.name}...`)
750-
751-
// Simulate deployment based on provider
752-
const result = await this.simulateProviderDeployment(deployment, fragment, config)
753-
754-
deployment.progress = 100
755-
deployment.status = 'success'
756-
deployment.deployedAt = new Date()
757-
deployment.url = result.url
758-
deployment.previewUrl = result.previewUrl
759-
760-
return result
761-
}
762-
763-
private async deployToActualProvider(
764-
deployment: DeploymentStatus,
765-
fragment: FragmentSchema,
766-
config: DeploymentConfig
767-
): Promise<DeploymentResult> {
768-
const provider = config.provider
769-
const deploymentId = deployment.deploymentId
770752

771753
try {
772754
switch (provider.id) {
773755
case 'vercel':
774-
return await this.deployToVercel(deployment, fragment, config)
756+
const result = await this.deployToVercel(deployment, fragment, config)
757+
deployment.progress = 100
758+
deployment.status = 'success'
759+
deployment.deployedAt = new Date()
760+
deployment.url = result.url
761+
deployment.previewUrl = result.previewUrl
762+
return result
775763
case 'netlify':
776-
return await this.deployToNetlify(deployment, fragment, config)
764+
const netlifyResult = await this.deployToNetlify(deployment, fragment, config)
765+
deployment.progress = 100
766+
deployment.status = 'success'
767+
deployment.deployedAt = new Date()
768+
deployment.url = netlifyResult.url
769+
deployment.previewUrl = netlifyResult.previewUrl
770+
return netlifyResult
777771
case 'railway':
778-
return await this.deployToRailway(deployment, fragment, config)
772+
const railwayResult = await this.deployToRailway(deployment, fragment, config)
773+
deployment.progress = 100
774+
deployment.status = 'success'
775+
deployment.deployedAt = new Date()
776+
deployment.url = railwayResult.url
777+
return railwayResult
779778
case 'render':
780-
return await this.deployToRender(deployment, fragment, config)
779+
const renderResult = await this.deployToRender(deployment, fragment, config)
780+
deployment.progress = 100
781+
deployment.status = 'success'
782+
deployment.deployedAt = new Date()
783+
deployment.url = renderResult.url
784+
return renderResult
781785
case 'fly-io':
782-
return await this.deployToFly(deployment, fragment, config)
786+
const flyResult = await this.deployToFly(deployment, fragment, config)
787+
deployment.progress = 100
788+
deployment.status = 'success'
789+
deployment.deployedAt = new Date()
790+
deployment.url = flyResult.url
791+
return flyResult
783792
default:
784793
throw new Error(`Provider ${provider.id} not implemented`)
785794
}

0 commit comments

Comments
 (0)