Skip to content

Commit

Permalink
fix(lambda-nodejs): local tsc detection with pre compilation
Browse files Browse the repository at this point in the history
The package name is `typescript`, the bin is `tsc`.

Closes aws#19242
  • Loading branch information
jogold committed Mar 7, 2022
1 parent 7c3099e commit 79e509d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion packages/@aws-cdk/aws-lambda-nodejs/lib/bundling.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ export class Bundling implements cdk.BundlingOptions {
this.packageManager = PackageManager.fromLockFile(props.depsLockFilePath, props.logLevel);

Bundling.esbuildInstallation = Bundling.esbuildInstallation ?? PackageInstallation.detect('esbuild');
Bundling.tscInstallation = Bundling.tscInstallation ?? PackageInstallation.detect('tsc');
Bundling.tscInstallation = Bundling.tscInstallation ?? PackageInstallation.detect('typescript');

this.projectRoot = props.projectRoot;
this.relativeEntryPath = path.relative(this.projectRoot, path.resolve(props.entry));
Expand Down
3 changes: 3 additions & 0 deletions packages/@aws-cdk/aws-lambda-nodejs/test/bundling.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ beforeEach(() => {
jest.resetAllMocks();
jest.restoreAllMocks();
Bundling.clearEsbuildInstallationCache();
Bundling.clearTscInstallationCache();

jest.spyOn(Code, 'fromAsset');

Expand Down Expand Up @@ -602,6 +603,8 @@ test('esbuild bundling with pre compilations', () => {
],
}),
});

expect(detectPackageInstallationMock).toHaveBeenCalledWith('typescript');
});

test('throws with pre compilation and not found tsconfig', () => {
Expand Down

0 comments on commit 79e509d

Please sign in to comment.