@dealmore/terraform-next-build
Advanced tools
Comparing version 0.1.0 to 0.2.0
@@ -69,2 +69,3 @@ "use strict"; | ||
buildId: props.buildId, | ||
prerenders: props.prerenders, | ||
staticFilesArchive: 'static-website-files.zip', | ||
@@ -101,3 +102,5 @@ }; | ||
// On download create a tmp dir where the files can be downloaded | ||
const tmpDir = mode === 'download' ? tmp_1.default.dirSync() : null; | ||
const tmpDir = mode === 'download' | ||
? tmp_1.default.dirSync({ unsafeCleanup: deleteBuildCache }) | ||
: null; | ||
const entryPath = cwd; | ||
@@ -112,2 +115,3 @@ const entrypoint = 'package.json'; | ||
const lambdas = {}; | ||
const prerenders = {}; | ||
const staticWebsiteFiles = {}; | ||
@@ -118,3 +122,3 @@ const buildResult = await next_tf_1.build({ | ||
entrypoint, | ||
config: {}, | ||
config: { sharedLambdas: true }, | ||
meta: { | ||
@@ -129,9 +133,27 @@ isDev: false, | ||
for (const [key, file] of Object.entries(buildResult.output)) { | ||
if (file.type === 'Lambda') { | ||
// Filter for lambdas | ||
lambdas[key] = file; | ||
switch (file.type) { | ||
case 'Lambda': { | ||
lambdas[key] = file; | ||
break; | ||
} | ||
case 'Prerender': { | ||
prerenders[key] = file; | ||
break; | ||
} | ||
case 'FileFsRef': { | ||
staticWebsiteFiles[key] = file; | ||
break; | ||
} | ||
} | ||
else if (file.type === 'FileFsRef') { | ||
// Filter for static Website content | ||
staticWebsiteFiles[key] = file; | ||
} | ||
// Build the mapping for prerendered routes | ||
const prerenderedOutput = {}; | ||
for (const [key, prerender] of Object.entries(prerenders)) { | ||
// Find the matching the Lambda route | ||
const match = Object.entries(lambdas).find(([, lambda]) => { | ||
return lambda === prerender.lambda; | ||
}); | ||
if (match) { | ||
const [lambdaKey] = match; | ||
prerenderedOutput[`/${key}`] = { lambda: lambdaKey }; | ||
} | ||
@@ -141,2 +163,3 @@ } | ||
buildId, | ||
prerenders: prerenderedOutput, | ||
routes: buildResult.routes, | ||
@@ -161,3 +184,2 @@ lambdas, | ||
if (tmpDir && deleteBuildCache) { | ||
fs.emptyDirSync(tmpDir.name); | ||
tmpDir.removeCallback(); | ||
@@ -164,0 +186,0 @@ } |
{ | ||
"name": "@dealmore/terraform-next-build", | ||
"version": "0.1.0", | ||
"version": "0.2.0", | ||
"description": "CLI build tool for AWS Next.js Terraform module", | ||
@@ -22,7 +22,7 @@ "homepage": "https://github.com/dealmore/terraform-aws-next-js", | ||
"dependencies": { | ||
"@dealmore/next-tf": "2.6.19", | ||
"@vercel/build-utils": "^2.4.2", | ||
"@dealmore/next-tf": "2.7.3", | ||
"@vercel/build-utils": "^2.6.0", | ||
"@vercel/frameworks": "^0.0.15", | ||
"@vercel/routing-utils": "^1.8.3", | ||
"archiver": "^4.0.1", | ||
"archiver": "^5.1.0", | ||
"fs-extra": "^9.0.1", | ||
@@ -34,3 +34,3 @@ "glob": "^7.1.6", | ||
"devDependencies": { | ||
"@types/archiver": "^3.1.0", | ||
"@types/archiver": "^5.1.0", | ||
"@types/fs-extra": "^9.0.1", | ||
@@ -37,0 +37,0 @@ "@types/glob": "^7.1.2", |
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
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
21544
229
+ Added@dealmore/next-tf@2.7.3(transitive)
+ Addedarchiver@5.3.2(transitive)
+ Addedarchiver-utils@3.0.4(transitive)
+ Addedbrace-expansion@2.0.1(transitive)
+ Addedcompress-commons@4.1.2(transitive)
+ Addedcrc-32@1.2.2(transitive)
+ Addedcrc32-stream@4.0.3(transitive)
+ Addedminimatch@5.1.6(transitive)
+ Addedreaddir-glob@1.1.3(transitive)
+ Addedzip-stream@4.1.1(transitive)
- Removed@dealmore/next-tf@2.6.19(transitive)
- Removedarchiver@4.0.2(transitive)
- Removedcompress-commons@3.0.0(transitive)
- Removedcrc@3.8.0(transitive)
- Removedcrc32-stream@3.0.1(transitive)
- Removedzip-stream@3.0.1(transitive)
Updated@dealmore/next-tf@2.7.3
Updated@vercel/build-utils@^2.6.0
Updatedarchiver@^5.1.0