move sparkplug protocol to js file as file is not included when packaging
maybe there is a better way to resolve this..
This commit is contained in:
@@ -1,10 +1,9 @@
|
||||
import { readFileSync } from 'fs'
|
||||
import * as protobuf from 'protobufjs'
|
||||
import protocol from './sparkplugb.proto'
|
||||
import { Base64Message } from './Base64Message'
|
||||
import { Decoder } from './Decoder'
|
||||
|
||||
const buffer = readFileSync(require.resolve('../../../../res/sparkplug_b.proto'))
|
||||
const root = protobuf.parse(buffer.toString()).root
|
||||
const root = protobuf.parse(protocol).root
|
||||
export let SparkplugPayload = root.lookupType('com.cirruslink.sparkplug.protobuf.Payload')
|
||||
|
||||
export const SparkplugDecoder = {
|
||||
@@ -18,5 +17,6 @@ export const SparkplugDecoder = {
|
||||
} catch {
|
||||
// ignore
|
||||
}
|
||||
return undefined
|
||||
},
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user