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 2.0.0 to 2.1.0

58

cmd.js

@@ -9,29 +9,12 @@ #!/usr/bin/env node

var watch = ['!.git/**', '!node_modules/**', '!bower_components/**']
var ignores = ['!.git/**', '!node_modules/**', '!bower_components/**']
var extension = argv.e || argv.extension || ['js', 'html', 'css']
if (!Array.isArray(extension))
extension = [extension||'']
//if user passed globs, use those
var files = argv._.filter(Boolean)
if (files.length === 0) //otherwise wildcard w/ extensions
files = [ toExtension(extension) ]
//strip dots from extensions, split commas
extension = extension
.filter(Boolean)
.map(function(e) {
return e.split(',')
})
.reduce(function(a, b) {
return a.concat(b)
}, [])
.map(function(e) {
if (e.indexOf('.')===0)
return e.substring(1)
return e
})
var globs = ignores.concat(files)
//turn into a glob
var files = extension.length === 0
? ['**/*']
: ['**/*.{' + extension.join(',') + '}']
var glob = files.concat(watch)
argv.cwd = argv.dir || argv.d

@@ -45,3 +28,28 @@

wtch(glob, argv)
process.stdin.pipe(process.stdout)
wtch(globs, argv)
process.stdin.pipe(process.stdout)
function toExtension(extension) {
if (!Array.isArray(extension))
extension = [extension||'']
//strip dots from extensions, split commas
extension = extension
.filter(Boolean)
.map(function(e) {
return e.split(',')
})
.reduce(function(a, b) {
return a.concat(b)
}, [])
.map(function(e) {
if (e.indexOf('.')===0)
return e.substring(1)
return e
})
//turn into a glob
return extension.length === 0
? '**/*'
: '**/*.{' + extension.join(',') + '}'
}
{
"name": "wtch",
"version": "2.0.0",
"version": "2.1.0",
"description": "small livereload/watch command line utility",

@@ -27,6 +27,10 @@ "main": "index.js",

"tape": "^3.5.0",
"watchify": "^2.3.0",
"wzrd": "^1.2.1"
},
"scripts": {
"demo": "wzrd test/demo.js | wtch | garnish --level debug"
"demo": "wzrd test/demo.js | ./cmd.js | garnish --level debug",
"watcher": "watchify test/demo.js -o test/bundle.js --verbose",
"live": "./cmd.js test/bundle.js | garnish",
"incremental": "npm run watcher | npm run live"
},

@@ -33,0 +37,0 @@ "keywords": [

@@ -20,3 +20,3 @@ # wtch

See [examples](#examples) for use with browserify and other tools.
See [examples](#examples) for using with browserify, watchify, and other tools.

@@ -31,3 +31,3 @@ PRs/suggestions welcome.

Usage:
wtch [opts]
wtch [globs] [opts]

@@ -42,2 +42,8 @@ Options:

By default, it looks for `**/*` with the specified extensions. If `globs` is specified, they will *override* this behaviour. So you can do this to only watch a single file:
```
wtch bundle.js
```
## API

@@ -58,3 +64,3 @@

This can be used for live-reloading alongside [wzrd](https://github.com/maxogden/wzrd), [beefy](https://github.com/maxogden/beefy) and similar bundlers. For example:
This can be used for live-reloading alongside [wzrd](https://github.com/maxogden/wzrd), [beefy](https://github.com/maxogden/beefy) and similar development servers. For example:

@@ -65,2 +71,8 @@ ```sh

It can also be used to augment [watchify](https://github.com/maxogden/watchify) with a browser live-reload event. This is better suited for larger bundles.
```sh
watchify index.js -o bundle.js | wtch bundle.js
```
Or, even for a simple site with no JS content. The following example uses [http-server](https://www.npmjs.com/package/http-server) and listens for HTML/CSS changes in the current directory.

@@ -72,4 +84,6 @@

See this package.json's script field for examples.
## License
MIT, see [LICENSE.md](http://github.com/mattdesl/wtch/blob/master/LICENSE.md) for details.
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