upgrade to esm from @std/esm
parent
1f45aec2fa
commit
e2e59466be
|
@ -3,3 +3,4 @@
|
|||
/syncd/
|
||||
*.log
|
||||
/temp/
|
||||
*.lock
|
||||
|
|
22
package.json
22
package.json
|
@ -1,18 +1,18 @@
|
|||
{
|
||||
"name": "@uci/socket",
|
||||
"version": "0.1.1",
|
||||
"version": "0.1.2",
|
||||
"description": "JSON packet intra(named)/inter(TCP) host communication over socket",
|
||||
"main": "src",
|
||||
"scripts": {
|
||||
"testw": "mocha -r @std/esm test/*.test.mjs --watch --recurse --watch-extensions mjs",
|
||||
"test": "mocha -r @std/esm --timeout 10000 test/*.test.mjs",
|
||||
"testlog": "DEBUG=true mocha -r @std/esm --timeout 10000 test/*.test.mjs",
|
||||
"testw": "mocha -r esm test/*.test.mjs --watch --recurse --watch-extensions mjs",
|
||||
"test": "mocha -r esm --timeout 10000 test/*.test.mjs",
|
||||
"testlog": "DEBUG=true mocha -r esm --timeout 10000 test/*.test.mjs",
|
||||
"testci": "istanbul cover ./node_modules/.bin/_mocha --report lcovonly -- -R spec --recursive && codecov || true",
|
||||
"s": "DEBUG=true node -r @std/esm examples/server",
|
||||
"devs": "SOCKETS_DIR=/opt/sockets DEBUG=true ./node_modules/.bin/nodemon -r @std/esm -e mjs examples/server",
|
||||
"c": "DEBUG=true node -r @std/esm examples/client",
|
||||
"devc": "SOCKETS_DIR=/opt/sockets DEBUG=true node -r @std/esm examples/client",
|
||||
"c2": "node -r @std/esm examples/client2"
|
||||
"s": "DEBUG=true node -r esm examples/server",
|
||||
"devs": "SOCKETS_DIR=/opt/sockets DEBUG=true ./node_modules/.bin/nodemon -r esm-e mjs examples/server",
|
||||
"c": "DEBUG=true node -r esm examples/client",
|
||||
"devc": "SOCKETS_DIR=/opt/sockets DEBUG=true node -r esm examples/client",
|
||||
"c2": "node -r esm examples/client2"
|
||||
},
|
||||
"author": "David Kebler",
|
||||
"license": "MIT",
|
||||
|
@ -35,17 +35,17 @@
|
|||
"url": "https://github.com/uCOMmandIt/message/issues"
|
||||
},
|
||||
"homepage": "https://github.com/uCOMmandIt/message#readme",
|
||||
"@std/esm": "cjs",
|
||||
"devDependencies": {
|
||||
"@std/esm": "^0.22.0",
|
||||
"chai": "^4.1.2",
|
||||
"chai-as-promised": "^7.1.1",
|
||||
"codecov": "^3.0.0",
|
||||
"esm": "^3.0.21",
|
||||
"istanbul": "^0.4.5",
|
||||
"mocha": "^5.0.1",
|
||||
"nodemon": "^1.15.1"
|
||||
},
|
||||
"dependencies": {
|
||||
"@uci/logger": "^0.0.2",
|
||||
"better-try-catch": "^0.6.2",
|
||||
"clone": "^2.1.1",
|
||||
"death": "^1.1.0",
|
||||
|
|
|
@ -7,14 +7,6 @@ import JsonStream from './json-stream'
|
|||
import logger from '@uci/logger'
|
||||
|
||||
let log = {}
|
||||
const LOG_OPTS = {
|
||||
repo:'uci-socket',
|
||||
npm:'@uci/socket',
|
||||
file:'src/consumer.mjs',
|
||||
class:'Consumer',
|
||||
id:this.id,
|
||||
instance_created:new Date().getTime()
|
||||
}
|
||||
|
||||
// TODO change default pipe dir for windows and mac os
|
||||
const DEFAULT_PIPE_DIR = (process.env.SOCKETS_DIR || '/tmp/UCI')
|
||||
|
@ -23,7 +15,7 @@ const DEFAULT_SOCKET_NAME = 'uci-sock'
|
|||
export default class Consumer extends Socket {
|
||||
constructor (opts={}) {
|
||||
super()
|
||||
log = logger.child(LOG_OPTS)
|
||||
log = logger({file:'src/consumer.js',class:'Consumer',name:'socket',id:this.id})
|
||||
this.id = opts.id || opts.name || 'socket:'+ new Date().getTime()
|
||||
if (!opts.path) {
|
||||
log.warn({opts:opts},'no host supplied using localhost...use named piped instead')
|
|
@ -10,14 +10,7 @@ import clone from 'clone'
|
|||
// import logger from '../../uci-logger/src/logger'
|
||||
import logger from '@uci/logger'
|
||||
let log = {}
|
||||
const LOG_OPTS = {
|
||||
repo:'uci-socket',
|
||||
npm:'@uci/socket',
|
||||
file:'src/socket.mjs',
|
||||
class:'Socket',
|
||||
id:this.id,
|
||||
instance_created:new Date().getTime()
|
||||
}
|
||||
|
||||
// TODO change default pipe dir for windows and mac os
|
||||
const DEFAULT_PIPE_DIR = (process.env.SOCKETS_DIR || '/tmp/UCI')
|
||||
const DEFAULT_SOCKET_NAME = 'uci-sock'
|
||||
|
@ -37,7 +30,7 @@ export default class Socket extends Server {
|
|||
//self bindings
|
||||
this._listen = this._listen.bind(this)
|
||||
this.create = this.create.bind(this)
|
||||
log = logger.child(LOG_OPTS) //create instance logger set LOG_OPTS above
|
||||
log = logger({file:'src/socket.js',class:'Socket',name:'socket',id:this.id})
|
||||
} // end constructor
|
||||
|
||||
async create () {
|
Loading…
Reference in New Issue