Skip to content

Commit

Permalink
Add support for ignoredDependencies (Node.js only)
Browse files Browse the repository at this point in the history
  • Loading branch information
andybee committed Oct 15, 2023
1 parent 9c86c00 commit d7cfccd
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/actions/autoinstall/node/get-lambda-deps.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ let { globSync } = require('glob')
let { destroyPath, ignoreDeps } = require('../../../lib')
let getRequires = require('./find-lambda-deps')

module.exports = function getDirDeps ({ dir, update, inventory }) {
module.exports = function getDirDeps ({ dir, update, inventory, ignoredDependencies }) {
// Clean everything (except the root) out before we get going jic
let isRoot = dir === inventory.inv._project.cwd
if (!isRoot) {
Expand Down Expand Up @@ -35,7 +35,7 @@ module.exports = function getDirDeps ({ dir, update, inventory }) {
// However, due to SDK version differences between older vs. newer Node.js Lambda containers, that may not actually necessarily be the case, so flag them
let awsSdkV2 = deps.some(d => d === 'aws-sdk')
let awsSdkV3 = deps.some(d => d.startsWith('@aws-sdk'))
deps = deps.filter(d => d !== 'aws-sdk' && !d.startsWith('@aws-sdk'))
deps = deps.filter(d => d !== 'aws-sdk' && !d.startsWith('@aws-sdk') && !ignoredDependencies?.includes(d))

return { deps, failures, files, awsSdkV2, awsSdkV3 }
}
4 changes: 2 additions & 2 deletions src/actions/autoinstall/node/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,10 @@ module.exports = function treeshakeNode (nodeDirs, params) {
let lambda = inventory.inv.lambdasBySrcDir[dir]
if (Array.isArray(lambda)) lambda = lambda[0] // Multi-tenant Lambda check
let { config, name, pragma } = lambda
let { runtime } = config
let { runtime, ignoredDependencies } = config

try {
let result = getLambdaDeps({ dir, update, inventory })
let result = getLambdaDeps({ dir, update, inventory, ignoredDependencies })
let { deps, files, awsSdkV2, awsSdkV3 } = result
projectFiles += files.length
failures = failures.concat(result.failures)
Expand Down

0 comments on commit d7cfccd

Please sign in to comment.