Skip to content

refactor(cli): make the cli use more shared code #207

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

Merged
merged 1 commit into from
Mar 7, 2025

Conversation

mrgrain
Copy link
Contributor

@mrgrain mrgrain commented Mar 7, 2025

Removes duplicated interfaces.

I know this is messy. Please bear with me 🙈


By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license

@aws-cdk-automation aws-cdk-automation requested a review from a team March 7, 2025 11:55
@github-actions github-actions bot added the p2 label Mar 7, 2025
@@ -725,6 +725,8 @@ tmpToolkitHelpers.eslint?.addRules({
'@typescript-eslint/consistent-type-imports': 'error',
});

tmpToolkitHelpers.gitignore.addPatterns('test/**/*.map');
Copy link
Contributor Author

Choose a reason for hiding this comment

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

No idea how this file got there in the first place. But it won't anymore in future.

@@ -184,7 +184,7 @@ export const EVENT_TO_LEVEL: Record<EventType, IoMessageLevel | false> = {

export abstract class BasePublishProgressListener implements IPublishProgressListener {
protected readonly ioHost: IIoHost;
protected readonly action: ToolkitAction;
protected readonly action: IoMessaging['action'];
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Plan is to not have the action here but to have an ActionAwareIoHost. See importer.ts as an example. Eventually we will just be passing ActionAwareIoHost hosts around.

@@ -102,17 +103,15 @@ export class ResourceImporter {

private readonly stack: cxapi.CloudFormationStackArtifact;
private readonly cfn: Deployments;
private readonly ioHost: IIoHost;
private readonly action: ToolkitAction;
private readonly ioHost: ActionAwareIoHost;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is the future!


constructor(
stack: cxapi.CloudFormationStackArtifact,
props: ResourceImporterProps,
) {
this.stack = stack;
this.cfn = props.deployments;
this.ioHost = props.ioHost;
this.action = props.action;
this.ioHost = withAction(props.ioHost, props.action as any);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Almost the future. Eventually this class should just get an ActionAwareIoHost in the first place.

@@ -78,7 +78,7 @@ export async function exec(args: string[], synthesizer?: Synthesizer): Promise<n
debug(`Error while checking for platform warnings: ${e}`);
}

debug('CDK toolkit version:', version.displayVersion());
debug('CDK Toolkit CLI version:', version.displayVersion());
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Just cause.

@codecov-commenter
Copy link

codecov-commenter commented Mar 7, 2025

Codecov Report

Attention: Patch coverage is 88.70968% with 7 lines in your changes missing coverage. Please review.

Project coverage is 85.12%. Comparing base (ef550a0) to head (979c0d5).

Files with missing lines Patch % Lines
...ckages/aws-cdk/lib/api/resource-import/importer.ts 60.00% 6 Missing ⚠️
packages/aws-cdk/lib/toolkit/cli-io-host.ts 95.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #207      +/-   ##
==========================================
- Coverage   85.27%   85.12%   -0.16%     
==========================================
  Files         207      208       +1     
  Lines       35837    35775      -62     
  Branches     4656     4645      -11     
==========================================
- Hits        30559    30452     -107     
- Misses       5120     5171      +51     
+ Partials      158      152       -6     
Flag Coverage Δ
suite.unit 85.12% <88.70%> (-0.16%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@mrgrain mrgrain force-pushed the mrgrain/refactor/cli-uses-shared-code branch from 4bbfb9d to 979c0d5 Compare March 7, 2025 14:47
@mrgrain mrgrain temporarily deployed to integ-approval March 7, 2025 14:47 — with GitHub Actions Inactive
@mrgrain mrgrain enabled auto-merge March 7, 2025 14:53
@mrgrain mrgrain added the pr/exempt-integ-test Skips the integ test steps if set. label Mar 7, 2025
@mrgrain mrgrain closed this Mar 7, 2025
auto-merge was automatically disabled March 7, 2025 16:05

Pull request was closed

@mrgrain mrgrain reopened this Mar 7, 2025
@mrgrain
Copy link
Contributor Author

mrgrain commented Mar 7, 2025

Added pr/exempt-integ-test because an unrelated test is broken.

@aws-cdk-automation aws-cdk-automation added this pull request to the merge queue Mar 7, 2025
Merged via the queue into main with commit db6aa96 Mar 7, 2025
33 of 35 checks passed
@aws-cdk-automation aws-cdk-automation deleted the mrgrain/refactor/cli-uses-shared-code branch March 7, 2025 16:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
p2 pr/exempt-integ-test Skips the integ test steps if set.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants