generator-util
Advanced tools
Comparing version 0.2.8 to 0.2.9
@@ -65,3 +65,3 @@ /*! | ||
this.define('create', function(name, options) { | ||
var env = this.env || {}; | ||
var opts = utils.extend({}, options); | ||
var cwd = opts.cwd ? path.resolve(opts.cwd) : this.cwd; | ||
@@ -73,3 +73,3 @@ if (!opts.cwd && utils.exists(path.resolve(cwd, 'templates'))) { | ||
var createOpts = this.option(['create', name]); | ||
var opts = utils.extend({}, config, createOpts, options); | ||
opts = utils.extend({}, config, createOpts, opts); | ||
@@ -76,0 +76,0 @@ var collection = this[name]; |
{ | ||
"name": "generator-util", | ||
"description": "Utils for `generate` generators.", | ||
"version": "0.2.8", | ||
"version": "0.2.9", | ||
"homepage": "https://github.com/jonschlinkert/generator-util", | ||
@@ -41,3 +41,3 @@ "author": "Jon Schlinkert (https://github.com/jonschlinkert)", | ||
"gulp-mocha": "^2.2.0", | ||
"mocha": "^2.4.5", | ||
"mocha": "*", | ||
"spawn-commands": "^0.3.1" | ||
@@ -57,2 +57,11 @@ }, | ||
"verb": { | ||
"run": true, | ||
"toc": false, | ||
"layout": "default", | ||
"tasks": [ | ||
"readme" | ||
], | ||
"plugins": [ | ||
"gulp-format-md" | ||
], | ||
"related": { | ||
@@ -69,7 +78,9 @@ "list": [ | ||
}, | ||
"toc": true, | ||
"layout": "default", | ||
"plugins": [ | ||
"gulp-format-md" | ||
] | ||
"reflinks": [ | ||
"templates", | ||
"verb" | ||
], | ||
"lint": { | ||
"reflinks": true | ||
} | ||
}, | ||
@@ -76,0 +87,0 @@ "lintDeps": { |
@@ -5,2 +5,4 @@ # generator-util [](https://www.npmjs.com/package/generator-util) [](https://travis-ci.org/jonschlinkert/generator-util) | ||
## TOC | ||
- [Install](#install) | ||
@@ -10,8 +12,9 @@ - [Usage](#usage) | ||
- [Related projects](#related-projects) | ||
- [Contributing](#contributing) | ||
- [Building docs](#building-docs) | ||
- [Running tests](#running-tests) | ||
- [Contributing](#contributing) | ||
- [Author](#author) | ||
- [License](#license) | ||
_(TOC generated by [verb](https://github.com/verbose/verb))_ | ||
_(TOC generated by [verb](https://github.com/verbose/verb) using [markdown-toc](https://github.com/jonschlinkert/markdown-toc))_ | ||
@@ -23,3 +26,3 @@ ## Install | ||
```sh | ||
$ npm i generator-util --save | ||
$ npm install generator-util --save | ||
``` | ||
@@ -35,5 +38,5 @@ | ||
### [.exists](index.js#L91) | ||
### [.homeRelative](index.js#L99) | ||
Return true if a filepath exists on the file system. | ||
Return a home-relative filepath | ||
@@ -43,3 +46,3 @@ **Params** | ||
* `filepath` **{String}** | ||
* `returns` **{Boolean}** | ||
* `returns` **{String}** | ||
@@ -49,11 +52,17 @@ **Example** | ||
```js | ||
utils.exists('foo'); | ||
//=> false | ||
utils.exists('gulpfile.js'); | ||
//=> true | ||
utils.homeRelative('foo'); | ||
//=> 'dev/foo' | ||
``` | ||
### [.renameKey](index.js#L108) | ||
### [.isDirectory](index.js#L120) | ||
Return true if a filepath exists and is a directory. | ||
**Params** | ||
* `filepath` **{String}** | ||
* `returns` **{Boolean}** | ||
### [.renameKey](index.js#L133) | ||
Rename the `key` used for storing views/templates | ||
@@ -64,6 +73,6 @@ | ||
* `key` **{String}** | ||
* `view` **{Object}**: the `renameKey` method is used by [templates][] for both setting and getting templates. When setting, `view` is exposed as the second parameter. | ||
* `view` **{Object}**: the `renameKey` method is used by [templates](https://github.com/jonschlinkert/templates) for both setting and getting templates. When setting, `view` is exposed as the second parameter. | ||
* `returns` **{String}** | ||
### [.toAlias](index.js#L132) | ||
### [.toAlias](index.js#L157) | ||
@@ -88,3 +97,3 @@ Opposite of `.toFullname`, creates an "alias" from the given `name` by either stripping `options.prefix` from the name, or just removing everything up to the first dash. If `options.alias` is a function, it will be used instead. | ||
### [.toFullname](index.js#L162) | ||
### [.toFullname](index.js#L187) | ||
@@ -109,3 +118,3 @@ Opposite of `.toAlias`, creates a generator name from the given `alias` and `namespace`. | ||
### [.toGeneratorPath](index.js#L190) | ||
### [.toGeneratorPath](index.js#L234) | ||
@@ -126,3 +135,3 @@ Create an object-path for looking up a generator. | ||
### [.getGenerator](index.js#L212) | ||
### [.getGenerator](index.js#L256) | ||
@@ -137,3 +146,3 @@ Get a generator from `app`. | ||
### [.tryResolve](index.js#L255) | ||
### [.tryResolve](index.js#L299) | ||
@@ -160,3 +169,3 @@ Try to `require.resolve` module `name`, first locally then in the globaly npm directory. Fails silently if not found. | ||
### [.tryRequire](index.js#L287) | ||
### [.tryRequire](index.js#L341) | ||
@@ -176,3 +185,3 @@ Try to require the given module, failing silently if it doesn't exist. The function first calls `require` on the given `name`, then tries `require(path.resolve(name))` before giving up. | ||
### [.tableize](index.js#L321) | ||
### [.tableize](index.js#L376) | ||
@@ -188,3 +197,3 @@ Modified from the `tableize` lib, which replaces | ||
### [.isFunction](index.js#L376) | ||
### [.isFunction](index.js#L431) | ||
@@ -208,3 +217,3 @@ Returns true if the given `value` is a function. | ||
### [.isBoolean](index.js#L396) | ||
### [.isBoolean](index.js#L451) | ||
@@ -228,3 +237,3 @@ Returns true if the given `value` is a boolean. | ||
### [.isString](index.js#L416) | ||
### [.isString](index.js#L471) | ||
@@ -248,3 +257,3 @@ Returns true if a the given `value` is a string. | ||
### [.isObject](index.js#L436) | ||
### [.isObject](index.js#L491) | ||
@@ -268,3 +277,3 @@ Returns true if a the given `value` is an object. | ||
### [.arrayify](index.js#L455) | ||
### [.arrayify](index.js#L510) | ||
@@ -293,3 +302,3 @@ Cast the given `value` to an array. | ||
* [base-pipeline](https://www.npmjs.com/package/base-pipeline): base-methods plugin that adds pipeline and plugin methods for dynamically composing streaming plugin pipelines. | [homepage](https://github.com/jonschlinkert/base-pipeline) | ||
* [base-plugins](https://www.npmjs.com/package/base-plugins): Upgrade's plugin support in base-methods to allow plugins to be called any time after init. | [homepage](https://github.com/jonschlinkert/base-plugins) | ||
* [base-plugins](https://www.npmjs.com/package/base-plugins): Upgrade's plugin support in base applications to allow plugins to be called any time after… [more](https://www.npmjs.com/package/base-plugins) | [homepage](https://github.com/jonschlinkert/base-plugins) | ||
* [base-runner](https://www.npmjs.com/package/base-runner): Orchestrate multiple instances of base-methods at once. | [homepage](https://github.com/jonschlinkert/base-runner) | ||
@@ -299,2 +308,20 @@ * [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) | ||
## Contributing | ||
Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](https://github.com/jonschlinkert/generator-util/issues/new). | ||
## Building docs | ||
Generate readme and API documentation with [verb](https://github.com/verbose/verb): | ||
```sh | ||
$ npm install verb && npm run docs | ||
``` | ||
Or, if [verb](https://github.com/verbose/verb) is installed globally: | ||
```sh | ||
$ verb | ||
``` | ||
## Running tests | ||
@@ -305,9 +332,5 @@ | ||
```sh | ||
$ npm i -d && npm test | ||
$ npm install -d && npm test | ||
``` | ||
## Contributing | ||
Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](https://github.com/jonschlinkert/generator-util/issues/new). | ||
## Author | ||
@@ -327,2 +350,2 @@ | ||
_This file was generated by [verb](https://github.com/verbose/verb), v0.9.0, on February 06, 2016._ | ||
_This file was generated by [verb](https://github.com/verbose/verb), v0.9.0, on March 04, 2016._ |
24438
329