-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit c648f37
Showing
12 changed files
with
344 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
{ | ||
"env": { | ||
"es6": true, | ||
"node": true | ||
}, | ||
"extends": "eslint:recommended", | ||
"parserOptions": { | ||
"ecmaVersion": 2017 | ||
}, | ||
"rules": { | ||
"indent": [ | ||
"error", | ||
4 | ||
], | ||
"linebreak-style": [ | ||
"error", | ||
"windows" | ||
], | ||
"quotes": [ | ||
"error", | ||
"single" | ||
], | ||
"semi": [ | ||
"error", | ||
"always" | ||
], | ||
"no-console": "off", | ||
"no-unused-vars": "off" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# Node modules | ||
node_modules |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
{ | ||
// Use IntelliSense to learn about possible attributes. | ||
// Hover to view descriptions of existing attributes. | ||
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 | ||
"version": "0.2.0", | ||
"configurations": [ | ||
{ | ||
"type": "node", | ||
"request": "launch", | ||
"name": "Launch Program", | ||
"program": "${workspaceFolder}\\index.js" | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2018 Vladimir Jovanović | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
# Node.js Checker | ||
|
||
Every time you log in, Windows will start a background process to check wether a new version of Node.js has been published. If there is a version newer than the one installed on your machine, it will display a notification with a small description where it shows the latest tag version from official Node GitHub repository. | ||
|
||
# Install | ||
|
||
```bash | ||
npm i -g node-checker | ||
``` | ||
|
||
# Contribute | ||
|
||
PR's are welcome. If you want to contribute, push the code to the **dev** branch. | ||
|
||
# Licence | ||
|
||
MIT License | ||
|
||
Copyright (c) 2018 Vladimir Jovanović | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
const WindowsToaster = require('node-notifier').WindowsToaster, | ||
opn = require('opn'); | ||
|
||
// Create notification | ||
/** | ||
* Creates a toast notification on the desktop | ||
* @param {string} latest Latest Node.js version from GitHub releases. | ||
* This only shows the notification if there is a version greater than | ||
* the one that is installed on your machine. | ||
*/ | ||
var Notify = latest => { | ||
let notifier = new WindowsToaster({ | ||
withFallback: true | ||
}); | ||
|
||
notifier.notify({ | ||
title: 'New Node.js version is available', | ||
message: `Version tag: ${latest}\nClick on the notification to download`, | ||
icon: './icons/app.png', | ||
wait: true | ||
}, (err, res) => { | ||
if (err) console.error(err); | ||
}); | ||
|
||
notifier.on('click', () => { | ||
opn(`https://nodejs.org/dist/${latest}/node-${latest}-${process.arch}.msi`); | ||
}); | ||
|
||
return this; | ||
}; | ||
|
||
module.exports = Notify; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
const os = require('os'), | ||
AutoLaunch = require('auto-launch'); | ||
|
||
// Create start up entry | ||
let NodeJSChecker = new AutoLaunch({ | ||
name: 'Node.js Checker', | ||
path: `${os.homedir()}\\AppData\\Roaming\\npm\\node_modules\\node-checker\\launch.bat` | ||
}); | ||
|
||
// Enable the entry | ||
NodeJSChecker.enable(); |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
// Imports | ||
const fetch = require('node-fetch'), | ||
Notify = require('./components/notify'); | ||
|
||
// Create a start up entry | ||
require('./components/startup'); | ||
|
||
// Get the latest version | ||
(async () => { | ||
try { | ||
// Get the data | ||
let res = await fetch('https://api.github.com/repos/nodejs/node/releases/latest', { | ||
headers: { | ||
'User-Agent': 'VladimirDev93', | ||
'Content-Type': 'application/json' | ||
} | ||
}); | ||
// Put the data | ||
let data = await res.json(); | ||
// Get the latest version by tag | ||
let latest = data.tag_name; | ||
// Current Node.js version on the machine | ||
let current = process.version; | ||
|
||
// Show the notificaion | ||
if (latest > current) | ||
Notify(latest); | ||
|
||
} catch (error) { | ||
console.error(error); | ||
} | ||
})(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
cd %AppData%\npm\node_modules\node-checker | ||
node index |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
{ | ||
"name": "node-checker", | ||
"productName": "Node.js Checker", | ||
"version": "1.0.0", | ||
"description": "Check if there is a newer version of Node.js than the one that is installed on the machine.", | ||
"main": "index.js", | ||
"scripts": { | ||
"start": "node index" | ||
}, | ||
"author": "Vladimir Jovanović", | ||
"license": "MIT", | ||
"dependencies": { | ||
"auto-launch": "^5.0.5", | ||
"node-fetch": "^2.2.0", | ||
"node-notifier": "^5.2.1", | ||
"opn": "^5.3.0" | ||
} | ||
} |