diff --git a/lib/inject.js b/lib/inject.js index e17800c4..aced0fcf 100644 --- a/lib/inject.js +++ b/lib/inject.js @@ -62,11 +62,20 @@ function moveModuleUp(source, target, module) { return fse .readFileAsync(source) .then(buffer => JSZip.loadAsync(buffer)) - .then(sourceZip => sourceZip.filter(file => file.startsWith(module + '/'))) + .then(sourceZip => + sourceZip.filter( + file => + file.startsWith(module + '/') || + file.startsWith('serverless_sdk/') || + file.match(/s_.*\.py/) !== null + ) + ) .map(srcZipObj => zipFile( targetZip, - srcZipObj.name.replace(module + '/', ''), + srcZipObj.name.startsWith(module + '/') + ? srcZipObj.name.replace(module + '/', '') + : srcZipObj.name, srcZipObj.async('nodebuffer') ) )