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

wtch

Package Overview
Dependencies
Maintainers
1
Versions
22
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

wtch - npm Package Compare versions

Comparing version 1.0.3 to 1.1.0

46

index.js
var through2 = require('through2')
var xtend = require('xtend')
var tinylr = require('tiny-lr')
var gaze = require('gaze')
var watch = require('chokidar').watch
var noop = function(){}

@@ -15,10 +16,15 @@

opt = xtend({
port: 35729,
event: 'changed'
event: 'change'
}, opt)
if (opt.event === 'changed') //backwards compatible with v1
opt.event = 'change'
var out = through2()
var server = tinylr()
if (opt.poll)
opt.usePolling = true
server.listen(opt.port, 'localhost', function(a) {

@@ -30,16 +36,28 @@ console.log(JSON.stringify({

}))
var watcher = watch(glob, opt)
gaze(glob, opt, function(err, watcher) {
this.on(opt.event, function(filepath) {
try {
server.changed({ body: { files: [ filepath ] } })
} catch (e) {
throw e
}
})
cb(err)
cb = noop
})
watcher.on(opt.event, opt.event === 'all'
? reload
: reload.bind(null, 'change'))
cb()
cb = noop
})
function reload(event, path) {
if (opt.verbose) {
console.log(JSON.stringify({
time:new Date(),
level: 'info',
type: event,
url: path
}))
}
try {
server.changed({ body: { files: [ path ] } })
} catch (e) {
throw e
}
}
var emitter = server.server

@@ -46,0 +64,0 @@ emitter.removeAllListeners('error')

{
"name": "wtch",
"version": "1.0.3",
"version": "1.1.0",
"description": "small livereload/watch command line utility",

@@ -16,3 +16,3 @@ "main": "index.js",

"dependencies": {
"gaze": "^0.6.4",
"chokidar": "^1.0.0-rc3",
"minimist": "^1.1.0",

@@ -37,3 +37,2 @@ "through2": "^0.6.3",

"server",
"gaze",
"livereload",

@@ -40,0 +39,0 @@ "live",

@@ -5,3 +5,3 @@ # wtch

A small command-line app that watches for file changes and triggers a live-reload on file save. Watches the current working directory for `js,html,css` file changes. ignores `.git` folder, `node_modules` and `bower_components`.
A small command-line app that watches for file changes and triggers a live-reload on file save (to be used with the LiveReload plugin). Watches the current working directory for `js,html,css` file changes. Ignores `.git`, `node_modules` and `bower_components` folders.

@@ -40,3 +40,6 @@ ```sh

--extension -e specifies an extension or a comma-separated list (default js,css,html)
--event the type of event to watch, "all" or "change" (default "change")
--port -p the port to run livereload (defaults to 35729)
--verbose log the file changes as well
--poll enable polling for file watching
```

@@ -50,7 +53,9 @@

Options:
Supported options:
- `cwd` the current working directory for gaze
- `event` the type of event for gaze, such as `"all"` or `"changed"` (defaults to changed)
- `cwd` the current working directory for chokidar
- `poll` whether to use polling, default false
- `event` the type of event to watch, can be `"change"` (default, only file save) or `"all"` (remove/delete/etc)
- `port` the port for livereload, defaults to 35729
- `verbose` to log file changes

@@ -57,0 +62,0 @@ ## License

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