common-questions
Advanced tools
Comparing version 0.3.5 to 0.4.0
'use strict'; | ||
var utils = require('./utils'); | ||
var hints; | ||
var hints = {}; | ||
@@ -11,3 +11,2 @@ module.exports = function(app, options) { | ||
hints = {project: {}, author: {}}; | ||
if (disableHints(app, options)) { | ||
@@ -22,40 +21,50 @@ return hints; | ||
hints.license = 'MIT'; | ||
var answers = {}; | ||
utils.set(hints, 'name', function() { | ||
return utils.getProjectName(app); | ||
return (answers.name = utils.getProjectName(app)); | ||
}); | ||
utils.set(hints, 'alias', function() { | ||
return utils.getProjectAlias(app, hints.name); | ||
return (answers.alias = utils.getProjectAlias(app, hints.name)); | ||
}); | ||
utils.set(hints, 'owner', function() { | ||
return utils.getProjectOwner(app); | ||
return (answers.owner = utils.getProjectOwner(app)); | ||
}); | ||
utils.set(hints, 'description', function() { | ||
return app.pkg.get('description'); | ||
return (answers.description = app.pkg.get('description')); | ||
}); | ||
utils.set(hints, 'homepage', function() { | ||
var owner = answers.owner || answers['author.username']; | ||
var name = answers.name; | ||
if (owner && name) { | ||
return (answers.homepage = `https://github.com/${owner}/${name}`); | ||
} | ||
}); | ||
utils.set(hints, 'version', function() { | ||
return app.pkg.get('version') || '0.1.0'; | ||
return (answers.version = (app.pkg.get('version') || '0.1.0')); | ||
}); | ||
utils.set(hints, 'author.username', function() { | ||
return get(app, 'author.username', false); | ||
return (answers['author.username'] = (get(app, 'author.username') || answers.owner)); | ||
}); | ||
utils.set(hints, 'author.twitter', function() { | ||
return get(app, 'author.twitter', false); | ||
return (answers['author.twitter'] = (get(app, 'author.twitter') || answers.username)); | ||
}); | ||
utils.set(hints, 'author.email', function() { | ||
return get(app, 'author.email'); | ||
return (answers['author.email'] = get(app, 'author.email')); | ||
}); | ||
utils.set(hints, 'author.name', function() { | ||
return get(app, 'author.name'); | ||
return (answers['author.name'] = get(app, 'author.name')); | ||
}); | ||
utils.set(hints, 'author.url', function() { | ||
return get(app, 'author.url'); | ||
return (answers['author.url'] = get(app, 'author.url')); | ||
}); | ||
@@ -83,4 +92,2 @@ return hints; | ||
app.questions.hints.data = {}; | ||
app.data.del(key); | ||
app.pkg.del(key); | ||
delete question.default; | ||
@@ -87,0 +94,0 @@ } |
@@ -13,13 +13,7 @@ | ||
if (typeof val === 'undefined') { | ||
if (typeof val === 'undefined' && typeof app.common !== 'undefined') { | ||
var data = hints(app, options); | ||
val = data[key] || app.common.get(key); | ||
question.answer = data[key] || app.common.get(key); | ||
} | ||
if (typeof val !== 'undefined' && typeof question.setAnswer === 'function') { | ||
question.default = val; | ||
app.questions.answers[key] = val; | ||
question.setAnswer(val); | ||
} | ||
}); | ||
}; |
{ | ||
"name": "common-questions", | ||
"description": "An object of questions commonly used by project generators or when initializing projects. Questions can be overridden, updated or extended.", | ||
"version": "0.3.5", | ||
"version": "0.4.0", | ||
"homepage": "https://github.com/generate/common-questions", | ||
@@ -28,3 +28,3 @@ "author": "Jon Schlinkert (https://github.com/jonschlinkert)", | ||
"base-project": "^0.2.1", | ||
"base-questions": "^0.7.1", | ||
"base-questions": "^0.7.4", | ||
"camel-case": "^3.0.0", | ||
@@ -41,6 +41,6 @@ "common-config": "^0.1.0", | ||
"devDependencies": { | ||
"ask-when": "^0.1.1", | ||
"ask-when": "^0.1.4", | ||
"base": "^0.11.1", | ||
"gulp-format-md": "^0.1.9", | ||
"mocha": "^2.5.3" | ||
"gulp-format-md": "^0.1.10", | ||
"mocha": "^3.0.2" | ||
}, | ||
@@ -47,0 +47,0 @@ "keywords": [ |
@@ -107,2 +107,2 @@ # common-questions [![NPM version](https://img.shields.io/npm/v/common-questions.svg?style=flat)](https://www.npmjs.com/package/common-questions) [![NPM downloads](https://img.shields.io/npm/dm/common-questions.svg?style=flat)](https://npmjs.org/package/common-questions) [![Build Status](https://img.shields.io/travis/generate/common-questions.svg?style=flat)](https://travis-ci.org/generate/common-questions) | ||
_This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.1.28, on July 31, 2016._ | ||
_This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.1.30, on August 16, 2016._ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
16149
Updatedbase-questions@^0.7.4