DAVFoundation / dav-cli

πŸ’» Command line tool to ease developing with DAV
MIT License
21 stars 15 forks source link

Add update notification functionality #14

Closed TalAter closed 6 years ago

TalAter commented 6 years ago

Thank you for your help :heart:

What is this project?

DAV (Decentralized Autonomous Vehicles) is a new non-profit foundation working to build an open-source infrastructure for autonomous vehicles (cars, drones, trucks, robots, and all the service providers around them) to communicate and transact with each other over blockchain.

DAV CLI

The DAV CLI (command-line interface) tool makes developing applications and solutions that interact with DAV a much more pleasant experience. It allows developers to run fully functioning blockchains on their computer with one command, generate secure keys, and more.

How you can help

The Issue

The DAV CLI is usually installed globally on the user's machine. Since there is no good way for users to know when a new version is released, we would like to show them a message when they are using an old version of the CLI.

Luckily, there is a tool that enables this very easily πŸŽ‰ update-notifier.

Add the simple integration with update-notifier to the CLI's index.js file.

Contributing to DAV CLI

Asking for help

We appreciate your effort in taking the time to work on this issue and help out the open source community and the foundation. If you need any help, feel free to ask below or in our gitter channel. We are always happy to help πŸ˜„

koutron commented 6 years ago

would love to tackle this

TalAter commented 6 years ago

Go for it!

koutron commented 6 years ago

Got it working - Right now the updateNotifier function is sitting after all the require statements in the global scope of index.js. Is that appropriate? Should I create a program method for the notification? Here is the snippet below:


const updateNotifier = require('update-notifier');
const pkg = require('../package.json');

updateNotifier({ pkg }).notify();

program.on('--help', () => {
TalAter commented 6 years ago

I think placing it in an external file as you suggest might be more elegant.

koutron commented 6 years ago

Pull request added at https://github.com/DAVFoundation/dav-cli/pull/18