parent
6ccf99926f
commit
ea9783dba6
@ -0,0 +1,6 @@ |
||||
#!/usr/bin/env node |
||||
declare const Router: any; |
||||
declare const servicesList: any; |
||||
declare const program: any; |
||||
declare const killCallBack: Array<Function>; |
||||
declare function kill(): void; |
@ -0,0 +1,44 @@ |
||||
#!/usr/bin/env node
|
||||
"use strict"; |
||||
var Router = require('../src/router'); |
||||
var servicesList = require('../src/servicesList'); |
||||
var program = require('commander'); |
||||
program |
||||
.usage('-s <shared folder>') |
||||
.description('Provide a two-way connection between the local computer and Remix IDE') |
||||
.option('--remix-ide <url>', 'URL of remix instance allowed to connect to this web sockect connection') |
||||
.option('-s, --shared-folder <path>', 'Folder to share with Remix IDE') |
||||
.option('--read-only', 'Treat shared folder as read-only (experimental)') |
||||
.on('--help', function () { |
||||
console.log('\nExample:\n\n remixd -s ./ --remix-ide http://localhost:8080'); |
||||
}).parse(process.argv); |
||||
var killCallBack = []; |
||||
if (!program.remixIde) { |
||||
console.log('\x1b[31m%s\x1b[0m', '[ERR] URL Remix IDE instance has to be provided.'); |
||||
} |
||||
console.log('\x1b[33m%s\x1b[0m', '[WARN] You may now only use IDE at ' + program.remixIde + ' to connect to that instance'); |
||||
if (program.sharedFolder) { |
||||
console.log('\x1b[33m%s\x1b[0m', '[WARN] Any application that runs on your computer can potentially read from and write to all files in the directory.'); |
||||
console.log('\x1b[33m%s\x1b[0m', '[WARN] Symbolic links are not forwarded to Remix IDE\n'); |
||||
var sharedFolderrouter = new Router(65520, servicesList['sharedfolder'], { remixIdeUrl: program.remixIde }, function (webSocket) { |
||||
servicesList['sharedfolder'].setWebSocket(webSocket); |
||||
servicesList['sharedfolder'].setupNotifications(program.sharedFolder); |
||||
servicesList['sharedfolder'].sharedFolder(program.sharedFolder, program.readOnly || false); |
||||
// buildWebsocketClient(webSocket.connection, new servicesList['sharedfolder']())
|
||||
}); |
||||
killCallBack.push(sharedFolderrouter.start()); |
||||
} |
||||
// kill
|
||||
function kill() { |
||||
for (var k in killCallBack) { |
||||
try { |
||||
killCallBack[k](); |
||||
} |
||||
catch (e) { |
||||
console.log(e); |
||||
} |
||||
} |
||||
} |
||||
process.on('SIGINT', kill); // catch ctrl-c
|
||||
process.on('SIGTERM', kill); // catch kill
|
||||
process.on('exit', kill); |
@ -0,0 +1,5 @@ |
||||
{ |
||||
"watch": ["./src"], |
||||
"ext": "ts", |
||||
"exec": "npm run build" |
||||
} |
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,15 @@ |
||||
{ |
||||
"compilerOptions": { |
||||
/* Basic Options */ |
||||
"target": "es5", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017','ES2018' or 'ESNEXT'. */ |
||||
"module": "commonjs", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */ |
||||
"declaration": true, /* Generates corresponding '.d.ts' file. */ |
||||
"outDir": "./lib", |
||||
"strict": true, /* Enable all strict type-checking options. */ |
||||
"strictPropertyInitialization": false, /* Enable strict checking of property initialization in classes. */ |
||||
/* Experimental Options */ |
||||
"experimentalDecorators": true, /* Enables experimental support for ES7 decorators. */ |
||||
"emitDecoratorMetadata": true, /* Enables experimental support for emitting type metadata for decorators. */ |
||||
}, |
||||
"exclude": ["./lib"] |
||||
} |
Loading…
Reference in new issue