Skip to content

Commit

Permalink
fix dirname
Browse files Browse the repository at this point in the history
  • Loading branch information
jogold committed May 7, 2020
1 parent fb0504d commit 7dbef6f
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion packages/@aws-cdk/aws-lambda-nodejs/lib/builder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ export class Builder {
if (!pkgPath) {
throw new Error('Cannot find a `package.json` in this project.');
}
this.pkgPath = pkgPath;
this.pkgPath = path.join(pkgPath, 'package.json');
this.originalPkg = fs.readFileSync(this.pkgPath);
this.originalPkgJson = JSON.parse(this.originalPkg.toString());
}
Expand Down
2 changes: 1 addition & 1 deletion packages/@aws-cdk/aws-lambda-nodejs/lib/function.ts
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ export class NodejsFunction extends lambda.Function {
cacheDir: props.cacheDir,
nodeVersion: extractVersion(runtime),
nodeDockerTag: props.nodeDockerTag || `${process.versions.node}-alpine`,
projectRoot: path.dirname(path.resolve(projectRoot)),
projectRoot: path.resolve(projectRoot),
});
builder.build();

Expand Down
2 changes: 1 addition & 1 deletion packages/@aws-cdk/aws-lambda-nodejs/lib/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ function findClosestPathContaining(p: string): string | undefined {
for (const nodeModulesPath of module.paths) {
closestPath = path.join(path.dirname(nodeModulesPath), p);
if (fs.existsSync(closestPath)) {
break;
return path.dirname(nodeModulesPath);
}
}

Expand Down

0 comments on commit 7dbef6f

Please sign in to comment.