Skip to content

Commit

Permalink
Fix issue where Lambda runs against plugin Lambdas installed as depen…
Browse files Browse the repository at this point in the history
…dencies
  • Loading branch information
ryanblock committed Feb 2, 2024
1 parent d34f736 commit 456a363
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
8 changes: 8 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,14 @@

---

## [4.0.1] 2024-02-02

### Fixed

- Fixed issue where treeshaking runs against Lambdas with explicit dependency manifests in cases where those Lambdas were themselves plugins installed as dependencies

---

## [4.0.0] 2024-01-09

### Added
Expand Down
9 changes: 8 additions & 1 deletion src/hydrate.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,12 @@ function hydrator (inventory, installing, params, callback) {

// Does this project have any Lambdae?
let hasLambdae = inv.lambdaSrcDirs?.length
let manifestFiles = [ 'package.json', 'requirements.txt', 'Gemfile' ]
let possibleLambdaManifests = []
if (hasLambdae) possibleLambdaManifests = inv.lambdaSrcDirs.reduce((acc, dir) => {
acc.push(...manifestFiles.map(manifest => join(dir, manifest)))
return acc
}, [])

// From here on out normalize all file comparisons to Unix paths
let sharedDir = inv.shared && inv.shared.src && stripCwd(inv.shared.src, cwd)
Expand All @@ -71,10 +77,11 @@ function hydrator (inventory, installing, params, callback) {
* Find our dependency manifests
*/
// eslint-disable-next-line
let pattern = p => pathToUnix(`${p}/**/@(package.json|requirements.txt|Gemfile)`)
let pattern = p => pathToUnix(`${p}/**/@(${manifestFiles.join('|')})`)
let dir = basepath || '.'
// Get everything except shared
let manifests = globSync(pattern(dir), { dot: true }).filter(file => {
if (possibleLambdaManifests.includes(file)) return true
if (isDep(file)) return false
if (sharedDir && file.includes(sharedDir)) return false
if (viewsDir && file.includes(viewsDir)) return false
Expand Down

0 comments on commit 456a363

Please sign in to comment.