-
Notifications
You must be signed in to change notification settings - Fork 12
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
chore(cli): show warning when using deprecated version #102
base: main
Are you sure you want to change the base?
Conversation
|
||
export async function checkIfDeprecated(version: string): Promise<string | null> { | ||
try { | ||
const { stdout, stderr } = await exec(`npm view aws-cdk@${version} deprecated --silent`, { timeout: 3000 }); |
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.
Can you work this into the existing version check in some way? (it may be that you will need to change that existing check to return information about more than 1 version at a time).
I'd like to avoid doing unnecessary calls to NPM.
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.
@rix0rrr
It's true that my implementation results in unnecessary NPM calls. But I couldn't find the logic of version check in existing source code. Which logic/file are you referring when you said work this into the existing version check
?
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.
We're doing upgrade notice work here already: https://github.com/aws/aws-cdk-cli/blob/huijbers/install-deps/packages/aws-cdk/lib/cli/version.ts/#L86
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.
@rix0rrr
Do you mean that calling checkIfDeprecated
out of if (laterVersion)
block is better?
Ref: https://github.com/aws/aws-cdk-cli/blob/main/packages/aws-cdk/lib/cli/version.ts#L125
try {
const laterVersion = await latestVersionIfHigher(currentVersion, versionCheckCache ?? new VersionCheckTTL());
+ const deprecationMessage = await checkIfDeprecated(currentVersion);
+ if (deprecationMessage) {
+ info(`You are using deprecated version(aws-cdk@${currentVersion}): ${deprecationMessage}`);
+ }
if (laterVersion) {
const versionMessage = await getVersionMessage(currentVersion, laterVersion);
Fixes aws/aws-cdk#298
What I changed
Show the warning message when Toolkit uses deprecated version of aws-cdk. The message is like below.
Additional information
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license