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

watchers

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

watchers - npm Package Compare versions

Comparing version 0.2.24 to 0.3.26

1

bin/watchers.js

@@ -5,4 +5,5 @@ #!/usr/bin/env node

var io = require('faye');
var portscanner = require('portscanner');
var argv = require('optimist').argv;
var lib = path.join(path.dirname(fs.realpathSync(__filename)), '../lib');
require(lib + '/main.js');

74

lib/watchers.js

@@ -6,9 +6,11 @@ //Ver: https://github.com/bevry/watchr

var megaServerTrans = null;
var megaServerIns = null;
var connectedIns = false;
var lastPort = null;
var Faye = require('faye');
var portscanner = require('portscanner');
var fs = require('fs');
var watch = require('./watch-k');
var fs = require('fs');
var serverDefaultChannel = "root";
var serverPort = 35729;
var pathChceker = require('fs');

@@ -19,22 +21,46 @@

exports.watchers = function(path2watch, ignore, only, watch_interval, inject, name){
console.log("\watchers v0.2.24");
console.log("\nwatchers v0.3.26");
addMegaServer({port:serverPort});
lastPort = serverPort;
lastPort++;
var watcherOptions =
{
path2watch:path2watch,
ignore:ignore,
only:only,
port:lastPort,
watch_interval:watch_interval,
inject:inject,
name:name
};
if (path2watch!==null){
setTimeout(function() {
addServerWatcher ({
path2watch:path2watch,
ignore:ignore,
only:only,
port:lastPort,
watch_interval:watch_interval,
inject:inject,
name:name
});
}, 50);
}
//VARS OPT
portscanner.findAPortNotInUse(serverPort, serverPort, 'localhost', function(error, portAvaiable) {
if (portAvaiable == serverPort){
addMegaServer({port:serverPort});
lastPort = serverPort + 1;
if (path2watch!==null){
setTimeout(function() {
addServerWatcher (watcherOptions);
}, 50);
}
}else{
/*MegaServer ya creado*/
if (path2watch!==null){
megaServerIns = new Faye.Client("http://localhost" + ':'+'35729'+'/' , {});
megaServerIns.subscribe('/'+ serverDefaultChannel, function(message) {
if (message.init) {
if (!connectedIns){
connectedIns = true;
console.log('\n[MegaServerConnected] ___________________');
megaServerIns.publish('/'+serverDefaultChannel+"toServer", {action:'createWatchers', options:watcherOptions});
}
}
});
megaServerIns.subscribe('/'+ serverDefaultChannel +"/serverCreatedOk", function(message) {
console.log('\n[Watcher ' + watcherOptions.name + ' , created sucessfully in other instance, bye!]');
process.exit(code=0);
});
}
}
});
};

@@ -48,2 +74,4 @@

if (megaServer !== null) return;
//VARS OPT

@@ -64,4 +92,6 @@ var port = options.port;

if (message === null) return;
console.log('\nMEGASERVER Get msg:');
console.log(message);
if (!true){
console.log('\nMEGASERVER Get msg:');
console.log(message);
}
if (message.action == 'Hi'){

@@ -103,3 +133,3 @@ console.log('Hi');

}
if (!pathChceker.existsSync(options.path2watch)){
if (!fs.existsSync(options.path2watch)){
if (megaServerTrans !=- null ){

@@ -106,0 +136,0 @@ megaServerTrans.publish('/'+serverDefaultChannel+"/serverCreatedError", {error:'path', errorTxt:'Please write a correct path', init:false, created:false});

{
"name": "watchers",
"version": "0.2.24",
"version": "0.3.26",
"description": "Watch file changes and refresh site in browser",

@@ -19,2 +19,3 @@ "main": "lib/main.js",

"optimist": "0.3.5",
"portscanner": "0.1.3",
"faye": "0.8.6"

@@ -21,0 +22,0 @@ },

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