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

feat(toolkit): show when new version is available #2484

Merged
merged 4 commits into from
May 10, 2019
Merged

feat(toolkit): show when new version is available #2484

merged 4 commits into from
May 10, 2019

Conversation

nija-at
Copy link
Contributor

@nija-at nija-at commented May 6, 2019

Check, once a day, if a newer CDK version available in npm and announce
it's availability at the end of a significant command.

TESTING:

  • New unit tests for version.ts
  • Downgraded version number in package.json and verified that the
    expected message is printed.
  • Verified that the file cache throttles the check to run only once per
    day.

MANUAL VERIFICATION:

⇒  cdk init --list
Available templates:
* app: Template for a CDK Application
   └─ cdk init app --language=[csharp|fsharp|java|python|typescript]
* lib: Template for a CDK Construct Library
   └─ cdk init lib --language=typescript
* sample-app: Example CDK Application with some constructs
   └─ cdk init sample-app --language=[python|typescript]
**************************************************
*** Newer version of CDK is available [0.31.0] ***
*** Upgrade recommended                        ***
**************************************************

closes #297

Pull Request Checklist

  • Testing
    • Unit test added (prefer not to modify an existing test, otherwise, it's probably a breaking change)
    • CLI change?: coordinate update of integration tests with team
    • cdk-init template change?: coordinated update of integration tests with team
  • Title and Description
    • Change type: title prefixed with fix, feat and module name in parens, which will appear in changelog
    • Title: use lower-case and doesn't end with a period
    • Breaking?: last paragraph: "BREAKING CHANGE: <describe what changed + link for details>"
    • Issues: Indicate issues fixed via: "Fixes #xxx" or "Closes #xxx"
  • Docs
    • jsdocs: All public APIs documented
    • README: README and/or documentation topic updated
    • Design: For significant features, design document added to design folder

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

Niranjan Jayakar added 2 commits May 6, 2019 13:28
Switching version.ts from generated to version controlled so that it can
be expanded with more functions.
Check, once a day, if a newer CDK version available in npm and announce
it's availability at the end of a significant command.

TESTING:
* New unit tests for version.ts
* Downgraded version number in package.json and verified that the
  expected message is printed.
* Verified that the file cache throttles the check to run only once per
  day.

closes #297
@nija-at nija-at requested a review from a team as a code owner May 6, 2019 14:35
@rix0rrr
Copy link
Contributor

rix0rrr commented May 6, 2019

Could you give us some more context on what the change is and why you would like to apply it?

@nija-at
Copy link
Contributor Author

nija-at commented May 6, 2019

@rix0rrr -

(I've copied over the details on the commit message to the PR description as well)

I wanted to be notified when new CDK versions are available in npm directly through the CLI. Useful to check what the new release contains and upgrade if there fixes or features relevant to my app.

I saw that there already was an issue open for this - #297


// Export for unit testing only.
// Don't use directly, use displayVersionMessage() instead.
export async function latestVersionIfHigher(currentVersion: string, cacheFile: CacheFile): Promise<string | null> {
Copy link
Contributor

Choose a reason for hiding this comment

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

Don't export it if you don't want it to be used.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Any suggestions on how else I can (unit) test the logic here? Or would you rather not export and have no test?

packages/aws-cdk/lib/version.ts Outdated Show resolved Hide resolved
packages/aws-cdk/lib/version.ts Outdated Show resolved Hide resolved
packages/aws-cdk/lib/version.ts Outdated Show resolved Hide resolved
packages/aws-cdk/lib/version.ts Outdated Show resolved Hide resolved
packages/aws-cdk/lib/version.ts Show resolved Hide resolved
packages/aws-cdk/lib/version.ts Outdated Show resolved Hide resolved
packages/aws-cdk/lib/version.ts Outdated Show resolved Hide resolved
@rix0rrr rix0rrr changed the title New version announce feat(toolkit): show when new version is available May 7, 2019
Niranjan Jayakar added 2 commits May 8, 2019 17:53
* Dropped recommending the command for upgrade.
* Switch to use aws-cdk instead of cdk for npm package name.
* Closed leaking fd.
* Renamed CacheFile to TimestampFile.
* Dropped printing of stack trace in a 'warn' message.
Banner formatting to support variable sized string and recognizes colors
support. This allows for the banner to work correctly when the message
size changes.
@rix0rrr rix0rrr merged commit 6cf4bd3 into aws:master May 10, 2019
SanderKnape pushed a commit to SanderKnape/aws-cdk that referenced this pull request May 14, 2019
Check, once a day, if a newer CDK version available in npm and announce
it's availability at the end of a significant command.

TESTING:
* New unit tests for version.ts
* Downgraded version number in package.json and verified that the
  expected message is printed.
* Verified that the file cache throttles the check to run only once per
  day.

Closes aws#297
@NGL321 NGL321 added the contribution/core This is a PR that came from AWS. label Sep 27, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
contribution/core This is a PR that came from AWS.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Toolkit: announce availability of new version
3 participants