Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
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
3 changes: 3 additions & 0 deletions src/presets/vercel/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@ export interface VercelBuildConfigV3 {
>;
cache?: string[];
bypassToken?: string;
framework?: {
version: string;
};
crons?: {
path: string;
schedule: string;
Expand Down
4 changes: 4 additions & 0 deletions src/presets/vercel/utils.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import fsp from "node:fs/promises";
import { defu } from "defu";
import { writeFile } from "../_utils/fs.ts";
import { version as nitroVersion } from "nitro/meta";
import type { Nitro, NitroRouteRules } from "nitro/types";
import { dirname, relative, resolve } from "pathe";
import { joinURL, withLeadingSlash, withoutLeadingSlash } from "ufo";
Expand Down Expand Up @@ -137,6 +138,9 @@ function generateBuildConfig(nitro: Nitro, o11Routes?: ObservabilityRoute[]) {

const config = defu(nitro.options.vercel?.config, {
version: 3,
framework: {
version: nitroVersion,
},
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Comment thread
pi0 marked this conversation as resolved.
overrides: {
// Nitro static prerendered route overrides
...Object.fromEntries(
Expand Down
3 changes: 3 additions & 0 deletions test/presets/vercel.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { promises as fsp } from "node:fs";
import { resolve, join, basename } from "pathe";
import { describe, expect, it, vi, beforeAll, afterAll } from "vitest";
import { version as nitroVersion } from "nitro/meta";
Comment thread
pi0 marked this conversation as resolved.
Outdated
import { setupTest, testNitro, fixtureDir } from "../tests.ts";
import { toFetchHandler } from "srvx/node";

Expand All @@ -27,6 +28,8 @@ describe("nitro:preset:vercel:web", async () => {
const config = await fsp
.readFile(resolve(ctx.outDir, "config.json"), "utf8")
.then((r) => JSON.parse(r));
expect(config.framework).toEqual({ version: nitroVersion });

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can be any version, we need to add support for name as well in the build output API...

delete config.framework;
expect(config).toMatchInlineSnapshot(`
{
"overrides": {
Expand Down
Loading