Comparing version 0.0.7 to 0.0.9
{ | ||
"name": "remixd", | ||
"version": "0.0.7", | ||
"version": "0.0.9", | ||
"description": "remix server", | ||
@@ -5,0 +5,0 @@ "main": "./src/main.js", |
@@ -10,3 +10,3 @@ var servicesList = require('./servicesList') | ||
}) | ||
servicesList['systemfiles'].setupNotifications(this.websocket) | ||
servicesList['systemfiles'].setupNotifications(this.websocket, process.argv[2]) | ||
} | ||
@@ -13,0 +13,0 @@ |
@@ -7,6 +7,6 @@ var utils = require('../utils') | ||
module.exports = { | ||
monitors: [], | ||
filesContent: {}, | ||
list: function (args, cb) { | ||
console.log(utils.walkSync(process.argv[2])) | ||
cb(null, utils.walkSync(process.argv[2])) | ||
@@ -56,6 +56,13 @@ }, | ||
setupNotifications: function (websocket) { | ||
watch.createMonitor(process.argv[2], (monitor) => { | ||
setupNotifications: function (websocket, path) { | ||
watch.createMonitor(path, (monitor) => { | ||
this.monitors.push(monitor) | ||
monitor.on('created', (f, stat) => { | ||
if (websocket.connection) websocket.send(JSON.stringify({type: 'notification', scope: 'systemfiles', name: 'created', value: utils.relativePath(f)})) | ||
isbinaryfile(f, (error, isBinary) => { | ||
if (error) console.log(error) | ||
if (stat.isDirectory()) { | ||
this.setupNotifications(websocket, f) | ||
} | ||
if (websocket.connection) websocket.send(JSON.stringify({type: 'notification', scope: 'systemfiles', name: 'created', value: { path: utils.relativePath(f), isReadOnly: isBinary, isFolder: stat.isDirectory() }})) | ||
}) | ||
}) | ||
@@ -70,3 +77,3 @@ monitor.on('changed', (f, curr, prev) => { | ||
monitor.on('removed', (f, stat) => { | ||
if (websocket.connection) websocket.send(JSON.stringify({type: 'notification', scope: 'systemfiles', name: 'removed', value: utils.relativePath(f)})) | ||
if (websocket.connection) websocket.send(JSON.stringify({type: 'notification', scope: 'systemfiles', name: 'removed', value: { path: utils.relativePath(f), isFolder: stat.isDirectory() }})) | ||
}) | ||
@@ -73,0 +80,0 @@ }) |
@@ -16,4 +16,4 @@ #!/usr/bin/env node | ||
}) | ||
server.listen(8887, function () { | ||
console.log((new Date()) + ' Remixd is listening on port 8887') | ||
server.listen(65520, function () { | ||
console.log((new Date()) + ' Remixd is listening on port 65520') | ||
}) | ||
@@ -20,0 +20,0 @@ |
Sorry, the diff of this file is not supported yet
7021
200