Skip to content

Commit 79310a5

Browse files
fix: CDK paths and add tests
1 parent 118bd7e commit 79310a5

File tree

4 files changed

+10
-3
lines changed

4 files changed

+10
-3
lines changed

src/frameworks/cdkFramework.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -401,6 +401,7 @@ export class CdkFramework implements IFramework {
401401
awsCdkLibPath,
402402
projectDirname: getProjectDirname(),
403403
moduleDirname: getModuleDirname(),
404+
subfolder: config.subfolder,
404405
},
405406
},
406407
);

src/frameworks/cdkFrameworkWorker.mjs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,11 @@ import { Logger } from "../logger.mjs";
1010

1111
Logger.setVerbose(workerData.verbose);
1212
// eslint-disable-next-line @typescript-eslint/no-unused-vars
13-
const __dirname = path.resolve(path.join(workerData.projectDirname, "/x/x"));
13+
const __dirname = path.resolve(
14+
path.join(
15+
...[workerData.projectDirname, workerData.subfolder, "x"].filter((p) => p),
16+
),
17+
);
1418

1519
Logger.verbose(`[CDK] [Worker] Started`);
1620

test/cdk-basic/lib/cdk-basic-stack.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { Construct } from "constructs";
33
import * as lambda_nodejs from "aws-cdk-lib/aws-lambda-nodejs";
44
import * as lambda from "aws-cdk-lib/aws-lambda";
55
import * as log from "aws-cdk-lib/aws-logs";
6+
import * as path from "path";
67

78
export class CdkbasicStack extends cdk.Stack {
89
constructor(scope: Construct, id: string, props?: cdk.StackProps) {
@@ -12,7 +13,8 @@ export class CdkbasicStack extends cdk.Stack {
1213
this,
1314
"TestTsCommonJs",
1415
{
15-
entry: "services/testTsCommonJs/lambda.ts",
16+
// a different way to get the path
17+
entry: path.join(__dirname, "../services/testTsCommonJs/lambda.ts"),
1618
handler: "lambdaHandler",
1719
runtime: lambda.Runtime.NODEJS_20_X,
1820
logRetention: log.RetentionDays.ONE_DAY,

test/cdk-basic/tsconfig.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
"inlineSources": true,
1818
"experimentalDecorators": true,
1919
"strictPropertyInitialization": false,
20-
"typeRoots": ["./node_modules/@types"]
20+
"typeRoots": ["../../node_modules/@types"]
2121
},
2222
"exclude": ["node_modules", "cdk.out"]
2323
}

0 commit comments

Comments
 (0)