upgrade to esm from @std/esm

master
David Kebler 2018-05-16 07:12:14 -07:00
parent 002ad9edbb
commit 12143f58e4
7 changed files with 10 additions and 28 deletions

1
.gitignore vendored
View File

@ -1,2 +1,3 @@
/node_modules/ /node_modules/
/coverage/ /coverage/
*.lock

View File

@ -1,13 +1,13 @@
{ {
"name": "@uci/interrupt", "name": "@uci/interrupt",
"main": "src", "main": "src",
"version": "0.1.1", "version": "0.1.4",
"description": "a class for adding interrupt processesing for gpio pins on Raspberry Pi and Similar SBCs", "description": "a class for adding interrupt processesing for gpio pins on Raspberry Pi and Similar SBCs",
"scripts": { "scripts": {
"single": "sudo node --require @std/esm examples/single", "single": "sudo node -r esm examples/single",
"singlelog": "UCI_LOG=true sudo node_--require @std/esm examples/single | pino-colada", "singlelog": "UCI_LOG=true sudo node -r esm examples/single | pino-colada",
"multi": "sudo node --require @std/esm examples/multi", "multi": "sudo node --require esm examples/multi",
"multilog": "DEBUG=true sudo node --require @std/esm examples/multi" "multilog": "DEBUG=true sudo node --require esmexamples/multi"
}, },
"author": "David Kebler", "author": "David Kebler",
"license": "MIT", "license": "MIT",
@ -31,15 +31,14 @@
}, },
"dependencies": { "dependencies": {
"@uci/base": "^0.1.1", "@uci/base": "^0.1.1",
"@uci/logger": "0.0.1", "@uci/logger": "^0.0.2",
"lodash.debounce": "^4.0.8" "lodash.debounce": "^4.0.8"
}, },
"@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.21",
"istanbul": "^0.4.5", "istanbul": "^0.4.5",
"mocha": "^5.0.1", "mocha": "^5.0.1",
"nodemon": "^1.14.3", "nodemon": "^1.14.3",

View File

@ -8,15 +8,6 @@ import Base from '@uci/base'
import logger from '@uci/logger' import logger from '@uci/logger'
let log = {} let log = {}
const LOG_OPTS = (id) => {
return {
repo:'uci-interrupt',
npm:'@uci/interrupt',
file:'src/interrupt.mjs',
class:'Interrupt',
id:id,
instance_created:new Date().getTime()
}}
export default class Interrupt extends Base { export default class Interrupt extends Base {
constructor(pin,opts={}) { constructor(pin,opts={}) {
@ -37,7 +28,7 @@ export default class Interrupt extends Base {
if (opts.sockets==='') throw ('must have at least one socket client') if (opts.sockets==='') throw ('must have at least one socket client')
super(opts) super(opts)
console.dir(opts) console.dir(opts)
log = logger.child(LOG_OPTS(this.id)) log = logger({name:'interrupt',id:this.id})
log.info({pins:pin, opts:opts},'created interrupt with these opts') log.info({pins:pin, opts:opts},'created interrupt with these opts')
this.pin_num = pin this.pin_num = pin
this.mock = opts.mock this.mock = opts.mock

View File

@ -2,21 +2,13 @@ import Interrupt from './interrupt'
import logger from '@uci/logger' import logger from '@uci/logger'
let log = {} let log = {}
const LOG_OPTS = (id) => {
return {
repo:'uci-interrupt',
npm:'@uci/interrupt',
file:'src/interrupts.mjs',
class:'Interrupts',
id:id,
instance_created:new Date().getTime()
}}
export default class Interrupts { export default class Interrupts {
constructor(pins,opts={}) { constructor(pins,opts={}) {
this.id = this.id || 'interrupts' this.id = this.id || 'interrupts'
this.pins = pins this.pins = pins
this.interrupt={} this.interrupt={}
log = logger({name:'interrupts',id:this.id})
pins.forEach (pin =>{ pins.forEach (pin =>{
opts[pin] = opts[pin] || {} opts[pin] = opts[pin] || {}
opts[pin].id = (opts.id ||'interrupt') + ':' + pin; opts[pin].id = (opts.id ||'interrupt') + ':' + pin;
@ -27,7 +19,6 @@ export default class Interrupts {
this.interrupt[pin].hook=hook this.interrupt[pin].hook=hook
this.interrupt[pin].reply = () =>{} this.interrupt[pin].reply = () =>{}
}) })
log = logger.child(LOG_OPTS(this.id))
} }
async init() { async init() {