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

base-generators

Package Overview
Dependencies
Maintainers
1
Versions
43
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

base-generators - npm Package Compare versions

Comparing version 0.1.1 to 0.1.2

37

index.js

@@ -66,3 +66,3 @@ /*!

this.define('generator', function(name, fn) {
debug('generator: "%s"', name);
debug('registering generator: "%s"', name);
this.emit('generator', name);

@@ -126,3 +126,2 @@

var fn = this.alias.bind(this);
var names = name.split('.');

@@ -136,3 +135,3 @@ var app = this;

if (typeof app === 'undefined') {
app = this.base.generators.get(name);
app = this.base.generators.get(name, fn);
if (!app) break;

@@ -224,2 +223,6 @@ }

this.define('generate', function(name, tasks, cb) {
if (Array.isArray(name)) {
return this.generateEach(name, tasks);
}
var args = [].slice.call(arguments);

@@ -269,4 +272,4 @@ cb = args.pop();

var args = task.split(':').concat(next);
app.generate.apply(app, args);
}, cb);
this.generate.apply(this, args);
}.bind(this), cb);
});

@@ -300,10 +303,26 @@

function generatorError(err, app, name, cb) {
if (!/Invalid/.test(err.message)) {
return cb(err);
var match = /Invalid task `(.*?)`/.exec(err.message);
if (!match) return cb(err);
var taskName = match[1];
if (~name.indexOf(':')) {
var segs = name.split(':');
taskName = segs[1];
name = segs[0];
}
var msg = 'Cannot find generator or task: "' + name + '"';
var cwd = app.get('options.argv.cwd');
var msg = 'Cannot find ';
if (app.hasGenerator(name) && name !== taskName) {
msg += 'task: "' + taskName + '" in generator';
} else if (app.hasGenerator(name)) {
msg += 'task';
} else {
msg += 'generator';
}
msg += ': "' + name + '"';
var cwd = app.get('options.cwd');
if (cwd) msg += ' in "' + cwd + '/' + app.configfile + '"';
return cb(new Error(msg));
}

@@ -47,3 +47,5 @@ 'use strict';

parent = parent || base;
var generator;
if (util.isObject(fn) && fn.isGenerator) {

@@ -58,3 +60,3 @@ generator = fn;

generator.define('parent', parent || base);
generator.define('parent', parent);
generator.isGenerator = true;

@@ -64,2 +66,4 @@ generator.createEnv(name, base.options, fn);

generator.namespace = (parent.namespace ? parent.namespace + '.' : '') + alias;
Object.defineProperty(this, alias, {

@@ -66,0 +70,0 @@ configurable: true,

@@ -32,20 +32,21 @@ 'use strict';

if (!this.env) this.env = {};
var env = this.env;
this.env.alias = utils.toAlias(name, opts);
this.env.name = utils.toFullname(this.env.alias, {
env.alias = utils.toAlias(name, opts);
env.name = utils.toFullname(env.alias, {
prefix: this.modulename || 'generate'
});
this.name = this.env.alias;
this.name = env.alias;
debug('createEnv · name: "%s", alias: "%s"', name, this.env.alias);
debug('createEnv · name: "%s", alias: "%s"', env.name, env.alias);
if (typeof fn === 'string') {
this.env.path = this.resolve(fn);
env.path = this.resolve(fn);
if (typeof this.env.path === 'undefined') {
if (typeof env.path === 'undefined') {
throw new Error('cannot find generator: ' + fn);
}
Object.defineProperty(this.env, 'fn', {
Object.defineProperty(env, 'fn', {
configurable: true,

@@ -59,10 +60,10 @@ enumerable: true,

} else if (typeof fn === 'function') {
this.env.path = undefined;
this.env.fn = fn;
env.path = undefined;
env.fn = fn;
}
debug('created: %j', this.env);
return this.env;
debug('created: %j', env);
return env;
});
};
};

@@ -10,2 +10,10 @@ 'use strict';

/**
* Resolve generators and tasks to run
*
* @param {String|Array} `names` If names is an array, it must be task names, otherwise it can be a generator name or a task name.
* @param {String|Array} `tasks` one or more tasks to run.
* @return {Object} Returns an object with the `generator` to use and a `tasks` array.
*/
this.define('resolveTasks', function(names, tasks) {

@@ -23,3 +31,8 @@ var prop = this.stringifyTasks(names, tasks);

res.tasks = segs[1] ? segs[1].split(',') : ['default'];
} else if (this.hasGenerator('default')) {
var gen = this.getGenerator('default');
return gen.resolveTasks(names, tasks);
}
return res;

@@ -26,0 +39,0 @@ });

'use strict';
var path = require('path');
/**

@@ -11,9 +9,7 @@ * Module dependencies

var utils = require('lazy-cache')(require);
/* eslint-disable no-native-reassign */
var fn = require;
/* eslint-disable no-undef */
require = utils;
/**
* Lazily required module dependencies
* Utils
*/

@@ -20,0 +16,0 @@

{
"name": "base-generators",
"description": "Adds project-generator support to your `base` application.",
"version": "0.1.1",
"version": "0.1.2",
"homepage": "https://github.com/jonschlinkert/base-generators",

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

"base-cwd": "^0.1.1",
"base-tasks": "^0.2.0",
"base-tasks": "^0.3.0",
"debug": "^2.2.0",

@@ -38,2 +38,3 @@ "generator-util": "^0.1.1",

"composer-runtimes": "^0.7.0",
"generate-foo": "^0.1.1",
"gulp": "^3.9.0",

@@ -40,0 +41,0 @@ "gulp-eslint": "^1.1.1",

# base-generators [![NPM version](https://img.shields.io/npm/v/base-generators.svg)](https://www.npmjs.com/package/base-generators) [![Build Status](https://img.shields.io/travis/jonschlinkert/base-generators.svg)](https://travis-ci.org/jonschlinkert/base-generators)
> Add 'project generator' support to your `base` application.
> Adds project-generator support to your `base` application.

@@ -304,3 +304,3 @@ - [Install](#install)

### [.invoke](index.js#L153)
### [.invoke](index.js#L152)

@@ -320,3 +320,3 @@ Invoke the given generator in the context of the current instance.

### [.extendWith](index.js#L182)
### [.extendWith](index.js#L181)

@@ -341,3 +341,3 @@ Alias for `.invoke`, Extend the current generator instance with the settings of other generators.

### [.generate](index.js#L220)
### [.generate](index.js#L219)

@@ -380,3 +380,3 @@ Run a `generator` and `tasks`, calling the given `callback` function upon completion.

### [.generateEach](index.js#L254)
### [.generateEach](index.js#L257)

@@ -400,3 +400,3 @@ Iterate over an array of generators and tasks, calling [generate](#generate) on each.

### [.alias](index.js#L279)
### [.alias](index.js#L282)

@@ -484,3 +484,3 @@ Create a generator alias from the given `name`.

* [bach](https://www.npmjs.com/package/bach): Compose your async functions with elegance | [homepage](https://github.com/phated/bach)
* [bach](https://www.npmjs.com/package/bach): Compose your async functions with elegance | [homepage](https://github.com/gulpjs/bach#readme)
* [base](https://www.npmjs.com/package/base): base is the foundation for creating modular, unit testable and highly pluggable node.js applications, starting… [more](https://www.npmjs.com/package/base) | [homepage](https://github.com/node-base/base)

@@ -491,3 +491,3 @@ * [base-fs](https://www.npmjs.com/package/base-fs): base-methods plugin that adds vinyl-fs methods to your 'base' application for working with the file… [more](https://www.npmjs.com/package/base-fs) | [homepage](https://github.com/jonschlinkert/base-fs)

* [base-tasks](https://www.npmjs.com/package/base-tasks): base-methods plugin that provides a very thin wrapper around [https://github.com/jonschlinkert/composer](https://github.com/jonschlinkert/composer) for adding task methods to… [more](https://www.npmjs.com/package/base-tasks) | [homepage](https://github.com/jonschlinkert/base-tasks)
* [composer](https://www.npmjs.com/package/composer): API-first task runner with three methods: task, run and watch. | [homepage](https://github.com/jonschlinkert/composer)
* [composer](https://www.npmjs.com/package/composer): API-first task runner with three methods: task, run and watch. | [homepage](https://github.com/doowb/composer)
* [gulp](https://www.npmjs.com/package/gulp): The streaming build system | [homepage](http://gulpjs.com)

@@ -521,2 +521,2 @@

_This file was generated by [verb](https://github.com/verbose/verb) on January 28, 2016._
_This file was generated by [verb](https://github.com/verbose/verb) on January 29, 2016._
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