Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

npm-watch

Package Overview
Dependencies
Maintainers
4
Versions
27
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

npm-watch - npm Package Compare versions

Comparing version 0.5.0 to 0.6.0

2

package.json
{
"name": "npm-watch",
"version": "0.5.0",
"version": "0.6.0",
"description": "run scripts from package.json when files change",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -30,4 +30,3 @@ # npm-watch

{
"watch":
{
"watch": {
"run_android": {

@@ -57,4 +56,3 @@ "patterns": [

The keys of the `"watch"` config should match the names of your `"scripts"`, and
The top level keys of the `"watch"` config should match the names of your `"scripts"`, and
the values should be a glob pattern or array of glob patterns to watch.

@@ -129,2 +127,70 @@

### Options
#### `patterns`
Array of paths to watch
#### `extensions`
Array of file extensions to watch
#### `ignore`
String or array of paths to ignore
#### `quiet`
Boolean to hide the script name in any output on stdout and stderr
#### `inherit`
Boolean to preserve the original process' stdout and stderr
#### `legacyWatch`
Boolean to enable [legacy watch](https://github.com/remy/nodemon#application-isnt-restarting)
#### `delay`
Number of milliseconds to [delay](https://github.com/remy/nodemon#delaying-restarting) before checking for new files
#### `clearBuffer`
Boolean to clear the buffer after detecting a new change
#### `verbose`
Boolean to turn on the nodemons verbose mode
#### `Ignore files`
Add an `ignore` property to your `watch` object. The value of `ignore` can be a string if you only want to ignore
a single glob:
```
"watch": {
"build": {
"ignore": "build",
...
}
...
}
```
Or an array if you want to ignore multiple globs:
```
"watch": {
"build": {
"ignore": [
"build",
"node_modules"
],
...
}
...
}
```
## Acknowledgements

@@ -131,0 +197,0 @@

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

var nodemon = process.platform === 'win32' ? 'nodemon.cmd' : 'nodemon';
var clearCharacter = process.platform === 'win32' ? '\x1B[2J\x1B[0f' : '\x1B[2J\x1B[3J\x1B[H';

@@ -98,3 +99,5 @@ var pkgDir = '';

var delay = null
var runOnChangeOnly = null
var clearBuffer = null
var verbose = null
var runOnChangeOnly = null

@@ -109,3 +112,5 @@ if (typeof pkg.watch[script] === 'object' && !Array.isArray(pkg.watch[script])) {

delay = pkg.watch[script].delay
runOnChangeOnly = pkg.watch[script].runOnChangeOnly
clearBuffer = pkg.watch[script].clearBuffer
verbose = pkg.watch[script].verbose
runOnChangeOnly = pkg.watch[script].runOnChangeOnly
} else {

@@ -134,4 +139,6 @@ patterns = pkg.watch[script]

if (delay) { args = args.concat(['--delay', delay + 'ms']) }
if (runOnChangeOnly) { args = args.concat(['--on-change-only']) }
if (verbose) { args = args.concat(['-V']) }
if (runOnChangeOnly) { args = args.concat(['--on-change-only']) }
args = args.concat(['--exec', exec])
var proc = processes[script] = spawn(nodemon, args, {

@@ -143,2 +150,15 @@ env: process.env,

if (inherit === true) return;
if (clearBuffer === true) {
proc.stdout.pipe(
through(function(line, _, callback) {
line = line.toString();
if (line.match('restarting due to changes...')) {
stdin.stdout.write(clearCharacter);
}
callback()
})
)
}
if (quiet === true || quiet === 'true') {

@@ -145,0 +165,0 @@ proc.stdout.pipe(stdin.stdout)

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