Skip to content

Commit efea28e

Browse files
committed
fix ci typecheck
1 parent 4c12f7e commit efea28e

7 files changed

Lines changed: 74 additions & 12 deletions

File tree

packages/cli/src/controllers/app.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4019,7 +4019,10 @@ function appDeployFailedError(
40194019
});
40204020
}
40214021

4022-
function appBuildFailedError(why: string, debug: string | undefined): CliError {
4022+
function appBuildFailedError(
4023+
why: string,
4024+
debug: string | null | undefined,
4025+
): CliError {
40234026
const standaloneOutputFailure = isNextStandaloneOutputFailure(why);
40244027
const fix = standaloneOutputFailure
40254028
? 'Add output: "standalone" to next.config.*, then rerun deploy.'

packages/cli/src/lib/app/branch-database.ts

Lines changed: 35 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,14 @@ interface ClassifiedPrismaNextConfig {
194194
target: "postgresql" | "unknown" | UnsupportedBranchDatabaseSchemaTarget;
195195
}
196196

197+
interface SupportedPrismaNextConfig extends ClassifiedPrismaNextConfig {
198+
target: "postgresql" | "unknown";
199+
}
200+
201+
interface UnsupportedPrismaNextConfig extends ClassifiedPrismaNextConfig {
202+
target: UnsupportedBranchDatabaseSchemaTarget;
203+
}
204+
197205
interface PrismaOrmSchemaSelection {
198206
schema: BranchDatabaseSchema | null;
199207
unsupportedSchema: UnsupportedBranchDatabaseSchema | null;
@@ -341,16 +349,26 @@ async function selectPrismaOrmSchema(
341349
};
342350
}
343351

352+
function selectPrismaNextConfig(
353+
cwd: string,
354+
candidates: ClassifiedPrismaNextConfig[],
355+
mode: "supported",
356+
): SupportedPrismaNextConfig | null;
357+
function selectPrismaNextConfig(
358+
cwd: string,
359+
candidates: ClassifiedPrismaNextConfig[],
360+
mode: "unsupported",
361+
): UnsupportedPrismaNextConfig | null;
344362
function selectPrismaNextConfig(
345363
cwd: string,
346364
candidates: ClassifiedPrismaNextConfig[],
347365
mode: "supported" | "unsupported",
348366
): ClassifiedPrismaNextConfig | null {
349-
const matches = candidates.filter((candidate) => {
350-
const isSupported =
351-
candidate.target === "postgresql" || candidate.target === "unknown";
352-
return mode === "supported" ? isSupported : !isSupported;
353-
});
367+
const matches = candidates.filter(
368+
mode === "supported"
369+
? isSupportedPrismaNextConfig
370+
: isUnsupportedPrismaNextConfig,
371+
);
354372

355373
return (
356374
sortByPreferredRelativePath(
@@ -367,6 +385,18 @@ function selectPrismaNextConfig(
367385
);
368386
}
369387

388+
function isSupportedPrismaNextConfig(
389+
candidate: ClassifiedPrismaNextConfig,
390+
): candidate is SupportedPrismaNextConfig {
391+
return candidate.target === "postgresql" || candidate.target === "unknown";
392+
}
393+
394+
function isUnsupportedPrismaNextConfig(
395+
candidate: ClassifiedPrismaNextConfig,
396+
): candidate is UnsupportedPrismaNextConfig {
397+
return !isSupportedPrismaNextConfig(candidate);
398+
}
399+
370400
function sortByPreferredRelativePath(
371401
cwd: string,
372402
candidates: string[],

packages/cli/tests/helpers.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,13 +62,14 @@ export async function executeCli(options: {
6262
stderr.columns = 80;
6363
stdout.rows = 24;
6464
stderr.rows = 24;
65+
const cwd = options.cwd ?? process.cwd();
6566

6667
const stdin = new CaptureInput();
6768
stdin.isTTY = options.isTTY ?? false;
6869
const env = createTestEnv(options.env, options.preserveCI);
6970
const runtime: CliRuntime = {
7071
argv: options.argv,
71-
cwd: options.cwd,
72+
cwd,
7273
env,
7374
signal: new AbortController().signal,
7475
fixturePath: options.fixturePath,

packages/cli/tests/project-real-mode.test.ts

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,14 @@
11
import path from "node:path";
22

3-
import { afterEach, describe, expect, it, vi } from "vitest";
3+
import { afterEach, describe, expect, it, type Mock, vi } from "vitest";
4+
5+
type ApiGetMock = Mock<
6+
(
7+
pathName: string,
8+
request?: { params?: { query?: Record<string, unknown> } },
9+
) => unknown
10+
>;
11+
type ApiMutationMock = Mock<(pathName: string, request?: unknown) => unknown>;
412

513
afterEach(() => {
614
vi.doUnmock("../src/lib/auth/auth-ops");
@@ -26,9 +34,9 @@ function mockAuthState() {
2634

2735
function mockClient(
2836
extra: Partial<{
29-
GET: ReturnType<typeof vi.fn>;
30-
POST: ReturnType<typeof vi.fn>;
31-
DELETE: ReturnType<typeof vi.fn>;
37+
GET: ApiGetMock;
38+
POST: ApiMutationMock;
39+
DELETE: ApiMutationMock;
3240
}> = {},
3341
) {
3442
return {

packages/compute/tests/scale-to-zero.test.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,9 @@ describe("scale-to-zero guard", () => {
9797
controller.abort();
9898
expect(await readSignals(file)).toBe("+-");
9999

100-
expect(resolvePromise).toBeDefined();
100+
if (!resolvePromise) {
101+
throw new Error("Expected promise resolver to be captured");
102+
}
101103
resolvePromise("done");
102104
await expect(promise).resolves.toBe("done");
103105
await Promise.resolve();

scripts/prepare-cli-publish.d.mts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
export declare function stageCliPublishPackage(options?: {
2+
sourceDir?: string;
3+
outputDir?: string;
4+
publishVersion?: string;
5+
}): Promise<string>;

scripts/resolve-cli-version.d.mts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
export declare const CLI_RELEASE_BASE_VERSION: string;
2+
3+
export declare function resolveDevVersion(options: {
4+
runNumber?: string | number | null;
5+
runAttempt?: string | number | null;
6+
}): string;
7+
8+
export declare function resolvePrVersion(options: {
9+
prNumber?: string | number | null;
10+
sha?: string | null;
11+
}): string;
12+
13+
export declare function resolveNextBetaVersion(latest?: string | null): string;

0 commit comments

Comments
 (0)