switch to native ipc to scale down on dependencies

This commit is contained in:
2016-09-28 23:46:28 +02:00
parent 65ab58f727
commit 5ce83601b4
24 changed files with 271 additions and 55 deletions

3
test/child.ts Normal file
View File

@ -0,0 +1,3 @@
import * as smartipc from '../dist/index'
let localChild = new smartipc.IpcChild({})

View File

@ -1,2 +0,0 @@
export * from './smartipc.classes.ipcserver'
export * from './smartipc.classes.ipcclient'

View File

@ -1,7 +0,0 @@
import * as plugins from './smartipc.plugins'
export calss IpcClient {
constructor() {
}
}

View File

@ -1,44 +0,0 @@
import * as plugins from './smartipc.plugins'
interface IIpcServeOptions {
appspace?: string
socketRoot?: string
id?: string
networkHost?: string //should resolve to 127.0.0.1 or ::1 see the table below related to this
networkPort?: number
encoding?: string
rawBuffer?: boolean
sync?: boolean
silent?: boolean
logInColor?: boolean
logDepth?: number
maxConnections?: number
retry?: number
maxRetries?: boolean
stopRetrying?: boolean
}
let defaultOptions: IIpcServeOptions = {
appspace: 'app.',
socketRoot: '/tmp/',
id: plugins.os.hostname(),
networkHost: 'localhost', //should resolve to 127.0.0.1 or ::1 see the table below related to this
networkPort: 8000,
encoding: 'utf8',
rawBuffer: false,
sync: false,
silent: false,
logInColor: true,
logDepth: 5,
maxConnections: 100,
retry: 500,
maxRetries: false,
stopRetrying: false
}
export class IpcServe {
ipcOptions: IIpcServeOptions
constructor(ipcOptionsArg: IIpcServeOptions) {
this.ipcOptions = plugins.lodash.merge({},defaultOptions,ipcOptionsArg)
}
}

View File

@ -1,5 +0,0 @@
import 'typings-global'
export import beautylog = require('beautylog')
export import lodash = require('lodash')
export let nodeIpc = require('node-ipc')
export import os = require('os')

1
test/test.d.ts vendored Normal file
View File

@ -0,0 +1 @@
import 'typings-test';

12
test/test.js Normal file
View File

@ -0,0 +1,12 @@
"use strict";
require("typings-test");
const should = require("should");
const smartipc = require("../dist/index");
let testIpcMaster;
describe('smartipc', function () {
it('should create an instance of IpcMaster', function () {
testIpcMaster = new smartipc.IpcMaster({});
should(testIpcMaster).be.instanceof(smartipc.IpcMaster);
});
});
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidGVzdC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbInRlc3QudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBLHdCQUFxQjtBQUNyQixpQ0FBZ0M7QUFFaEMsMENBQXlDO0FBRXpDLElBQUksYUFBaUMsQ0FBQTtBQUVyQyxRQUFRLENBQUMsVUFBVSxFQUFDO0lBQ2hCLEVBQUUsQ0FBQyx3Q0FBd0MsRUFBQztRQUN4QyxhQUFhLEdBQUcsSUFBSSxRQUFRLENBQUMsU0FBUyxDQUFDLEVBQUUsQ0FBQyxDQUFBO1FBQzFDLE1BQU0sQ0FBQyxhQUFhLENBQUMsQ0FBQyxFQUFFLENBQUMsVUFBVSxDQUFDLFFBQVEsQ0FBQyxTQUFTLENBQUMsQ0FBQTtJQUMzRCxDQUFDLENBQUMsQ0FBQTtBQUNOLENBQUMsQ0FBQyxDQUFBIn0=

13
test/test.ts Normal file
View File

@ -0,0 +1,13 @@
import 'typings-test'
import * as should from 'should'
import * as smartipc from '../dist/index'
let testIpcMaster: smartipc.IpcMaster
describe('smartipc',function(){
it('should create an instance of IpcMaster',function(){
testIpcMaster = new smartipc.IpcMaster({})
should(testIpcMaster).be.instanceof(smartipc.IpcMaster)
})
})