@architect/hydrate
Advanced tools
Comparing version 3.1.5 to 3.1.6-RC.0
{ | ||
"name": "@architect/hydrate", | ||
"version": "3.1.5", | ||
"version": "3.1.6-RC.0", | ||
"description": "Architect dependency hydrator and shared file manager", | ||
@@ -36,3 +36,3 @@ "main": "src/index.js", | ||
"dependencies": { | ||
"@architect/inventory": "~3.3.0", | ||
"@architect/inventory": "~3.3.4-RC.0", | ||
"@architect/utils": "~3.1.2", | ||
@@ -44,3 +44,3 @@ "acorn-loose": "~8.3.0", | ||
"glob": "~8.0.3", | ||
"minimist": "~1.2.6", | ||
"minimist": "~1.2.7", | ||
"run-series": "~1.1.9", | ||
@@ -52,8 +52,8 @@ "symlink-or-copy": "~1.3.1" | ||
"cross-env": "~7.0.3", | ||
"eslint": "~8.23.0", | ||
"mock-fs": "~5.1.4", | ||
"eslint": "~8.28.0", | ||
"mock-fs": "~5.2.0", | ||
"nyc": "^15.1.0", | ||
"proxyquire": "~2.1.3", | ||
"tap-spec": "^5.0.0", | ||
"tape": "~5.6.0", | ||
"tape": "~5.6.1", | ||
"yarn": "~1.22.19" | ||
@@ -60,0 +60,0 @@ }, |
@@ -33,5 +33,10 @@ let { join } = require('path') | ||
deps = [ ...new Set(deps.sort()) ] // Dedupe | ||
deps = deps.filter(d => d !== 'aws-sdk') // Already present at runtime | ||
return { deps, failures, files } | ||
// Some version of AWS SDK is presumed to already be present at runtime | ||
// 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')) | ||
return { deps, failures, files, awsSdkV2, awsSdkV3 } | ||
} |
@@ -14,2 +14,4 @@ let { join } = require('path') | ||
let sharedFiles = [] | ||
let sharedAwsSdkV2 | ||
let sharedAwsSdkV3 | ||
if (shared) { | ||
@@ -22,2 +24,4 @@ projectDirs++ | ||
sharedFiles = result.files.map(f => join(dir, f)) | ||
sharedAwsSdkV2 = result.awsSdkV2 | ||
sharedAwsSdkV3 = result.awsSdkV3 | ||
} | ||
@@ -27,2 +31,4 @@ | ||
let viewsFiles = [] | ||
let viewsAwsSdkV2 | ||
let viewsAwsSdkV3 | ||
if (views) { | ||
@@ -35,2 +41,4 @@ projectDirs++ | ||
viewsFiles = result.files.map(f => join(dir, f)) | ||
viewsAwsSdkV2 = result.awsSdkV2 | ||
viewsAwsSdkV3 = result.awsSdkV3 | ||
} | ||
@@ -41,4 +49,8 @@ | ||
sharedFiles, | ||
sharedAwsSdkV2, | ||
sharedAwsSdkV3, | ||
viewsDeps, | ||
viewsFiles, | ||
viewsAwsSdkV2, | ||
viewsAwsSdkV3, | ||
projectDirs, | ||
@@ -45,0 +57,0 @@ projectFiles, |
@@ -30,6 +30,14 @@ let { existsSync, renameSync, writeFileSync } = require('fs') | ||
let shared = getSharedDeps({ cwd, inventory, update }) | ||
let { sharedDeps, sharedFiles, viewsDeps, viewsFiles } = shared | ||
let { | ||
sharedDeps, sharedFiles, /* sharedAwsSdkV2, sharedAwsSdkV3, */ | ||
viewsDeps, viewsFiles, /* viewsAwsSdkV2, viewsAwsSdkV3, */ | ||
} = shared | ||
projectDirs += shared.projectDirs | ||
projectFiles += shared.projectFiles | ||
// TODO warn for shared/views | ||
let v2Warnings = [] | ||
let v3Warnings = [] | ||
dirs.forEach(dir => { | ||
@@ -39,16 +47,26 @@ projectDirs++ | ||
if (Array.isArray(lambda)) lambda = lambda[0] // Handle multitenant Lambdae | ||
let { config, name, pragma } = lambda | ||
let { runtime } = config | ||
// Autoinstall is currently Node.js only - exit early if it's another runtime | ||
if (!lambda.config.runtime.startsWith('nodejs')) return | ||
if (!runtime.startsWith('nodejs')) return | ||
try { | ||
let result = getLambdaDeps({ dir, update, inventory }) | ||
let { deps, files } = result | ||
let { deps, files, awsSdkV2, awsSdkV3 } = result | ||
projectFiles += files.length | ||
failures = failures.concat(result.failures) | ||
if (lambda.config.shared) { | ||
let hasSdkV3 = runtime >= 'nodejs18.x' | ||
if (hasSdkV3 && awsSdkV2) { | ||
v2Warnings.push(`- '@${pragma} ${name}' (runtime: '${runtime}')`) | ||
} | ||
if (!hasSdkV3 && awsSdkV3) { | ||
v3Warnings.push(`- '@${pragma} ${name}' (runtime: '${runtime}')`) | ||
} | ||
if (config.shared) { | ||
deps = deps.concat(sharedDeps) | ||
files = files.concat(sharedFiles) | ||
} | ||
if (lambda.config.views) { | ||
if (config.views) { | ||
deps = deps.concat(viewsDeps) | ||
@@ -93,2 +111,23 @@ files = files.concat(viewsFiles) | ||
let plural = arr => arr.length > 1 | ||
let msg = (plural, dep) => `The following function${plural ? 's' : ''} requires or imports ${dep}, which is not built into your Lambda${plural ? `s'` : `'s`} runtime:` | ||
let depWarnings = [] | ||
if (v2Warnings.length) { | ||
depWarnings.push( | ||
msg(plural(v2Warnings), `'aws-sdk'`), | ||
...v2Warnings, | ||
) | ||
} | ||
if (v3Warnings.length) { | ||
depWarnings.push( | ||
msg(plural(v3Warnings), `one or more '@aws-sdk/*' (V3) modules`), | ||
...v3Warnings, | ||
) | ||
} | ||
if (depWarnings) { | ||
depWarnings.unshift('Found following possible AWS SDK version mismatches!') | ||
depWarnings.push('Architect does not manage AWS SDK, thus this code may be broken when deployed. See more at: https://arc.codes/aws-sdk-versions') | ||
update.warn(depWarnings.join('\n')) | ||
} | ||
// Halt hydration (and deployment) if there are dependency determination issues | ||
@@ -95,0 +134,0 @@ if (failures.length) { |
@@ -7,3 +7,3 @@ let { rmSync, unlinkSync } = require('fs') | ||
function destroyPath (path) { | ||
rmSync(path, { recursive: true, force: true }) | ||
rmSync(path, { recursive: true, force: true, maxRetries: 10 }) | ||
// If there are stale symlinks lying about, rmSync will have missed them | ||
@@ -10,0 +10,0 @@ // So let's attempt an unlink jic, and all should be well |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1100
57107
25
1
Updatedminimist@~1.2.7