From 12143f58e432cc40eac2f5085908fa405cb29ba2 Mon Sep 17 00:00:00 2001 From: David Kebler Date: Wed, 16 May 2018 07:12:14 -0700 Subject: [PATCH] upgrade to esm from @std/esm --- .gitignore | 1 + examples/{multi.mjs => multi.js} | 0 examples/{single.mjs => single.js} | 0 package.json | 15 +++++++-------- src/{index.mjs => index.js} | 0 src/{interrupt.mjs => interrupt.js} | 11 +---------- src/{interrupts.mjs => interrupts.js} | 11 +---------- 7 files changed, 10 insertions(+), 28 deletions(-) rename examples/{multi.mjs => multi.js} (100%) rename examples/{single.mjs => single.js} (100%) rename src/{index.mjs => index.js} (100%) rename src/{interrupt.mjs => interrupt.js} (94%) rename src/{interrupts.mjs => interrupts.js} (87%) diff --git a/.gitignore b/.gitignore index e61051f..faad3eb 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ /node_modules/ /coverage/ +*.lock diff --git a/examples/multi.mjs b/examples/multi.js similarity index 100% rename from examples/multi.mjs rename to examples/multi.js diff --git a/examples/single.mjs b/examples/single.js similarity index 100% rename from examples/single.mjs rename to examples/single.js diff --git a/package.json b/package.json index 230f553..bd81f5d 100644 --- a/package.json +++ b/package.json @@ -1,13 +1,13 @@ { "name": "@uci/interrupt", "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", "scripts": { - "single": "sudo node --require @std/esm examples/single", - "singlelog": "UCI_LOG=true sudo node_--require @std/esm examples/single | pino-colada", - "multi": "sudo node --require @std/esm examples/multi", - "multilog": "DEBUG=true sudo node --require @std/esm examples/multi" + "single": "sudo node -r esm examples/single", + "singlelog": "UCI_LOG=true sudo node -r esm examples/single | pino-colada", + "multi": "sudo node --require esm examples/multi", + "multilog": "DEBUG=true sudo node --require esmexamples/multi" }, "author": "David Kebler", "license": "MIT", @@ -31,15 +31,14 @@ }, "dependencies": { "@uci/base": "^0.1.1", - "@uci/logger": "0.0.1", + "@uci/logger": "^0.0.2", "lodash.debounce": "^4.0.8" }, - "@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.14.3", diff --git a/src/index.mjs b/src/index.js similarity index 100% rename from src/index.mjs rename to src/index.js diff --git a/src/interrupt.mjs b/src/interrupt.js similarity index 94% rename from src/interrupt.mjs rename to src/interrupt.js index d426a8a..b091efb 100644 --- a/src/interrupt.mjs +++ b/src/interrupt.js @@ -8,15 +8,6 @@ import Base from '@uci/base' import logger from '@uci/logger' 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 { constructor(pin,opts={}) { @@ -37,7 +28,7 @@ export default class Interrupt extends Base { if (opts.sockets==='') throw ('must have at least one socket client') super(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') this.pin_num = pin this.mock = opts.mock diff --git a/src/interrupts.mjs b/src/interrupts.js similarity index 87% rename from src/interrupts.mjs rename to src/interrupts.js index 2263073..688e524 100644 --- a/src/interrupts.mjs +++ b/src/interrupts.js @@ -2,21 +2,13 @@ import Interrupt from './interrupt' import logger from '@uci/logger' 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 { constructor(pins,opts={}) { this.id = this.id || 'interrupts' this.pins = pins this.interrupt={} + log = logger({name:'interrupts',id:this.id}) pins.forEach (pin =>{ opts[pin] = opts[pin] || {} opts[pin].id = (opts.id ||'interrupt') + ':' + pin; @@ -27,7 +19,6 @@ export default class Interrupts { this.interrupt[pin].hook=hook this.interrupt[pin].reply = () =>{} }) - log = logger.child(LOG_OPTS(this.id)) } async init() {