Skip to content
Merged
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
29 changes: 25 additions & 4 deletions src/frameworks/cdkFramework.ts
Original file line number Diff line number Diff line change
Expand Up @@ -326,11 +326,14 @@ export class CdkFramework implements IFramework {
// });
global.lambdas.push(lambdaInfo);` + codeToFind,
);
}

if (
} else if (
args.path.includes(
'aws-cdk-lib/aws-s3-deployment/lib/bucket-deployment.',
path.join(
'aws-cdk-lib',
'aws-s3-deployment',
'lib',
'bucket-deployment.',
),
)
) {
const codeToFind = 'super(scope,id),this.requestDestinationArn=!1;';
Expand All @@ -341,6 +344,24 @@ export class CdkFramework implements IFramework {

// Inject code to prevent deploying the assets
contents = contents.replace(codeToFind, codeToFind + `return;`);
} else if (
args.path.includes(
path.join('aws-cdk-lib', 'aws-lambda-nodejs', 'lib', 'bundling.'),
)
) {
// prevent initializing Docker if esbuild is no installed
// Docker is used for bundling if esbuild is not installed, but it is not needed at this point
const origCode =
'const shouldBuildImage=props.forceDockerBundling||!Bundling.esbuildInstallation;';
const replaceCode = 'const shouldBuildImage=false;';

if (contents.includes(origCode)) {
contents = contents.replace(origCode, replaceCode);
} else {
throw new Error(
`Can not find code to inject in ${args.path} to prevent initializing Docker`,
);
}
}

return {
Expand Down
Loading