-
Notifications
You must be signed in to change notification settings - Fork 885
Use update-notifier to notify of new versions #990 #1696
Conversation
Thanks for your interest in palantir/tslint, @davieschoots! Before we can accept your pull request, you need to sign our contributor license agreement - just visit https://cla.palantir.com/ and follow the instructions. Once you sign, I'll automatically update this pull request. |
Nice. This may not work well with apps that consume tslint via a special formatter. For example, if the JSON formatter was used, the output would become invalid. Can you make the check only occur with prose output format? |
Hi @nchen63, sure no problem. I've moved and pushed the change and think this is what you wanted. |
it looks like update-notifier asks users to install using -g, but the running tslint may not be a global install |
Yes, there is a default option message which we can override. I'm happy to add this if you want. What would be your suggestion as text or do you think it's not desirable just to get rid of the -g? |
I'd prefer to point people to the change log since there may be breaking changes that require more than doing an npm install. Also, I have a concern about whether this will work in Windows since I saw unix type commands in the referenced libraries |
also one of the files is missing the license header |
Sorry, I'll copy the license header and update the new file. About the message, we could do something like below; I don't think it won't work on windows, but will definitely test it to see if it works. Also I can remove the require for package.json, then use tslint as a fixed name value and get the version from Linter.VERSION instead of using it from the package. |
not working in windows is a deal breaker |
Yes, it sure is. I'm setting up a test right now :) |
Hi @nchen63 , I've did a test on windows 10 on cmd and powershell and it looks good. |
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 use the text:
TSLint update available vX.Y.Z → vA.B.C
See https://github.com/palantir/tslint/blob/master/CHANGELOG.md
the url should be updated to a better place like https://palantir.github.io/tslint/ eventually, but we don't have our change log in the docs
@@ -0,0 +1,17 @@ | |||
/** | |||
* Need to disable the warning, because importing of the package is needed. |
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 need this comment
@@ -0,0 +1,17 @@ | |||
/** |
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.
add license header
Works fine if TSLint is launched like |
*/ | ||
|
||
// tslint:disable-next-line:no-var-requires | ||
const updateNotifier = require("update-notifier"); |
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.
Looks like this string and rest of the file after it have redundant 1 space indentation.
I've added all the changes:
I'll still want to do some final testing on windows (tonight or in the morning) |
@nchen63 I tested it on windows in powershell, cmd and git bash. This is my first PR in a large codebase and I want to thank you for your patience! @IllusionMH Thanks for testing and the review! |
very nice. Thanks for the contribution. Happy to help. |
PR checklist
What changes did you make?
I've added the functionality of the update-notifier to have it display the update message when there is a new tslint version available.
The functionality is inside a new file called 'updateNotifier.ts', to keep it separate and because I need to require the plugin as well as the package.json. The new function is implemented via the cli.
Is there anything you'd like reviewers to focus on?
Do you think implementing the function call at this level is correct?
My reasons for placing it here is because it then runs every time. The interval for checking a new version is set to three days (default is once a day).
I've tested it by setting the 'updateCheckInterval' to 0 and by lowering the version inside the package.json to '3.15.0', so it would trigger the check.
This triggers the image below:
