mirror of
https://github.com/LukeHagar/vercel.git
synced 2025-12-10 12:57:47 +00:00
[python][ruby][cli] Remove deprecated createLambda() usage (#11080)
* Use `Lambda` constructor instead of `createLambda()` * Return `FileBlob` instance for the entrypoint files, so that they do not get written to cwd * In `vc dev`, support `Lambda` instances which do not have `zipBuffer` property
This commit is contained in:
@@ -10,14 +10,16 @@ import {
|
||||
writeFile,
|
||||
} from 'fs-extra';
|
||||
import {
|
||||
BuildOptions,
|
||||
download,
|
||||
getWriteableDirectory,
|
||||
glob,
|
||||
createLambda,
|
||||
Lambda,
|
||||
debug,
|
||||
walkParentDirs,
|
||||
cloneEnv,
|
||||
FileBlob,
|
||||
type Files,
|
||||
type BuildV3,
|
||||
} from '@vercel/build-utils';
|
||||
import { installBundler } from './install-ruby';
|
||||
|
||||
@@ -114,13 +116,13 @@ async function bundleInstall(
|
||||
|
||||
export const version = 3;
|
||||
|
||||
export async function build({
|
||||
export const build: BuildV3 = async ({
|
||||
workPath,
|
||||
files,
|
||||
entrypoint,
|
||||
config,
|
||||
meta = {},
|
||||
}: BuildOptions) {
|
||||
}) => {
|
||||
await download(files, workPath, meta);
|
||||
const entrypointFsDirname = join(workPath, dirname(entrypoint));
|
||||
const gemfileName = 'Gemfile';
|
||||
@@ -217,12 +219,11 @@ export async function build({
|
||||
// somethig else
|
||||
const handlerRbFilename = 'vc__handler__ruby';
|
||||
|
||||
await writeFile(
|
||||
join(workPath, `${handlerRbFilename}.rb`),
|
||||
nowHandlerRbContents
|
||||
);
|
||||
const outputFiles: Files = await glob('**', workPath);
|
||||
|
||||
const outputFiles = await glob('**', workPath);
|
||||
outputFiles[`${handlerRbFilename}.rb`] = new FileBlob({
|
||||
data: nowHandlerRbContents,
|
||||
});
|
||||
|
||||
// static analysis is impossible with ruby.
|
||||
// instead, provide `includeFiles` and `excludeFiles` config options to reduce bundle size.
|
||||
@@ -253,12 +254,12 @@ export async function build({
|
||||
}
|
||||
}
|
||||
|
||||
const lambda = await createLambda({
|
||||
const output = new Lambda({
|
||||
files: outputFiles,
|
||||
handler: `${handlerRbFilename}.vc__handler`,
|
||||
runtime,
|
||||
environment: {},
|
||||
});
|
||||
|
||||
return { output: lambda };
|
||||
}
|
||||
return { output };
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user