famous-cli
Advanced tools
Comparing version 0.1.4 to 0.2.0
@@ -70,3 +70,3 @@ #!/usr/bin/env node | ||
storage.getGlobal(function(error, config){ | ||
if (config.tracking) metrics.track('cli-event', {'command_data': program.args.slice(0, program.args.length - 1).join(" ")}, function(){}); | ||
if (config.tracking) metrics.track(process.argv[2]); | ||
}); | ||
@@ -73,0 +73,0 @@ |
@@ -7,3 +7,14 @@ 'use strict'; | ||
var ver = require('latest-version'); | ||
var async = require('async'); | ||
var inquirer = require('inquirer'); | ||
var metrics = require('./metrics/mixpanel.js'); | ||
var storage = require('../res/sdk-bundle.js').storage; | ||
var trackingPrompt = { | ||
type: 'confirm', | ||
name: 'tracking', | ||
message: "May famous anonymously report usage statistics to improve the tool over time?" | ||
}; | ||
/** | ||
@@ -15,11 +26,36 @@ * autoupdate | ||
*/ | ||
function checkTracking(callback) { | ||
async.waterfall([ | ||
storage.getGlobal, | ||
function (config, done) { | ||
if (config.tracking !== undefined) { | ||
return done('already answered'); | ||
} | ||
return inquirer.prompt(trackingPrompt, function (answers) { | ||
return metrics.setTracking(answers.tracking, done) | ||
}); | ||
} | ||
], function (err) { | ||
if (err === 'already answered') return callback(null); | ||
return callback(err); | ||
}); | ||
} | ||
var autoupdate = function (callback) { | ||
var current = pkg.version; | ||
ver('famous-cli', function(err, version) { | ||
if (current < version) { | ||
console.log(chalk.bold('Famous'), 'CLI version', current, 'is out of date.', 'Updating to', version); | ||
return update(callback); | ||
} | ||
return callback(); | ||
checkTracking(function (err) { | ||
if (err) return callback(err); | ||
ver('famous-cli', function(err, version) { | ||
if (current < version) { | ||
console.log(chalk.bold('Famous'), 'CLI version', current, 'is out of date.', 'Updating to', version); | ||
return update(callback); | ||
} | ||
return callback(); | ||
}); | ||
}); | ||
@@ -26,0 +62,0 @@ }; |
'use strict'; | ||
var mixpanelId = 'aa236a2f825da1074e3fca5ccac621e2'; | ||
var mixpanelId = 'ba222c5ac04034fb6ba2fbd89b6c1f79'; | ||
var mixpanel = require('mixpanel').init(mixpanelId); | ||
@@ -33,2 +33,10 @@ var storage = require('../../res/sdk-bundle.js').storage; | ||
exports.track = function track(event, data, cb) { | ||
if (typeof cb !== 'function') { | ||
cb = function () {}; | ||
} | ||
if (data === undefined) { | ||
data = {}; | ||
} | ||
var config = storage.getGlobal(function(error, config) { | ||
@@ -44,3 +52,3 @@ if (data instanceof Function) { | ||
data.node_version = process.version; | ||
data.famous_version = pjson.version; | ||
data.cli_version = pjson.version; | ||
data.distinct_id = config.mixpanel_id; | ||
@@ -47,0 +55,0 @@ mixpanel.track(event, data, cb); |
@@ -39,11 +39,5 @@ 'use strict'; | ||
name: 'eula', | ||
message: "View the Famous Cloud Services EULA at 'https://assets-st.famo.us/eula', do you accept" | ||
message: "View the Famous Cloud Services TOS at 'http://famous.org/terms.html', do you accept" | ||
}; | ||
var trackingPrompt = { | ||
type: 'confirm', | ||
name: 'tracking', | ||
message: "May famous anonymously report usage statistics to improve the tool over time?" | ||
}; | ||
var loginPrompt = { | ||
@@ -57,3 +51,3 @@ type: 'confirm', | ||
function(callback){ | ||
inquirer.prompt([emailPrompt, usernamePrompt, passPrompt, trackingPrompt, eulaPrompt], function(answers) { | ||
inquirer.prompt([emailPrompt, usernamePrompt, passPrompt, eulaPrompt], function(answers) { | ||
if (!answers.eula) { | ||
@@ -60,0 +54,0 @@ console.log(chalk.bold.red('You must agree to the eula to register with Hub')); |
{ | ||
"name": "famous-cli", | ||
"version": "0.1.4", | ||
"version": "0.2.0", | ||
"description": "CLI interface for Famous Industries Web Services", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -10,3 +10,3 @@ # famous-cli | ||
$ npm install -g famous | ||
$ npm install -g famous-cli | ||
@@ -13,0 +13,0 @@ executing `$ famous` will display the default help string |
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
83744
1262
7
42