Skip to content

Commit 726a3be

Browse files
chore: cleanup custom resource handler files (#30887)
This PR cleans up the files created in a temp folder when the custom resource handlers are generated. While using a temp folder removes these files on restart, most people aren't typically in the habit of regular restarts. We are now in a position where running our integ tests and/or unit tests will cause my machine to run out of space. This is one of several PRs to fix this. This may seem like a tiny change to PR on it's own when I've just said that there will be several, but I'm intentionally keeping them small and separate. There is some behavior in our tests that I don't quite understand so small incremental change will help isolate this better. There are no tests to add here but I have run the entire test suite locally from a clean workspace after making this change. ### Checklist - [ ] 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*
1 parent bbf1ad4 commit 726a3be

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

packages/aws-cdk-lib/core/lib/custom-resource-provider/custom-resource-provider-base.ts

+2
Original file line numberDiff line numberDiff line change
@@ -251,6 +251,8 @@ export abstract class CustomResourceProviderBase extends Construct {
251251

252252
this._codeHash = staging.assetHash;
253253

254+
fs.rmSync(stagingDirectory, { recursive: true, force: true });
255+
254256
return {
255257
code: {
256258
S3Bucket: asset.bucketName,

packages/aws-cdk-lib/core/test/custom-resource-provider/custom-resource-provider.test.ts

-2
Original file line numberDiff line numberDiff line change
@@ -184,8 +184,6 @@ describe('custom resource provider', () => {
184184
const keyParam = paramNames[1];
185185
const hashParam = paramNames[2];
186186

187-
expect(fs.existsSync(path.join(sourcePath, '__entrypoint__.js'))).toEqual(true);
188-
189187
expect(cfn).toEqual({
190188
Resources: {
191189
CustomMyResourceTypeCustomResourceProviderRoleBD5E655F: {

0 commit comments

Comments
 (0)