Skip to content

Commit

Permalink
feat(vercel): add functions config (#976)
Browse files Browse the repository at this point in the history
  • Loading branch information
smaeda-ks authored Feb 22, 2023
1 parent 7efa31f commit 4585ca8
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/presets/vercel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ export const vercel = defineNitroPreset({

const systemNodeVersion = process.versions.node.split(".")[0];
const runtimeVersion = `nodejs${systemNodeVersion}.x`;
const customMemory = nitro.options.vercel?.functions?.memory;
const customMaxDuration = nitro.options.vercel?.functions?.maxDuration;
const functionConfigPath = resolve(
nitro.options.output.serverDir,
".vc-config.json"
Expand All @@ -38,6 +40,8 @@ export const vercel = defineNitroPreset({
handler: "index.mjs",
launcherType: "Nodejs",
shouldAddHelpers: false,
memory: customMemory,
maxDuration: customMaxDuration,
};
await writeFile(
functionConfigPath,
Expand Down
4 changes: 4 additions & 0 deletions src/types/presets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,5 +45,9 @@ export interface VercelBuildConfigV3 {
export interface PresetOptions {
vercel: {
config: VercelBuildConfigV3;
functions?: {
memory: number;
maxDuration: number;
};
};
}

0 comments on commit 4585ca8

Please sign in to comment.