runner-generator-livereload
Advanced tools
Comparing version 1.1.1 to 2.0.0
34
index.js
@@ -8,3 +8,4 @@ /** | ||
var name = 'livereload', | ||
const | ||
name = 'livereload', | ||
log = require('runner-logger').wrap(name); | ||
@@ -14,5 +15,6 @@ | ||
function start ( config, done ) { | ||
var chokidar = require('chokidar'), | ||
const | ||
chokidar = require('chokidar'), | ||
server = require('tiny-lr')(), | ||
watcher; | ||
watcher = chokidar.watch(config.watch, config.watchOptions); | ||
@@ -36,3 +38,2 @@ function handler ( fileName ) { | ||
watcher = chokidar.watch(config.watch, config.watchOptions); | ||
watcher | ||
@@ -60,6 +61,9 @@ .on('change', handler) | ||
function generator ( config, options ) { | ||
var tasks = {}, | ||
instance; | ||
function generator ( config = {}, options = {} ) { | ||
const | ||
tasks = {}, | ||
{prefix = name + ':', suffix = ''} = options; | ||
let instance; | ||
// sanitize and extend defaults | ||
@@ -74,14 +78,13 @@ config = Object.assign({ | ||
} | ||
}, config || {}); | ||
options = Object.assign(generator.options, options || {}); | ||
}, config); | ||
tasks[options.prefix + 'config' + options.suffix] = function () { | ||
tasks[prefix + 'config' + suffix] = function () { | ||
log.inspect(config, log); | ||
}; | ||
tasks[options.prefix + 'start' + options.suffix] = function ( done ) { | ||
tasks[prefix + 'start' + suffix] = function ( done ) { | ||
instance = start(config, done); | ||
}; | ||
tasks[options.prefix + 'stop' + options.suffix] = function () { | ||
tasks[prefix + 'stop' + suffix] = function () { | ||
stop(instance); | ||
@@ -95,9 +98,2 @@ instance = null; | ||
// defaults | ||
generator.options = { | ||
prefix: name + ':', | ||
suffix: '' | ||
}; | ||
// export main actions | ||
@@ -104,0 +100,0 @@ generator.methods = { |
{ | ||
"name": "runner-generator-livereload", | ||
"version": "1.1.1", | ||
"version": "2.0.0", | ||
"description": "Tasks generator for LiveReload.", | ||
@@ -18,8 +18,8 @@ "author": { | ||
"dependencies": { | ||
"chokidar": "^2.0.4", | ||
"runner-logger": "^1.0.1", | ||
"chokidar": "^3.0.0", | ||
"runner-logger": "^2.0.0", | ||
"tiny-lr": "^1.1.1" | ||
}, | ||
"devDependencies": { | ||
"cjs-eslint": "^1.1.1" | ||
"cjs-eslint": "^1.2.4" | ||
}, | ||
@@ -26,0 +26,0 @@ "keywords": [ |
@@ -24,3 +24,3 @@ Tasks generator for LiveReload | ||
```js | ||
var generator = require('runner-generator-livereload'); | ||
const generator = require('runner-generator-livereload'); | ||
``` | ||
@@ -31,3 +31,3 @@ | ||
```js | ||
var tasks = generator({ | ||
const tasks = generator({ | ||
watch: [ | ||
@@ -43,3 +43,3 @@ 'build/develop/**/*', | ||
```js | ||
var runner = require('runner'); | ||
const runner = require('runner'); | ||
@@ -46,0 +46,0 @@ Object.assign(runner.tasks, tasks); |
5890
77
+ Addedanymatch@3.1.3(transitive)
+ Addedbinary-extensions@2.3.0(transitive)
+ Addedbraces@3.0.3(transitive)
+ Addedchokidar@3.6.0(transitive)
+ Addedfill-range@7.1.1(transitive)
+ Addedfsevents@2.3.3(transitive)
+ Addedglob-parent@5.1.2(transitive)
+ Addedis-binary-path@2.1.0(transitive)
+ Addedis-number@7.0.0(transitive)
+ Addedpicomatch@2.3.1(transitive)
+ Addedreaddirp@3.6.0(transitive)
+ Addedrunner-logger@2.0.0(transitive)
+ Addedsafe-buffer@5.2.1(transitive)
+ Addedto-regex-range@5.0.1(transitive)
- Removedanymatch@2.0.0(transitive)
- Removedarr-diff@4.0.0(transitive)
- Removedarr-flatten@1.1.0(transitive)
- Removedarr-union@3.1.0(transitive)
- Removedarray-unique@0.3.2(transitive)
- Removedassign-symbols@1.0.0(transitive)
- Removedasync-each@1.0.6(transitive)
- Removedatob@2.1.2(transitive)
- Removedbase@0.11.2(transitive)
- Removedbinary-extensions@1.13.1(transitive)
- Removedbindings@1.5.0(transitive)
- Removedbraces@2.3.2(transitive)
- Removedcache-base@1.0.1(transitive)
- Removedchokidar@2.1.8(transitive)
- Removedclass-utils@0.3.6(transitive)
- Removedcollection-visit@1.0.0(transitive)
- Removedcomponent-emitter@1.3.1(transitive)
- Removedcopy-descriptor@0.1.1(transitive)
- Removedcore-util-is@1.0.3(transitive)
- Removeddebug@2.6.9(transitive)
- Removeddecode-uri-component@0.2.2(transitive)
- Removeddefine-property@0.2.51.0.02.0.2(transitive)
- Removedexpand-brackets@2.1.4(transitive)
- Removedextend-shallow@2.0.13.0.2(transitive)
- Removedextglob@2.0.4(transitive)
- Removedfile-uri-to-path@1.0.0(transitive)
- Removedfill-range@4.0.0(transitive)
- Removedfor-in@1.0.2(transitive)
- Removedfragment-cache@0.2.1(transitive)
- Removedfsevents@1.2.13(transitive)
- Removedget-value@2.0.6(transitive)
- Removedglob-parent@3.1.0(transitive)
- Removedgraceful-fs@4.2.11(transitive)
- Removedhas-value@0.3.11.0.0(transitive)
- Removedhas-values@0.1.41.0.0(transitive)
- Removedinherits@2.0.4(transitive)
- Removedis-accessor-descriptor@1.0.1(transitive)
- Removedis-binary-path@1.0.1(transitive)
- Removedis-buffer@1.1.6(transitive)
- Removedis-data-descriptor@1.0.1(transitive)
- Removedis-descriptor@0.1.71.0.3(transitive)
- Removedis-extendable@0.1.11.0.1(transitive)
- Removedis-glob@3.1.0(transitive)
- Removedis-number@3.0.0(transitive)
- Removedis-plain-object@2.0.4(transitive)
- Removedis-windows@1.0.2(transitive)
- Removedisarray@1.0.0(transitive)
- Removedisobject@2.1.03.0.1(transitive)
- Removedkind-of@3.2.24.0.06.0.3(transitive)
- Removedmap-cache@0.2.2(transitive)
- Removedmap-visit@1.0.0(transitive)
- Removedmicromatch@3.1.10(transitive)
- Removedmixin-deep@1.3.2(transitive)
- Removedms@2.0.0(transitive)
- Removednan@2.22.0(transitive)
- Removednanomatch@1.2.13(transitive)
- Removednormalize-path@2.1.1(transitive)
- Removedobject-copy@0.1.0(transitive)
- Removedobject-visit@1.0.1(transitive)
- Removedobject.pick@1.3.0(transitive)
- Removedpascalcase@0.1.1(transitive)
- Removedpath-dirname@1.0.2(transitive)
- Removedpath-is-absolute@1.0.1(transitive)
- Removedposix-character-classes@0.1.1(transitive)
- Removedprocess-nextick-args@2.0.1(transitive)
- Removedreadable-stream@2.3.8(transitive)
- Removedreaddirp@2.2.1(transitive)
- Removedregex-not@1.0.2(transitive)
- Removedremove-trailing-separator@1.1.0(transitive)
- Removedrepeat-element@1.1.4(transitive)
- Removedrepeat-string@1.6.1(transitive)
- Removedresolve-url@0.2.1(transitive)
- Removedret@0.1.15(transitive)
- Removedrunner-logger@1.0.1(transitive)
- Removedsafe-buffer@5.1.2(transitive)
- Removedsafe-regex@1.1.0(transitive)
- Removedset-value@2.0.1(transitive)
- Removedsnapdragon@0.8.2(transitive)
- Removedsnapdragon-node@2.1.1(transitive)
- Removedsnapdragon-util@3.0.1(transitive)
- Removedsource-map@0.5.7(transitive)
- Removedsource-map-resolve@0.5.3(transitive)
- Removedsource-map-url@0.4.1(transitive)
- Removedsplit-string@3.1.0(transitive)
- Removedstatic-extend@0.1.2(transitive)
- Removedstring_decoder@1.1.1(transitive)
- Removedto-object-path@0.3.0(transitive)
- Removedto-regex@3.0.2(transitive)
- Removedto-regex-range@2.1.1(transitive)
- Removedunion-value@1.0.1(transitive)
- Removedunset-value@1.0.0(transitive)
- Removedupath@1.2.0(transitive)
- Removedurix@0.1.0(transitive)
- Removeduse@3.1.1(transitive)
- Removedutil-deprecate@1.0.2(transitive)
Updatedchokidar@^3.0.0
Updatedrunner-logger@^2.0.0