update to esm from @std/esm

master
David Kebler 2018-05-16 07:08:14 -07:00
parent 5a0af4d75e
commit 78bcf3009a
7 changed files with 13 additions and 21 deletions

1
.gitignore vendored
View File

@ -1,3 +1,4 @@
/node_modules/ /node_modules/
/coverage/ /coverage/
/syncd/ /syncd/
yarn.lock

View File

@ -39,8 +39,6 @@ mqtt.socket.mqtt.registerPacketProcessor(process.bind(mqtt))
console.log(await mqtt.init()) console.log(await mqtt.init())
// process.kill(process.pid, 'SIGTERM')
})().catch(err => { })().catch(err => {
console.error('FATAL: UNABLE TO START SYSTEM!\n',err) console.error('FATAL: UNABLE TO START SYSTEM!\n',err)
process.kill(process.pid, 'SIGTERM') process.kill(process.pid, 'SIGTERM')

View File

@ -1,14 +1,14 @@
{ {
"name": "@uci/base", "name": "@uci/base",
"version": "0.1.1", "version": "0.1.4",
"description": "Mutli Level/Transport Message/Event Classes", "description": "Mutli Level/Transport Message/Event Classes",
"main": "src/base", "main": "src/base",
"scripts": { "scripts": {
"deve": "./node_modules/.bin/nodemon -r @std/esm -e mjs examples/four-in-one", "deve": "./node_modules/.bin/nodemon -r esm examples/four-in-one",
"fio": "node -r @std/esm examples/four-in-one", "fio": "node -r esm examples/four-in-one",
"mqtt": "node -r @std/esm examples/mqtt", "mqtt": "node -r esm examples/mqtt",
"testw": "mocha -r @std/esm test/*.test.mjs --watch --recurse --watch-extensions mjs", "testw": "mocha -r esm test/*.test.mjs --watch --recurse --watch-extensions mjs",
"test": "mocha -r @std/esm test/*.test.mjs", "test": "mocha -r esm test/*.test.mjs",
"testci": "istanbul cover ./node_modules/.bin/_mocha --report lcovonly -- -R spec --recursive && codecov || true" "testci": "istanbul cover ./node_modules/.bin/_mocha --report lcovonly -- -R spec --recursive && codecov || true"
}, },
"author": "David Kebler", "author": "David Kebler",
@ -27,18 +27,18 @@
"url": "https://github.com/uCOMmandIt/message/issues" "url": "https://github.com/uCOMmandIt/message/issues"
}, },
"homepage": "https://github.com/uCOMmandIt/message#readme", "homepage": "https://github.com/uCOMmandIt/message#readme",
"@std/esm": "cjs",
"devDependencies": { "devDependencies": {
"@std/esm": "^0.22.0",
"chai": "^4.1.2", "chai": "^4.1.2",
"chai-as-promised": "^7.1.1", "chai-as-promised": "^7.1.1",
"codecov": "^3.0.0", "codecov": "^3.0.0",
"esm": "^3.0.22",
"istanbul": "^0.4.5", "istanbul": "^0.4.5",
"mocha": "^5.0.1", "mocha": "^5.0.1",
"nodemon": "^1.14.12" "nodemon": "^1.14.12"
}, },
"dependencies": { "dependencies": {
"@uci/mqtt": "0.0.1", "@uci/logger": "^0.0.3",
"@uci/mqtt": "^0.0.5",
"@uci/socket": "^0.1.1", "@uci/socket": "^0.1.1",
"@uci/utils": "^0.1.1" "@uci/utils": "^0.1.1"
} }

View File

@ -1,26 +1,19 @@
import UCISocket from '@uci/socket' import UCISocket from '@uci/socket'
import MQTT from '@uci/mqtt' import MQTT from '@uci/mqtt'
// import MQTT from '../../uci-mqtt/src/client'
import EventEmitter from 'events' import EventEmitter from 'events'
import { bindFuncs } from '@uci/utils/src/function' import { bindFuncs } from '@uci/utils/src/function'
import { processor, commands, namespaces } from './processing.mjs' import { processor, commands, namespaces } from './processing'
import logger from '@uci/logger' import logger from '@uci/logger'
let log = {} let log = {}
const LOG_OPTS = {
repo:'uci-base',
npm:'@uci/base',
file:'src/base.mjs',
class:'Base',
id:this.id,
instance_created:new Date().getTime()
}
export default class Base extends EventEmitter { export default class Base extends EventEmitter {
constructor(opts={}) { constructor(opts={}) {
super() super()
log = logger.child(LOG_OPTS)
this.id = opts.id || opts.name || 'uci-base:'+ new Date().getTime() this.id = opts.id || opts.name || 'uci-base:'+ new Date().getTime()
log = logger({name:'base',id:this.id})
this.desc = opts.desc // additional details for humans this.desc = opts.desc // additional details for humans
this.socket={} this.socket={}
this._processors = { _default: processor } this._processors = { _default: processor }