Skip to content

Commit 479540b

Browse files
committed
refactor(vercel): AI Deslop
1 parent 5484a0d commit 479540b

File tree

6 files changed

+12
-90
lines changed

6 files changed

+12
-90
lines changed

.vscode/settings.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,6 @@
77
"packages/cli-v3/e2e": true
88
},
99
"vitest.disableWorkspaceWarning": true,
10-
"typescript.experimental.useTsgo": false
10+
"typescript.experimental.useTsgo": false,
11+
"chat.agent.maxRequests": 0
1112
}

apps/webapp/app/models/vercelIntegration.server.ts

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,12 @@ import {
1818
} from "~/v3/vercel/vercelProjectIntegrationSchema";
1919
import { EnvironmentVariablesRepository } from "~/v3/environmentVariables/environmentVariablesRepository.server";
2020

21-
// Utility to normalize target arrays from Vercel API responses
2221
function normalizeTarget(target: unknown): string[] {
2322
if (Array.isArray(target)) return target.filter(Boolean) as string[];
2423
if (typeof target === 'string') return [target];
2524
return [];
2625
}
2726

28-
// Utility to safely extract envs array from Vercel API response
2927
function extractEnvs(response: unknown): unknown[] {
3028
if (response && typeof response === 'object' && 'envs' in response) {
3129
const envs = (response as { envs: unknown }).envs;
@@ -116,8 +114,6 @@ export class VercelIntegrationRepository {
116114
bearerToken: accessToken,
117115
});
118116

119-
// Use the Vercel SDK to get the integration configuration
120-
// The SDK might have a method for this, or we need to make a direct API call
121117
const response = await fetch(
122118
`https://api.vercel.com/v1/integrations/configuration/${configurationId}${teamId ? `?teamId=${teamId}` : ""}`,
123119
{
@@ -162,7 +158,6 @@ export class VercelIntegrationRepository {
162158
}
163159
}
164160

165-
// Excludes standard environments (production, preview, development)
166161
static async getVercelCustomEnvironments(
167162
client: Vercel,
168163
projectId: string,
@@ -235,7 +230,7 @@ export class VercelIntegrationRepository {
235230
client: Vercel,
236231
projectId: string,
237232
teamId?: string | null,
238-
target?: string // Optional: filter by Vercel environment (production, preview, etc.)
233+
target?: string
239234
): Promise<
240235
Array<{
241236
key: string;
@@ -612,7 +607,7 @@ export class VercelIntegrationRepository {
612607
organizationIntegrationId: params.organizationIntegrationId,
613608
projectId: params.projectId,
614609
externalEntityId: params.vercelProjectId,
615-
integrationData: integrationData as any,
610+
integrationData: integrationData,
616611
installedBy: params.installedByUserId,
617612
},
618613
});

apps/webapp/app/routes/auth.github.callback.tsx

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ export let loader: LoaderFunction = async ({ request }) => {
1919
failureRedirect: "/login", // If auth fails, the failureRedirect will be thrown as a Response
2020
});
2121

22-
// manually get the session
2322
const session = await getSession(request.headers.get("cookie"));
2423

2524
const userRecord = await prisma.user.findFirst({
@@ -51,23 +50,20 @@ export let loader: LoaderFunction = async ({ request }) => {
5150
return redirect("/login/mfa", { headers });
5251
}
5352

54-
// and store the user data
5553
session.set(authenticator.sessionKey, auth);
5654

5755
const headers = new Headers();
5856
headers.append("Set-Cookie", await commitSession(session));
5957
headers.append("Set-Cookie", await setLastAuthMethodHeader("github"));
6058

61-
// Read referral source cookie and set in PostHog if present (only for new users), then clear it
6259
const referralSource = await getReferralSource(request);
6360
if (referralSource) {
6461
const user = await prisma.user.findUnique({
6562
where: { id: auth.userId },
6663
});
6764
if (user) {
68-
// Only set referralSource for new users (created within the last 30 seconds)
6965
const userAge = Date.now() - user.createdAt.getTime();
70-
const isNewUser = userAge < 30 * 1000; // 30 seconds
66+
const isNewUser = userAge < 30 * 1000;
7167

7268
if (isNewUser) {
7369
telemetry.user.identify({
@@ -77,7 +73,6 @@ export let loader: LoaderFunction = async ({ request }) => {
7773
});
7874
}
7975
}
80-
// Clear the cookie after using it (regardless of whether we set it)
8176
headers.append("Set-Cookie", await clearReferralSourceCookie());
8277
}
8378

apps/webapp/app/routes/auth.google.callback.tsx

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ export let loader: LoaderFunction = async ({ request }) => {
1919
failureRedirect: "/login", // If auth fails, the failureRedirect will be thrown as a Response
2020
});
2121

22-
// manually get the session
2322
const session = await getSession(request.headers.get("cookie"));
2423

2524
const userRecord = await prisma.user.findFirst({
@@ -51,23 +50,20 @@ export let loader: LoaderFunction = async ({ request }) => {
5150
return redirect("/login/mfa", { headers });
5251
}
5352

54-
// and store the user data
5553
session.set(authenticator.sessionKey, auth);
5654

5755
const headers = new Headers();
5856
headers.append("Set-Cookie", await commitSession(session));
5957
headers.append("Set-Cookie", await setLastAuthMethodHeader("google"));
6058

61-
// Read referral source cookie and set in PostHog if present (only for new users), then clear it
6259
const referralSource = await getReferralSource(request);
6360
if (referralSource) {
6461
const user = await prisma.user.findUnique({
6562
where: { id: auth.userId },
6663
});
6764
if (user) {
68-
// Only set referralSource for new users (created within the last 30 seconds)
6965
const userAge = Date.now() - user.createdAt.getTime();
70-
const isNewUser = userAge < 30 * 1000; // 30 seconds
66+
const isNewUser = userAge < 30 * 1000;
7167

7268
if (isNewUser) {
7369
telemetry.user.identify({
@@ -77,7 +73,6 @@ export let loader: LoaderFunction = async ({ request }) => {
7773
});
7874
}
7975
}
80-
// Clear the cookie after using it (regardless of whether we set it)
8176
headers.append("Set-Cookie", await clearReferralSourceCookie());
8277
}
8378

apps/webapp/app/routes/resources.orgs.$organizationSlug.projects.$projectParam.env.$envParam.vercel.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -433,7 +433,6 @@ export async function action({ request, params }: ActionFunctionArgs) {
433433

434434
// Handle skip-onboarding action
435435
if (actionType === "skip-onboarding") {
436-
await vercelService.skipOnboarding(project.id);
437436
const settingsPath = v3ProjectSettingsPath(
438437
{ slug: organizationSlug },
439438
{ slug: projectParam },

0 commit comments

Comments
 (0)