-
Notifications
You must be signed in to change notification settings - Fork 4k
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(cli): docs, doctor, context commands do not use configuration directly anymore #32578
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The pull request linter has failed. See the aws-cdk-automation comment below for failure reasons. If you believe this pull request should receive an exemption, please comment and provide a justification.
A comment requesting an exemption should contain the text Exemption Request
. Additionally, if clarification is needed add Clarification Request
to a comment.
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #32578 +/- ##
==========================================
+ Coverage 79.15% 80.41% +1.26%
==========================================
Files 107 106 -1
Lines 7139 6955 -184
Branches 1321 1288 -33
==========================================
- Hits 5651 5593 -58
+ Misses 1304 1183 -121
+ Partials 184 179 -5
Flags with carried forward coverage won't be shown. Click here to find out more.
|
➡️ PR build request submitted to A maintainer must now check the pipeline and add the |
@@ -373,9 +373,9 @@ export async function makeConfig(): Promise<CliConfig> { | |||
context: { | |||
description: 'Manage cached context values', | |||
options: { | |||
reset: { alias: 'e', desc: 'The context key (or its index) to reset', type: 'string', requiresArg: true }, | |||
reset: { alias: 'e', desc: 'The context key (or its index) to reset', type: 'string', requiresArg: true, default: undefined }, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Side note: we should probably change the codegen to always add an explicit default if none is provied.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
packages/aws-cdk/lib/settings.ts
Outdated
|
||
constructor(...bags: Settings[]) { | ||
this.bags = bags.length > 0 ? bags : [new Settings()]; | ||
constructor(...bags: ({name?: string; bag: Settings})[]) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
❓ Don't think I'm wild about this API... Why are names optional?
I think eventually Context
will be a public type and we need to revisit this API then.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
name is optional because one context bag we have comes from the CLI option, not a file. i should have called them filenames i guess
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Approved in principle with some minor comments for your consideration.
✅ Updated pull request passes all PRLinter validations. Dismissing previous PRLinter review.
@Mergifyio refresh |
✅ Pull request refreshed |
Thank you for contributing! Your pull request will be updated from main and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork). |
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
Thank you for contributing! Your pull request will be updated from main and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork). |
Comments on closed issues and PRs are hard for our team to see. |
This is a refactor that follows #32558. The effort is to ensure that the
configuration
object is not directly used by commands and instead, the relevant information is passed directly to the function.cdk.context.json
. this requires some modifications to theContext
object to support this.We move away from using the archaic API in
command-api.ts
. This seems to be an old effort to standardize CLI commands that was only used for doctor/docs/context. We have since evolved to use command-specific property bags.Since this is a refactor PR. I aim to change no functionality of the CLI.
Checklist
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license