now-python-lambda
Advanced tools
Comparing version 1.0.10 to 1.0.11
39
index.js
@@ -56,16 +56,35 @@ const path = require("path"); | ||
console.log("entrypoint is", entrypoint); | ||
const userHandlerFilePath = entrypoint.replace(/\.py$/, ""); | ||
console.log("userHandlerFilePath:", userHandlerFilePath); | ||
const outputFiles = await glob("**", srcDir); | ||
const lambda = await createLambda({ | ||
files: outputFiles, | ||
handler: `${userHandlerFilePath}.handler`, | ||
runtime: "python3.7", | ||
environment: {} | ||
const serverlessConfigFile = await readFile(path.join(srcDir, entrypoint)); | ||
const serverlessConfig = JSON.parse(serverlessConfigFile); | ||
const output = {}; | ||
Object.entries(serverlessConfig.functions).forEach(async ([key, value]) => { | ||
const lambda = await createLambda({ | ||
files: outputFiles, | ||
handler: `${path.dirname(entrypoint)}/${value.handler}`, | ||
runtime: "python3.7", | ||
environment: {} | ||
}); | ||
output[[value.entrypoint]] = lambda; | ||
}); | ||
return { | ||
[entrypoint]: lambda | ||
}; | ||
return output; | ||
// const userHandlerFilePath = entrypoint.replace(/\.py$/, ""); | ||
// console.log("userHandlerFilePath:", userHandlerFilePath); | ||
// | ||
// const lambda = await createLambda({ | ||
// files: outputFiles, | ||
// handler: `${userHandlerFilePath}.handler`, | ||
// runtime: "python3.7", | ||
// environment: {} | ||
// }); | ||
// | ||
// return { | ||
// [entrypoint]: lambda | ||
// }; | ||
}; |
{ | ||
"name": "now-python-lambda", | ||
"version": "1.0.10", | ||
"version": "1.0.11", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
4907
119