Skip to content

Conversation

@mrgrain
Copy link
Contributor

@mrgrain mrgrain commented Apr 3, 2025

Notices will eventually serve both toolkit-lib and cli. Currently the class has a hard-coded "cli version" - but really the value is reading the version from whatever the current package is. Once we start using this file in another package, it will be wrong. For now, let's just remove the hard dependency on cli version inside the class. In future it will be extended.

  • Remove direct dependency on versionNumber import in Notices class
  • Add cliVersion as a required parameter in NoticesProps interface
  • Store cliVersion as a class property and use it in display method
  • Improve testability by removing the need to mock version functions

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 April 3, 2025 19:47
@github-actions github-actions bot added the p2 label Apr 3, 2025
}
}

ioHelper = ioHelper ?? CliIoHost.instance().asIoHelper();
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 was left over. ioHelper is a required argument, so the second part never happens anyway

Copy link
Contributor

Choose a reason for hiding this comment

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

these functions look like they're copied from aws-cdk/cli/version.ts. do you mean to copy them over without deleting their duplicates in aws-cdk?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes, they will be removed eventually

@kaizencc
Copy link
Contributor

kaizencc commented Apr 3, 2025

Remove direct dependency on versionNumber import in Notices class

why?

Add cliVersion as a required parameter in NoticesProps interface

why?

Copy link
Contributor

@kaizencc kaizencc left a comment

Choose a reason for hiding this comment

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

approved but would like the PR description to be updated to explain why these changes are necessary

@mrgrain
Copy link
Contributor Author

mrgrain commented Apr 3, 2025

Remove direct dependency on versionNumber import in Notices class

why?

Add cliVersion as a required parameter in NoticesProps interface

why?

Notices will serve both toolkit-lib and cli. having a hard coded "cli version" that is actually reading the version from the current package will be wrong. In future this will be extended, for now I'm just removing the hard dependency.

@mrgrain mrgrain disabled auto-merge April 3, 2025 20:22
@mrgrain mrgrain force-pushed the mrgrain/notices/fix branch from 8eff2c5 to 5277d70 Compare April 3, 2025 21:27
`Notices` will eventually serve both toolkit-lib and cli. Currently the class has a hard-coded "cli version" - but really the value is reading the version from whatever the current package is. Once we start using this file in another package, it will be wrong. For now, let's just remove the hard dependency on cli version inside the class. In future it will be extended.

- Remove direct dependency on versionNumber import in Notices class
- Add cliVersion as a required parameter in NoticesProps interface
- Store cliVersion as a class property and use it in display method
- Improve testability by removing the need to mock version functions
@mrgrain mrgrain force-pushed the mrgrain/notices/fix branch from 5277d70 to 93728ce Compare April 3, 2025 21:40
@mrgrain mrgrain temporarily deployed to integ-approval April 3, 2025 21:40 — with GitHub Actions Inactive
@mrgrain mrgrain temporarily deployed to integ-approval April 3, 2025 21:50 — with GitHub Actions Inactive
@codecov-commenter
Copy link

Codecov Report

Attention: Patch coverage is 66.66667% with 14 lines in your changes missing coverage. Please review.

Project coverage is 86.91%. Comparing base (98c0c78) to head (556e524).

Files with missing lines Patch % Lines
...s-cdk/tmp-toolkit-helpers/src/util/package-info.ts 30.00% 14 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #323      +/-   ##
==========================================
+ Coverage   86.72%   86.91%   +0.18%     
==========================================
  Files         218      219       +1     
  Lines       35583    35609      +26     
  Branches     4347     4359      +12     
==========================================
+ Hits        30860    30948      +88     
+ Misses       4623     4566      -57     
+ Partials      100       95       -5     
Flag Coverage Δ
suite.unit 86.91% <66.66%> (+0.18%) ⬆️

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.

Merged via the queue into main with commit 78e3133 Apr 3, 2025
20 checks passed
@mrgrain mrgrain deleted the mrgrain/notices/fix branch April 3, 2025 23:10
mrgrain added a commit that referenced this pull request Apr 4, 2025
`Notices` will eventually serve both toolkit-lib and cli. Currently the
class has a hard-coded "cli version" - but really the value is reading
the version from whatever the current package is. Once we start using
this file in another package, it will be wrong. For now, let's just
remove the hard dependency on cli version inside the class. In future it
will be extended.

- Remove direct dependency on versionNumber import in Notices class
- Add cliVersion as a required parameter in NoticesProps interface
- Store cliVersion as a class property and use it in display method
- Improve testability by removing the need to mock version functions

---
By submitting this pull request, I confirm that my contribution is made
under the terms of the Apache-2.0 license
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants