Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(lambda): decompose methods for SAM sync/deploy/build #6014

Merged
merged 21 commits into from
Nov 20, 2024

Conversation

vicheey
Copy link
Contributor

@vicheey vicheey commented Nov 14, 2024

Problem

The sync.ts are huge consisting of many helper functions that being reused for deploy and build.

Solution

  • split shared methods into separate files for easier testing and maintenance
  • split sync.test.ts file into smaller file
  • consolidate paramsSourcePrompter for both sync and deploy to avoid duplicate code
  • update PrompterTester helper class to clean up VS Code UI element for early exit from consumer callback
  • rename paramsSource prompter title

License: I confirm that my contribution is made under the terms of the Apache 2.0 license.

@vicheey vicheey force-pushed the refactor-sam-sync-deploy-build branch from 570e036 to b2a3891 Compare November 14, 2024 06:04
@vicheey vicheey force-pushed the refactor-sam-sync-deploy-build branch from b2a3891 to 9c070de Compare November 14, 2024 08:39
@vicheey vicheey marked this pull request as ready for review November 14, 2024 09:36
@vicheey vicheey requested a review from a team as a code owner November 14, 2024 09:36
@@ -0,0 +1,61 @@
/*!
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moving wizards/prompters into shared/ui/sam/ is a good thought, thanks 👍

@justinmk3
Copy link
Contributor

Problem: The sync.ts are huge consisting of many helper functions that being reused for deploy and build.

This PR adds 800 lines though. Why?

packages/toolkit/package.json Outdated Show resolved Hide resolved
packages/core/src/test/shared/sam/sync.test.ts Outdated Show resolved Hide resolved
@vicheey
Copy link
Contributor Author

vicheey commented Nov 14, 2024

@justinmk3 : This PR adds 800 lines though. Why?

I think it's coming from the additional tests I added. These include tests for Build and some function in Utils that did not have any unit test.
Screenshot 2024-11-14 at 11 16 15

- add `Prompter` suffix to file name
- update all import following the renaming
@vicheey vicheey changed the title refactor(lambda): decompose common methods for SAM sync deploy build refactor(lambda): decompose methods for SAM sync deploy build Nov 14, 2024
Copy link
Member

@roger-zhangg roger-zhangg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Left few comments, thanks for implementing all these tests, they are super helpful

packages/core/src/test/shared/sam/utils.test.ts Outdated Show resolved Hide resolved
packages/core/src/test/shared/sam/utils.test.ts Outdated Show resolved Hide resolved
packages/core/src/test/shared/sam/utils.test.ts Outdated Show resolved Hide resolved
packages/core/src/test/shared/sam/utils.test.ts Outdated Show resolved Hide resolved
packages/core/src/shared/ui/sam/stackPrompter.ts Outdated Show resolved Hide resolved
packages/core/src/shared/sam/build.ts Outdated Show resolved Hide resolved
Copy link
Member

@roger-zhangg roger-zhangg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, action item to follow: use correct link in helper button in deploy template prompter. Currently is linking to sync help url.

@vicheey vicheey requested a review from hayemaxi November 19, 2024 22:02
@vicheey vicheey force-pushed the refactor-sam-sync-deploy-build branch from ec1ca94 to 17f5c3a Compare November 19, 2024 22:18
@vicheey vicheey changed the title refactor(lambda): decompose methods for SAM sync deploy build refactor(lambda): decompose methods for SAM sync/deploy/build Nov 19, 2024
@vicheey vicheey requested a review from hayemaxi November 19, 2024 23:26
@hayemaxi hayemaxi merged commit 85a46ce into aws:master Nov 20, 2024
22 of 25 checks passed
@vicheey vicheey deleted the refactor-sam-sync-deploy-build branch November 20, 2024 18:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants