Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix issue where Lambda runs against plugin Lambdas installed as depencies #188

Merged
merged 2 commits into from
Feb 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 => stripCwd(join(dir, manifest), cwd)))
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
Loading