Skip to content

Commit

Permalink
fix(bundling): enclosing metafile & tsconfig paths with quotes (aws#3…
Browse files Browse the repository at this point in the history
…2725)

### Issue # (if applicable)

No

### Reason for this change

Generating the metafile in a Windows environment can fail when the path are not enclosed with quotes.

### Description of changes

#### What code changes did you make? 

Enclosed paths the bundling arguments `--metafile` and `--tsconfig`

#### Have you made any important design decisions?
No

#### What AWS use cases does this change enable? To enable the use cases, which AWS service features are utilized?
Allows safe usage of `metafile` and `tsconfig` bundling options


### Describe any new or updated permissions being added

<!— What new or updated IAM permissions are needed to support the changes being introduced ? -->


### Description of how you validated changes

#### Have you added any unit tests and/or integration tests?
No, but when you have a project path with a whitespace, and use the `metafile` bundling argument, the metafile path should be passed correctly within quotes to esbuild.

I updated the existing tests.

### Checklist
- [x] My code adheres to the [CONTRIBUTING GUIDE](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and [DESIGN GUIDELINES](https://github.com/aws/aws-cdk/blob/main/docs/DESIGN_GUIDELINES.md)

----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
  • Loading branch information
aaarichter authored Jan 21, 2025
1 parent 4c42800 commit 5410e10
Show file tree
Hide file tree
Showing 13 changed files with 559 additions and 13 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { mult } from '../util';

export async function handler(): Promise<void> {
console.log(mult(3, 4)); // eslint-disable-line no-console
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,112 @@
"jshandlerbundlingpathServiceRole827F7127"
]
},
"jshandlertsconfigpathServiceRoleC592AD71": {
"Type": "AWS::IAM::Role",
"Properties": {
"AssumeRolePolicyDocument": {
"Statement": [
{
"Action": "sts:AssumeRole",
"Effect": "Allow",
"Principal": {
"Service": "lambda.amazonaws.com"
}
}
],
"Version": "2012-10-17"
},
"ManagedPolicyArns": [
{
"Fn::Join": [
"",
[
"arn:",
{
"Ref": "AWS::Partition"
},
":iam::aws:policy/service-role/AWSLambdaBasicExecutionRole"
]
]
}
]
}
},
"jshandlertsconfigpath74546CB1": {
"Type": "AWS::Lambda::Function",
"Properties": {
"Code": {
"S3Bucket": {
"Fn::Sub": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}"
},
"S3Key": "6c52cc5df44f0d18474ce4399377d62ee08c9b9cb11855fb95070dcd83a5a6ea.zip"
},
"Handler": "index.handler",
"Role": {
"Fn::GetAtt": [
"jshandlertsconfigpathServiceRoleC592AD71",
"Arn"
]
},
"Runtime": "nodejs18.x"
},
"DependsOn": [
"jshandlertsconfigpathServiceRoleC592AD71"
]
},
"tshandlermetafilepathServiceRoleECB676AC": {
"Type": "AWS::IAM::Role",
"Properties": {
"AssumeRolePolicyDocument": {
"Statement": [
{
"Action": "sts:AssumeRole",
"Effect": "Allow",
"Principal": {
"Service": "lambda.amazonaws.com"
}
}
],
"Version": "2012-10-17"
},
"ManagedPolicyArns": [
{
"Fn::Join": [
"",
[
"arn:",
{
"Ref": "AWS::Partition"
},
":iam::aws:policy/service-role/AWSLambdaBasicExecutionRole"
]
]
}
]
}
},
"tshandlermetafilepath3B73FC2C": {
"Type": "AWS::Lambda::Function",
"Properties": {
"Code": {
"S3Bucket": {
"Fn::Sub": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}"
},
"S3Key": "2853b22adf0b1929f5ccd54840d96d298c0ba574aa7a5bd02df65295244d1085.zip"
},
"Handler": "index.handler",
"Role": {
"Fn::GetAtt": [
"tshandlermetafilepathServiceRoleECB676AC",
"Arn"
]
},
"Runtime": "nodejs18.x"
},
"DependsOn": [
"tshandlermetafilepathServiceRoleECB676AC"
]
},
"Vpc8378EB38": {
"Type": "AWS::EC2::VPC",
"Properties": {
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 5410e10

Please sign in to comment.