common-questions
Advanced tools
Comparing version 0.2.3 to 0.2.4
32
index.js
@@ -95,2 +95,8 @@ /*! | ||
function store(app, prop) { | ||
var expanded = app.pkg.expand(); | ||
utils.merge(app.cache.data, expanded); | ||
var val = app.get(['cache.data', prop]); | ||
if (typeof val !== 'undefined') { | ||
return val; | ||
} | ||
if (app.store && typeof app.store.has === 'function' && app.store.has(prop)) { | ||
@@ -102,5 +108,16 @@ return app.store.get(prop); | ||
} | ||
return app.pkg.get(prop); | ||
} | ||
function getAuthor(app) { | ||
var author = app.cache.data.author; | ||
if (!utils.isObject(author)) { | ||
var expanded = app.pkg.expand(); | ||
var val = expanded.get('author'); | ||
if (utils.isObject(val)) { | ||
author = val; | ||
} | ||
} | ||
return author; | ||
} | ||
function projectName(app) { | ||
@@ -124,3 +141,2 @@ return app.get('cache.data.name') | ||
} | ||
return ''; | ||
} | ||
@@ -151,13 +167,10 @@ | ||
} | ||
return app.cache.data.owner; | ||
return app.get('cache.data.owner') || app.get('cache.data.author.username'); | ||
} | ||
function userIsOwner(app) { | ||
var author = app.cache.data.author; | ||
if (typeof author === 'undefined') { | ||
var username = app.get('cache.data.author.username'); | ||
if (typeof username === 'undefined') { | ||
return true; | ||
} | ||
if (author && typeof author === 'object') { | ||
author = author.url || author.username; | ||
} | ||
var config = utils.parse.sync({cwd: app.cwd}); | ||
@@ -170,4 +183,3 @@ if (!config || !config.user) { | ||
} | ||
var re = new RegExp(config.user.name, 'i'); | ||
return re.test(author); | ||
return username.indexOf(config.user.name) !== -1; | ||
} |
{ | ||
"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.2.3", | ||
"version": "0.2.4", | ||
"homepage": "https://github.com/generate/common-questions", | ||
@@ -24,6 +24,7 @@ "author": "Jon Schlinkert (https://github.com/jonschlinkert)", | ||
"dependencies": { | ||
"base-pkg": "^0.2.3", | ||
"base-pkg": "^0.2.4", | ||
"base-project": "^0.2.1", | ||
"base-questions": "^0.6.6", | ||
"is-valid-app": "^0.1.1", | ||
"isobject": "^2.1.0", | ||
"lazy-cache": "^2.0.1", | ||
@@ -30,0 +31,0 @@ "mixin-deep": "^1.1.3", |
@@ -14,2 +14,3 @@ 'use strict'; | ||
require('base-questions', 'questions'); | ||
require('isobject', 'isObject'); | ||
require('is-valid-app', 'isValid'); | ||
@@ -16,0 +17,0 @@ require('mixin-deep', 'merge'); |
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
7818
181
8
+ Addedisobject@^2.1.0
Updatedbase-pkg@^0.2.4