Prepare electron releases
This commit is contained in:
4
.gitignore
vendored
4
.gitignore
vendored
@@ -1,7 +1,7 @@
|
|||||||
node_modules
|
node_modules
|
||||||
coverage
|
backend/coverage
|
||||||
|
backend/.nyc_output
|
||||||
build
|
build
|
||||||
.nyc_output
|
|
||||||
.DS_Store
|
.DS_Store
|
||||||
test.dot
|
test.dot
|
||||||
test.png
|
test.png
|
||||||
|
|||||||
993
app/package-lock.json
generated
993
app/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -4,20 +4,20 @@
|
|||||||
"description": "",
|
"description": "",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "webpack --mode production"
|
"build": "webpack --mode production",
|
||||||
|
"postinstall": "npm run build"
|
||||||
},
|
},
|
||||||
"author": "",
|
"author": "",
|
||||||
"license": "ISC",
|
"license": "ISC",
|
||||||
"devDependencies": {
|
"devDependencies": {},
|
||||||
|
"dependencies": {
|
||||||
"@types/node": "^10.12.18",
|
"@types/node": "^10.12.18",
|
||||||
"awesome-typescript-loader": "^5.2.1",
|
"awesome-typescript-loader": "^5.2.1",
|
||||||
"source-map-loader": "^0.2.4",
|
"source-map-loader": "^0.2.4",
|
||||||
"typescript": "^3.2.2",
|
"typescript": "^3.2.2",
|
||||||
"webpack": "^4.28.2",
|
"webpack": "^4.28.2",
|
||||||
"webpack-cli": "^3.1.2",
|
"webpack-cli": "^3.1.2",
|
||||||
"webpack-dev-server": "^3.1.14"
|
"webpack-dev-server": "^3.1.14",
|
||||||
},
|
|
||||||
"dependencies": {
|
|
||||||
"@material-ui/core": "^3.7.1",
|
"@material-ui/core": "^3.7.1",
|
||||||
"@types/react": "^16.7.18",
|
"@types/react": "^16.7.18",
|
||||||
"@types/react-dom": "^16.0.11",
|
"@types/react-dom": "^16.0.11",
|
||||||
|
|||||||
@@ -4,6 +4,11 @@ module.exports = {
|
|||||||
filename: "bundle.js",
|
filename: "bundle.js",
|
||||||
path: __dirname + "/build"
|
path: __dirname + "/build"
|
||||||
},
|
},
|
||||||
|
optimization: {
|
||||||
|
removeAvailableModules: false,
|
||||||
|
removeEmptyChunks: false,
|
||||||
|
splitChunks: false,
|
||||||
|
},
|
||||||
|
|
||||||
mode: 'production',
|
mode: 'production',
|
||||||
|
|
||||||
|
|||||||
3748
backend/package-lock.json
generated
3748
backend/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -1,13 +1,15 @@
|
|||||||
{
|
{
|
||||||
"name": "mqtt-explorer",
|
"name": "mqtt-explorer-backend",
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"description": "",
|
"description": "",
|
||||||
"main": "src/index.ts",
|
"main": "build/index.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"test": "mocha",
|
"test": "mocha",
|
||||||
|
"build": "tsc",
|
||||||
"test-inspect": "mocha --inspect-brk",
|
"test-inspect": "mocha --inspect-brk",
|
||||||
"coverage": "nyc mocha",
|
"coverage": "nyc mocha",
|
||||||
"debug": "ts-node --inspect ./src/index.ts"
|
"debug": "ts-node --inspect ./src/index.ts",
|
||||||
|
"postinstall": "npm run build"
|
||||||
},
|
},
|
||||||
"author": "",
|
"author": "",
|
||||||
"license": "ISC",
|
"license": "ISC",
|
||||||
@@ -34,23 +36,23 @@
|
|||||||
"instrument": true
|
"instrument": true
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@types/sha1": "^1.1.1",
|
|
||||||
"@types/socket.io": "^2.1.2",
|
|
||||||
"mqtt": "^2.18.8",
|
"mqtt": "^2.18.8",
|
||||||
"sha1": "^1.1.1",
|
"sha1": "^1.1.1",
|
||||||
"socket.io": "^2.2.0",
|
"socket.io": "^2.2.0"
|
||||||
"tslint": "^5.12.0",
|
|
||||||
"typescript": "^3.2.2"
|
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/chai": "^4.1.7",
|
"@types/chai": "^4.1.7",
|
||||||
"@types/mocha": "^5.2.5",
|
"@types/mocha": "^5.2.5",
|
||||||
"@types/node": "^10.12.18",
|
"@types/node": "^10.12.18",
|
||||||
|
"@types/sha1": "^1.1.1",
|
||||||
|
"@types/socket.io": "^2.1.2",
|
||||||
"chai": "^4.2.0",
|
"chai": "^4.2.0",
|
||||||
"mocha": "^5.2.0",
|
"mocha": "^5.2.0",
|
||||||
"nyc": "^13.1.0",
|
"nyc": "^13.1.0",
|
||||||
"source-map-support": "^0.5.9",
|
"source-map-support": "^0.5.9",
|
||||||
"ts-node": "^7.0.1",
|
"ts-node": "^7.0.1",
|
||||||
"tslint-strict-null-checks": "^1.0.1"
|
"tslint": "^5.12.0",
|
||||||
|
"tslint-strict-null-checks": "^1.0.1",
|
||||||
|
"typescript": "^3.2.2"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
import { DataSourceState } from './'
|
import { DataSourceStateMachine } from './'
|
||||||
|
|
||||||
type MessageCallback = (topic: string, payload: Buffer) => void
|
type MessageCallback = (topic: string, payload: Buffer) => void
|
||||||
|
|
||||||
// A DataSource should automatically reconnect if connection was broken
|
// A DataSource should automatically reconnect if connection was broken
|
||||||
interface DataSource<DataSourceOptions> {
|
interface DataSource<DataSourceOptions> {
|
||||||
connect(options: DataSourceOptions): DataSourceState
|
connect(options: DataSourceOptions): DataSourceStateMachine
|
||||||
disconnect(): void
|
disconnect(): void
|
||||||
onMessage(messageCallback: MessageCallback): void
|
onMessage(messageCallback: MessageCallback): void
|
||||||
topicSeparator: string
|
topicSeparator: string
|
||||||
|
|||||||
@@ -1,11 +1,13 @@
|
|||||||
interface InternalState {
|
import { EventEmitter } from 'events'
|
||||||
|
|
||||||
|
export interface DataSourceState {
|
||||||
connecting: boolean
|
connecting: boolean
|
||||||
connected: boolean
|
connected: boolean
|
||||||
error?: Error
|
error?: Error
|
||||||
}
|
}
|
||||||
|
|
||||||
export class DataSourceState {
|
export class DataSourceStateMachine extends EventEmitter {
|
||||||
private state: InternalState = {
|
private state: DataSourceState = {
|
||||||
error: undefined,
|
error: undefined,
|
||||||
connected: false,
|
connected: false,
|
||||||
connecting: false
|
connecting: false
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { Client, connect as mqttConnect } from 'mqtt'
|
import { Client, connect as mqttConnect } from 'mqtt'
|
||||||
import { DataSource, DataSourceState } from './'
|
import { DataSource, DataSourceStateMachine } from './'
|
||||||
|
|
||||||
export interface MqttOptions {
|
export interface MqttOptions {
|
||||||
url: string
|
url: string
|
||||||
@@ -15,8 +15,8 @@ export class MqttSource implements DataSource<MqttOptions> {
|
|||||||
this.messageCallback = messageCallback
|
this.messageCallback = messageCallback
|
||||||
}
|
}
|
||||||
|
|
||||||
public connect(options: MqttOptions): DataSourceState {
|
public connect(options: MqttOptions): DataSourceStateMachine {
|
||||||
const state = new DataSourceState()
|
const state = new DataSourceStateMachine()
|
||||||
|
|
||||||
const client = mqttConnect(options.url, {
|
const client = mqttConnect(options.url, {
|
||||||
resubscribe: false
|
resubscribe: false
|
||||||
|
|||||||
@@ -1,10 +1,11 @@
|
|||||||
import { DataSource } from './DataSource'
|
import { DataSource } from './DataSource'
|
||||||
import { DataSourceState } from './DataSourceState'
|
import { DataSourceState, DataSourceStateMachine } from './DataSourceState'
|
||||||
import { MqttOptions, MqttSource } from './MqttSource'
|
import { MqttOptions, MqttSource } from './MqttSource'
|
||||||
|
|
||||||
export {
|
export {
|
||||||
DataSource,
|
DataSource,
|
||||||
DataSourceState,
|
DataSourceState,
|
||||||
|
DataSourceStateMachine,
|
||||||
MqttOptions,
|
MqttOptions,
|
||||||
MqttSource,
|
MqttSource,
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,61 +0,0 @@
|
|||||||
import { Tree, TreeNode } from './Model'
|
|
||||||
|
|
||||||
export class DotExport {
|
|
||||||
public static renderNodeInformation(node: TreeNode): string {
|
|
||||||
return `\t${node.sourceEdge.hash()} [label=${this.renderLabel(node.value)}]`
|
|
||||||
}
|
|
||||||
public static toDot(tree: Tree): string {
|
|
||||||
let i = 1
|
|
||||||
let leaveEdges = Object.values(tree.edges)
|
|
||||||
.map(e => e.node)
|
|
||||||
.map(node => node.leafes())
|
|
||||||
.reduce((a, b) => a.concat(b), [])
|
|
||||||
.map(leave => leave.branch())
|
|
||||||
|
|
||||||
const allEdges: Array<string> = []
|
|
||||||
const nodeInformation: {[s: string]: string} = {}
|
|
||||||
leaveEdges.map(edges => edges.reduce( (prev, current) => {
|
|
||||||
let currentHash = current.sourceEdge.hash()
|
|
||||||
nodeInformation[currentHash] = this.renderNodeInformation(current)
|
|
||||||
if (current && prev) {
|
|
||||||
allEdges.push(`\t${prev.sourceEdge.hash()} -> ${currentHash} [label=${this.renderLabel(current.sourceEdge.name)}]`)
|
|
||||||
}
|
|
||||||
return current
|
|
||||||
}))
|
|
||||||
|
|
||||||
return `strict digraph ethane {
|
|
||||||
${
|
|
||||||
[this.renderNodeInformation(tree)]
|
|
||||||
.concat(Object.values(nodeInformation))
|
|
||||||
.concat(allEdges)
|
|
||||||
.join('\n')
|
|
||||||
}
|
|
||||||
}`;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static renderLabel(value: any): string {
|
|
||||||
let str;
|
|
||||||
if(!isNaN(value)) {
|
|
||||||
str = value
|
|
||||||
} else {
|
|
||||||
str = JSON.stringify(value)
|
|
||||||
if(str && str.length > 0) {
|
|
||||||
str = str.slice(1, -1)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!str) {
|
|
||||||
return '""'
|
|
||||||
}
|
|
||||||
|
|
||||||
if(str.length > 20) {
|
|
||||||
str = str.slice(0, 20)+'…'
|
|
||||||
}
|
|
||||||
|
|
||||||
if (str[0] !== '"') {
|
|
||||||
str = `"${str}"`
|
|
||||||
}
|
|
||||||
|
|
||||||
return str
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -3,15 +3,13 @@ import { MqttSource, DataSource } from './DataSource'
|
|||||||
|
|
||||||
import * as socketIO from 'socket.io'
|
import * as socketIO from 'socket.io'
|
||||||
|
|
||||||
const server = require('http').createServer();
|
const http = require('http')
|
||||||
|
|
||||||
let tree = new Tree()
|
|
||||||
let options = {url: 'mqtt://nodered'}
|
let options = {url: 'mqtt://nodered'}
|
||||||
let dataSource = new MqttSource()
|
let dataSource = new MqttSource()
|
||||||
let count = 200
|
|
||||||
|
|
||||||
const a: Array<any> = []
|
const a: Array<any> = []
|
||||||
|
|
||||||
|
const server = http.createServer()
|
||||||
const io = socketIO(server)
|
const io = socketIO(server)
|
||||||
io.on('connection', client => {
|
io.on('connection', client => {
|
||||||
console.log('connection')
|
console.log('connection')
|
||||||
|
|||||||
33
build.ts
Normal file
33
build.ts
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
import * as builder from 'electron-builder'
|
||||||
|
|
||||||
|
var linux: builder.CliOptions = {
|
||||||
|
x64: true,
|
||||||
|
ia32: true,
|
||||||
|
armv7l: true,
|
||||||
|
arm64: true,
|
||||||
|
linux: ['snap', 'AppImage', 'deb', 'pacman'],
|
||||||
|
};
|
||||||
|
|
||||||
|
var win: builder.CliOptions = {
|
||||||
|
x64: true,
|
||||||
|
ia32: true,
|
||||||
|
armv7l: false,
|
||||||
|
arm64: false,
|
||||||
|
win: ['portable'],
|
||||||
|
};
|
||||||
|
|
||||||
|
var mac: builder.CliOptions = {
|
||||||
|
x64: true,
|
||||||
|
ia32: true,
|
||||||
|
armv7l: false,
|
||||||
|
arm64: false,
|
||||||
|
mac: ['dmg'],
|
||||||
|
};
|
||||||
|
|
||||||
|
async function buildAll() {
|
||||||
|
await builder.build(linux)
|
||||||
|
await builder.build(mac)
|
||||||
|
await builder.build(win)
|
||||||
|
}
|
||||||
|
|
||||||
|
buildAll()
|
||||||
@@ -1,13 +1,13 @@
|
|||||||
// Modules to control application life and create native browser window
|
// Modules to control application life and create native browser window
|
||||||
const {app, BrowserWindow} = require('electron')
|
const {app, BrowserWindow} = require('electron')
|
||||||
|
require('mqtt-explorer-backend')
|
||||||
// Keep a global reference of the window object, if you don't, the window will
|
// Keep a global reference of the window object, if you don't, the window will
|
||||||
// be closed automatically when the JavaScript object is garbage collected.
|
// be closed automatically when the JavaScript object is garbage collected.
|
||||||
let mainWindow
|
let mainWindow
|
||||||
|
|
||||||
function createWindow () {
|
function createWindow () {
|
||||||
// Create the browser window.
|
// Create the browser window.
|
||||||
mainWindow = new BrowserWindow({width: 800, height: 600})
|
mainWindow = new BrowserWindow({width: 1024, height: 600})
|
||||||
|
|
||||||
// and load the index.html of the app.
|
// and load the index.html of the app.
|
||||||
mainWindow.loadFile('app/index.html')
|
mainWindow.loadFile('app/index.html')
|
||||||
|
|||||||
6742
package-lock.json
generated
6742
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
37
package.json
37
package.json
@@ -1,17 +1,38 @@
|
|||||||
{
|
{
|
||||||
"name": "mqtt-explorer-electron",
|
"name": "MQ(TT)-Explorer",
|
||||||
"version": "1.0.0",
|
"version": "0.0.1",
|
||||||
"description": "",
|
"description": "Explore your message queues",
|
||||||
"main": "electron.js",
|
"main": "electron.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"start": "electron .",
|
"start": "electron .",
|
||||||
"build-app": "cd app && npm run build",
|
"release": "./release.sh"
|
||||||
"build-backend": "cd backend && tsc",
|
|
||||||
"build": "npm run build-app && npm run build-backend"
|
|
||||||
},
|
},
|
||||||
"author": "",
|
"build": {
|
||||||
|
"appId": "mq-explorer",
|
||||||
|
"mac": {
|
||||||
|
"category": "de.t7n.apps.mq-explorer"
|
||||||
|
},
|
||||||
|
"linux": {
|
||||||
|
"category": "Development",
|
||||||
|
"maintainer": "Thomas Nordquist"
|
||||||
|
},
|
||||||
|
"directories": {
|
||||||
|
"app": "./",
|
||||||
|
"buildResources": "res",
|
||||||
|
"output": "build"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"author": "Thomas Nordquist",
|
||||||
|
"email": "xxnerowingerxx@gmail.com",
|
||||||
|
"homepage": "https://github.com",
|
||||||
"license": "ISC",
|
"license": "ISC",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"electron": "^4.0.0"
|
"electron": "^4.0.0",
|
||||||
|
"electron-builder": "^20.38.4",
|
||||||
|
"ts-node": "^7.0.1",
|
||||||
|
"typescript": "^3.2.2"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"mqtt-explorer-backend": "file:backend"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
8
release.sh
Executable file
8
release.sh
Executable file
@@ -0,0 +1,8 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
docker run --rm -ti \
|
||||||
|
--env ELECTRON_CACHE="/root/.cache/electron" \
|
||||||
|
--env ELECTRON_BUILDER_CACHE="/root/.cache/electron-builder" \
|
||||||
|
-v ${PWD}:/project \
|
||||||
|
-v ~/.cache/electron:/root/.cache/electron \
|
||||||
|
-v ~/.cache/electron-builder:/root/.cache/electron-builder \
|
||||||
|
electronuserland/builder:wine node_modules/.bin/ts-node build.ts
|
||||||
BIN
res/icon.png
Normal file
BIN
res/icon.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 47 KiB |
11
tsconfig.json
Normal file
11
tsconfig.json
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
{
|
||||||
|
"compileOnSave": true,
|
||||||
|
"compilerOptions": {
|
||||||
|
"noImplicitAny": true,
|
||||||
|
"strictNullChecks": true,
|
||||||
|
"outDir": "./build",
|
||||||
|
"strict": true,
|
||||||
|
"lib": ["es2017"],
|
||||||
|
"sourceMap": true
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user