New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

generator-util

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

generator-util - npm Package Compare versions

Comparing version 0.2.5 to 0.2.6

73

index.js

@@ -44,2 +44,21 @@ /*!

utils.prompt = function(app) {
app.define('prompt', function() {
if (app.enabled('init')) {
app.questions.enable('force');
}
var args = [].slice.call(arguments);
var cb = args.pop();
function callback(err, answers) {
if (err) return cb(err);
app.data(answers);
cb();
}
args.push(callback);
return app.ask.apply(this, args);
});
};
utils.src = function(app) {

@@ -58,19 +77,26 @@ var src = app.src;

utils.create = function(app) {
var create = app.create;
utils.create = function(options) {
return function fn(app) {
if (this.isRegistered('custom-create')) return;
if (!this.isApp) return;
var create = this.create;
app.define('create', function(name, options) {
var env = this.env || {};
var config = {renameKey: utils.renameKey, cwd: env.templates};
var opts = utils.extend(config, options);
var collection = this[name];
this.define('create', function(name, options) {
var env = this.env || {};
var cwd = env.templates || path.resolve(this.cwd, 'templates');
var config = { engine: '*', renameKey: utils.renameKey, cwd: cwd };
var createOpts = this.option(['create', name]);
var opts = utils.extend({}, config, createOpts, options);
if (typeof collection === 'undefined') {
collection = create.call(this, name, opts);
} else {
collection.option(opts);
}
var collection = this[name];
if (typeof collection === 'undefined') {
collection = create.call(this, name, opts);
} else {
collection.option(opts);
}
return collection;
});
return collection;
});
return fn;
};
};

@@ -166,2 +192,5 @@

var opts = utils.extend({}, options);
if (typeof opts.toFullname === 'function') {
return opts.toFullname(alias, opts);
}
var prefix = opts.prefix || opts.modulename;

@@ -182,2 +211,18 @@ if (typeof prefix === 'undefined') {

/**
* Returns true if (only) the `default` task is defined
*
* @param {Object} `opts`
* @return {Boolean}
*/
utils.isDefaultTask = function(obj) {
if (Array.isArray(obj)) {
return utils.isDefaultTask({tasks: obj});
}
return obj.tasks
&& obj.tasks.length === 1
&& obj.tasks[0] === 'default';
};
/**
* Create an object-path for looking up a generator.

@@ -184,0 +229,0 @@ *

2

package.json
{
"name": "generator-util",
"description": "Utils for `generate` generators.",
"version": "0.2.5",
"version": "0.2.6",
"homepage": "https://github.com/jonschlinkert/generator-util",

@@ -6,0 +6,0 @@ "author": "Jon Schlinkert (https://github.com/jonschlinkert)",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc