make serialport native bindings work

This commit is contained in:
Nikolaos Stefanou 2020-02-25 19:49:25 +00:00 committed by Nick Stefanou
parent 041a3ce2b6
commit f151928b6b
6 changed files with 12 additions and 5 deletions

View File

@ -40,6 +40,7 @@
"zone.js": "^0.8.29"
},
"optionalDependencies": {
"serialport": "^8.0.7",
"macos-native-processlist": "^1.0.2",
"windows-blurbehind": "^1.0.1",
"windows-native-registry": "^1.0.17",

View File

@ -21,6 +21,7 @@ exports.builtinPlugins = [
'terminus-community-color-schemes',
'terminus-plugin-manager',
'terminus-ssh',
'terminus-serial',
]
exports.bundledModules = [
'@angular',

View File

@ -22,7 +22,7 @@
"ansi-colors": "^4.1.1",
"cli-spinner": "^0.2.10",
"electron-rebuild": "^1.10.0",
"serialport": "^8.0.0",
"serialport": "^8.0.7",
"terminus-terminal": "^1.0.98-nightly.0"
},
"peerDependencies": {

View File

@ -1,5 +1,5 @@
import { BaseSession } from 'terminus-terminal'
import { SerialPort } from 'serialport'
import { SerialPort } from '@serialport/stream'
import { Logger } from 'terminus-core'
import { Subject, Observable } from 'rxjs'
@ -118,7 +118,7 @@ export class SerialSession extends BaseSession {
}
kill (signal?: string) {
console.log('valar morghulis')
this.serial.close()
}
async getChildProcesses (): Promise<any[]> {

View File

@ -1,10 +1,15 @@
import { Injectable, NgZone } from '@angular/core'
import SerialPort from 'serialport'
import SerialPort from '@serialport/stream'
import { ToastrService } from 'ngx-toastr'
import { AppService, LogService } from 'terminus-core'
import { SerialConnection, SerialSession } from '../api'
import { SerialTabComponent } from '../components/serialTab.component'
try {
var bindingsNative = require('serialport/bindings/build/Release/bindings.node') // eslint-disable-line @typescript-eslint/no-var-requires, no-var
SerialPort.binding = bindingsNative
} catch { }
@Injectable({ providedIn: 'root' })
export class SerialService {

View File

@ -48,8 +48,8 @@ module.exports = {
'fs',
'keytar',
'path',
'serialport',
'ngx-toastr',
'serialport/bindings/build/Release/bindings.node',
'windows-process-tree/build/Release/windows_process_tree.node',
/^rxjs/,
/^@angular/,