Skip to content

Commit

Permalink
chore: auto format some TypeScript files
Browse files Browse the repository at this point in the history
  • Loading branch information
lym953 committed Aug 29, 2024
1 parent e0b9c14 commit 46a3573
Show file tree
Hide file tree
Showing 10 changed files with 32 additions and 43 deletions.
2 changes: 1 addition & 1 deletion .projen/tasks.json

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

2 changes: 1 addition & 1 deletion .projenrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ const project = new awscdk.AwsCdkConstructLibrary({
"CONTRIBUTING.md",
],
scripts: {
"check-formatting": "prettier --check src/**",
"check-formatting": "prettier --check src/** integration_tests/**/*.ts examples/**/*.ts",
},
pullRequestTemplate: false,
dependabot: false,
Expand Down
48 changes: 19 additions & 29 deletions examples/typescript-stack/lib/cdk-typescript-stack.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,7 @@ export class CdkTypeScriptStack extends Stack {
code: lambda.Code.fromAsset("../lambda/node", {
bundling: {
image: lambda.Runtime.NODEJS_20_X.bundlingImage,
command: [
"bash",
"-c",
"cp -aT . /asset-output && npm install --prefix /asset-output",
],
command: ["bash", "-c", "cp -aT . /asset-output && npm install --prefix /asset-output"],
user: "root",
},
}),
Expand All @@ -38,11 +34,7 @@ export class CdkTypeScriptStack extends Stack {
code: lambda.Code.fromAsset("../lambda/python", {
bundling: {
image: lambda.Runtime.PYTHON_3_12.bundlingImage,
command: [
"bash",
"-c",
"pip install -r requirements.txt -t /asset-output && cp -aT . /asset-output",
],
command: ["bash", "-c", "pip install -r requirements.txt -t /asset-output && cp -aT . /asset-output"],
},
}),
handler: "hello.lambda_handler",
Expand All @@ -66,33 +58,31 @@ export class CdkTypeScriptStack extends Stack {
runtime: lambda.Runtime.DOTNET_8,
handler: "HelloWorld::HelloWorld.Handler::SayHi",
memorySize: 256,
code: lambda.Code.fromAsset('../lambda/dotnet/', {
code: lambda.Code.fromAsset("../lambda/dotnet/", {
bundling: {
image: lambda.Runtime.DOTNET_8.bundlingImage,
command: [
'/bin/sh',
'-c',
' dotnet tool install -g Amazon.Lambda.Tools' +
' && dotnet build' +
' && dotnet lambda package --output-package /asset-output/function.zip'
"/bin/sh",
"-c",
" dotnet tool install -g Amazon.Lambda.Tools" +
" && dotnet build" +
" && dotnet lambda package --output-package /asset-output/function.zip",
],
user: 'root',
outputType: BundlingOutput.ARCHIVED
}
})
})
user: "root",
outputType: BundlingOutput.ARCHIVED,
},
}),
});

const dotnetHttpIntegration = new HttpLambdaIntegration('GetDotnetIntegration', helloDotnet);
const dotnetHttpApi = new apigwv2.HttpApi(this, "dotnetHttpApi")
const dotnetHttpIntegration = new HttpLambdaIntegration("GetDotnetIntegration", helloDotnet);
const dotnetHttpApi = new apigwv2.HttpApi(this, "dotnetHttpApi");
dotnetHttpApi.addRoutes({
path: '/hello',
methods: [ apigwv2.HttpMethod.GET ],
integration: dotnetHttpIntegration
path: "/hello",
methods: [apigwv2.HttpMethod.GET],
integration: dotnetHttpIntegration,
});

console.log(
"Instrumenting Lambda Functions in TypeScript stack with Datadog"
);
console.log("Instrumenting Lambda Functions in TypeScript stack with Datadog");

const DatadogCDK = new Datadog(this, "Datadog", {
dotnetLayerVersion: 15,
Expand Down
3 changes: 1 addition & 2 deletions integration_tests/lambda/example-lambda.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
export const handler = (): void => {
return;
return;
};

4 changes: 2 additions & 2 deletions integration_tests/stacks/lambda-function-arm-stack.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
*/

import * as lambda from "aws-cdk-lib/aws-lambda";
import { Stack, StackProps, App } from "aws-cdk-lib"
import { Stack, StackProps, App } from "aws-cdk-lib";
import { LambdaRestApi, LogGroupLogDestination } from "aws-cdk-lib/aws-apigateway";
import { LogGroup } from "aws-cdk-lib/aws-logs";
import { Datadog } from "../../src/index";
Expand All @@ -21,7 +21,7 @@ export class ExampleStack extends Stack {
runtime: lambda.Runtime.NODEJS_14_X,
code: lambda.Code.fromInline("test"),
handler: "lambdaFunction.handler",
architecture: Architecture.ARM_64
architecture: Architecture.ARM_64,
});

const restLogGroup = new LogGroup(this, "restLogGroup");
Expand Down
4 changes: 2 additions & 2 deletions integration_tests/stacks/lambda-function-stack.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
*/

import * as lambda from "aws-cdk-lib/aws-lambda";
import { Stack, StackProps, App } from "aws-cdk-lib"
import { Stack, StackProps, App } from "aws-cdk-lib";
import { LambdaRestApi, LogGroupLogDestination } from "aws-cdk-lib/aws-apigateway";
import { LogGroup } from "aws-cdk-lib/aws-logs";
import { Datadog } from "../../src/index";
Expand All @@ -29,7 +29,7 @@ export class ExampleStack extends Stack {
accessLogDestination: new LogGroupLogDestination(restLogGroup),
},
});

const datadogCDK = new Datadog(this, "Datadog", {
nodeLayerVersion: 62,
extensionLayerVersion: 10,
Expand Down
2 changes: 1 addition & 1 deletion integration_tests/stacks/lambda-java-function-stack.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import * as lambda from "aws-cdk-lib/aws-lambda";
import { LambdaRestApi, LogGroupLogDestination } from "aws-cdk-lib/aws-apigateway";
import { LogGroup } from "aws-cdk-lib/aws-logs";
import { Stack, StackProps, App } from "aws-cdk-lib"
import { Stack, StackProps, App } from "aws-cdk-lib";
import { Datadog } from "../../src/index";

export class ExampleStack extends Stack {
Expand Down
2 changes: 1 addition & 1 deletion integration_tests/stacks/lambda-nodejs-function-stack.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import * as lambda from "aws-cdk-lib/aws-lambda";
import { NodejsFunction } from "aws-cdk-lib/aws-lambda-nodejs";
import { LambdaRestApi, LogGroupLogDestination } from "aws-cdk-lib/aws-apigateway";
import { LogGroup } from "aws-cdk-lib/aws-logs";
import { Stack, StackProps, App } from "aws-cdk-lib"
import { Stack, StackProps, App } from "aws-cdk-lib";
import { Datadog } from "../../src/index";

export class ExampleStack extends Stack {
Expand Down
2 changes: 1 addition & 1 deletion integration_tests/stacks/lambda-python-function-stack.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import * as lambda from "aws-cdk-lib/aws-lambda";
import { PythonFunction } from "@aws-cdk/aws-lambda-python-alpha";
import { LambdaRestApi, LogGroupLogDestination } from "aws-cdk-lib/aws-apigateway";
import { LogGroup } from "aws-cdk-lib/aws-logs";
import { Stack, StackProps, App } from "aws-cdk-lib"
import { Stack, StackProps, App } from "aws-cdk-lib";
import { Datadog } from "../../src/index";

export class ExampleStack extends Stack {
Expand Down
6 changes: 3 additions & 3 deletions integration_tests/stacks/lambda-singleton-function-stack.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
*/

import * as lambda from "aws-cdk-lib/aws-lambda";
import { Stack, StackProps, App } from "aws-cdk-lib"
import { Stack, StackProps, App } from "aws-cdk-lib";
import { LambdaRestApi, LogGroupLogDestination } from "aws-cdk-lib/aws-apigateway";
import { LogGroup } from "aws-cdk-lib/aws-logs";
import { Datadog } from "../../src/index";
Expand All @@ -20,7 +20,7 @@ export class ExampleStack extends Stack {
runtime: lambda.Runtime.NODEJS_14_X,
code: lambda.Code.fromInline("test"),
handler: "lambdaFunction.handler",
"uuid": "b55587fe-6985-4c28-ab51-4d0edb1ba8a1"
uuid: "b55587fe-6985-4c28-ab51-4d0edb1ba8a1",
});

const restLogGroup = new LogGroup(this, "restLogGroup");
Expand All @@ -30,7 +30,7 @@ export class ExampleStack extends Stack {
accessLogDestination: new LogGroupLogDestination(restLogGroup),
},
});

const datadogCDK = new Datadog(this, "Datadog", {
nodeLayerVersion: 62,
extensionLayerVersion: 10,
Expand Down

0 comments on commit 46a3573

Please sign in to comment.