Merge branch 'master' of https://github.com/thomasnordquist/MQTT-Explorer
This commit is contained in:
@@ -6,7 +6,7 @@
|
|||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "yarn rebuild && webpack --mode production",
|
"build": "yarn rebuild && webpack --mode production",
|
||||||
"dev": "node_modules/.bin/webpack-dev-server --mode development --progress",
|
"dev": "node_modules/.bin/webpack-dev-server --mode development --progress",
|
||||||
"rebuild": "cd node_modules/heapdump && node-gyp rebuild --target=5.0.0 --arch=x64 --dist-url=https://atom.io/download/electron; cd -"
|
"rebuild": "cd node_modules/heapdump && node-gyp rebuild --target=5.0.0 --arch=x64 --dist-url=https://atom.io/download/electron || echo Could not build heapdump; cd -"
|
||||||
},
|
},
|
||||||
"author": "",
|
"author": "",
|
||||||
"license": "CC-BY-ND-4.0",
|
"license": "CC-BY-ND-4.0",
|
||||||
|
|||||||
@@ -89,6 +89,12 @@ class App extends React.PureComponent<Props, {}> {
|
|||||||
|
|
||||||
const styles = (theme: Theme) => {
|
const styles = (theme: Theme) => {
|
||||||
const drawerWidth = 300
|
const drawerWidth = 300
|
||||||
|
const contentBaseStyle = {
|
||||||
|
width: '100vw',
|
||||||
|
overflow: 'hidden' as 'hidden',
|
||||||
|
backgroundColor: theme.palette.background.default,
|
||||||
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
heightProperty: {
|
heightProperty: {
|
||||||
height: 'calc(100vh - 64px) !important',
|
height: 'calc(100vh - 64px) !important',
|
||||||
@@ -106,9 +112,7 @@ const styles = (theme: Theme) => {
|
|||||||
overflow: 'hidden' as 'hidden',
|
overflow: 'hidden' as 'hidden',
|
||||||
},
|
},
|
||||||
content: {
|
content: {
|
||||||
width: '100vw',
|
...contentBaseStyle,
|
||||||
overflowX: 'hidden' as 'hidden',
|
|
||||||
backgroundColor: theme.palette.background.default,
|
|
||||||
transition: theme.transitions.create('transform', {
|
transition: theme.transitions.create('transform', {
|
||||||
easing: theme.transitions.easing.sharp,
|
easing: theme.transitions.easing.sharp,
|
||||||
duration: theme.transitions.duration.leavingScreen,
|
duration: theme.transitions.duration.leavingScreen,
|
||||||
@@ -116,9 +120,7 @@ const styles = (theme: Theme) => {
|
|||||||
transform: 'translateX(0px)',
|
transform: 'translateX(0px)',
|
||||||
},
|
},
|
||||||
contentShift: {
|
contentShift: {
|
||||||
overflowX: 'hidden' as 'hidden',
|
...contentBaseStyle,
|
||||||
width: '100vw',
|
|
||||||
padding: 0,
|
|
||||||
backgroundColor: theme.palette.background.default,
|
backgroundColor: theme.palette.background.default,
|
||||||
transition: theme.transitions.create('transform', {
|
transition: theme.transitions.create('transform', {
|
||||||
easing: theme.transitions.easing.easeOut,
|
easing: theme.transitions.easing.easeOut,
|
||||||
|
|||||||
@@ -1,12 +1,14 @@
|
|||||||
import * as FileAsync from 'lowdb/adapters/FileAsync'
|
import * as FileAsync from 'lowdb/adapters/FileAsync'
|
||||||
|
import * as fs from 'fs-extra'
|
||||||
import * as lowdb from 'lowdb'
|
import * as lowdb from 'lowdb'
|
||||||
|
import * as path from 'path'
|
||||||
import { backendEvents } from '../../events'
|
import { backendEvents } from '../../events'
|
||||||
import {
|
import {
|
||||||
|
makeStorageAcknowledgementEvent,
|
||||||
makeStorageResponseEvent,
|
makeStorageResponseEvent,
|
||||||
storageClearEvent,
|
storageClearEvent,
|
||||||
storageLoadEvent,
|
storageLoadEvent,
|
||||||
storageStoreEvent,
|
storageStoreEvent
|
||||||
makeStorageAcknowledgementEvent
|
|
||||||
} from '../../events/StorageEvents'
|
} from '../../events/StorageEvents'
|
||||||
|
|
||||||
export default class ConfigStorage {
|
export default class ConfigStorage {
|
||||||
@@ -17,6 +19,10 @@ export default class ConfigStorage {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private async getDb() {
|
private async getDb() {
|
||||||
|
const pathInfo = path.parse(this.file)
|
||||||
|
|
||||||
|
// Ensure that Settings dir exists
|
||||||
|
await fs.mkdirp(pathInfo.dir)
|
||||||
const adapter = new FileAsync(this.file)
|
const adapter = new FileAsync(this.file)
|
||||||
if (!this.database) {
|
if (!this.database) {
|
||||||
this.database = await lowdb(adapter)
|
this.database = await lowdb(adapter)
|
||||||
|
|||||||
@@ -32,7 +32,6 @@
|
|||||||
"publish": [
|
"publish": [
|
||||||
"github"
|
"github"
|
||||||
],
|
],
|
||||||
"provisioningProfile": "res/MQTT_Explorer_Store_Distribution_Profile.provisionprofile",
|
|
||||||
"entitlements": "res/entitlements.mas.plist"
|
"entitlements": "res/entitlements.mas.plist"
|
||||||
},
|
},
|
||||||
"linux": {
|
"linux": {
|
||||||
@@ -91,6 +90,7 @@
|
|||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"about-window": "^1.12.1",
|
"about-window": "^1.12.1",
|
||||||
|
"dot-prop": "^5.0.0",
|
||||||
"electron-log": "^2.2.17",
|
"electron-log": "^2.2.17",
|
||||||
"electron-telemetry": "git+https://github.com/thomasnordquist/electron-telemetry.git#dist",
|
"electron-telemetry": "git+https://github.com/thomasnordquist/electron-telemetry.git#dist",
|
||||||
"electron-updater": "^4.0.6",
|
"electron-updater": "^4.0.6",
|
||||||
|
|||||||
33
package.ts
33
package.ts
@@ -1,6 +1,7 @@
|
|||||||
import * as builder from 'electron-builder'
|
import * as builder from 'electron-builder'
|
||||||
import * as fs from 'fs'
|
import * as fs from 'fs'
|
||||||
import * as path from 'path'
|
import * as path from 'path'
|
||||||
|
import * as dotProp from 'dot-prop'
|
||||||
|
|
||||||
const linuxAppImage: builder.CliOptions = {
|
const linuxAppImage: builder.CliOptions = {
|
||||||
x64: true,
|
x64: true,
|
||||||
@@ -88,20 +89,36 @@ type Packages = 'portable' | 'nsis' | 'appx' | 'AppImage' | 'snap' | 'dmg' | 'zi
|
|||||||
|
|
||||||
async function buildWithOptions(options: builder.CliOptions, buildInfo: BuildInfo) {
|
async function buildWithOptions(options: builder.CliOptions, buildInfo: BuildInfo) {
|
||||||
fs.writeFileSync(path.join(options.projectDir!, 'buildOptions.json'), JSON.stringify(buildInfo))
|
fs.writeFileSync(path.join(options.projectDir!, 'buildOptions.json'), JSON.stringify(buildInfo))
|
||||||
ensureAppNameForPackage(options, buildInfo.package)
|
|
||||||
|
|
||||||
|
const jsonLocation = path.join((options.projectDir as string), 'package.json')
|
||||||
|
const packageJsonStr = fs.readFileSync(jsonLocation).toString()
|
||||||
|
|
||||||
|
const packageJson = JSON.parse(fs.readFileSync(jsonLocation).toString())
|
||||||
|
|
||||||
|
// AppX must have a different name since the store name is already taken (but not used)
|
||||||
|
if (buildInfo.package === 'appx') {
|
||||||
|
dotProp.set(packageJson, 'build.productName', 'MQTT-Explorer')
|
||||||
|
}
|
||||||
|
|
||||||
|
if (buildInfo.platform === 'mac') {
|
||||||
|
console.log(buildInfo.package)
|
||||||
|
const provisioningProfile = (buildInfo.package === 'mas') ? 'res/MQTT_Explorer_Store_Distribution_Profile.provisionprofile' : 'res/MQTTExplorerdmg.provisionprofile'
|
||||||
|
dotProp.set(packageJson, 'build.mac.provisioningProfile', provisioningProfile)
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
// Write modified package.json
|
||||||
|
fs.writeFileSync(jsonLocation, JSON.stringify(packageJson))
|
||||||
await builder.build({
|
await builder.build({
|
||||||
...options,
|
...options,
|
||||||
[buildInfo.platform]: [buildInfo.package],
|
[buildInfo.platform]: [buildInfo.package],
|
||||||
})
|
})
|
||||||
|
} catch (error) {
|
||||||
|
throw error
|
||||||
|
} finally {
|
||||||
|
// Roll back changes to package.json
|
||||||
|
fs.writeFileSync(jsonLocation, packageJsonStr)
|
||||||
}
|
}
|
||||||
|
|
||||||
// AppX must hav a different name since the store name is already taken (but not used)
|
|
||||||
function ensureAppNameForPackage(options: builder.CliOptions, packageOption: Packages) {
|
|
||||||
const jsonLocation = path.join((options.projectDir as string), 'package.json')
|
|
||||||
const packageJson = JSON.parse(fs.readFileSync(jsonLocation).toString())
|
|
||||||
packageJson.build.productName = packageOption === 'appx' ? 'MQTT-Explorer' : 'MQTT Explorer'
|
|
||||||
fs.writeFileSync(jsonLocation, JSON.stringify(packageJson, undefined, ' '))
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function build() {
|
function build() {
|
||||||
|
|||||||
BIN
res/MQTTExplorerdmg.provisionprofile
Normal file
BIN
res/MQTTExplorerdmg.provisionprofile
Normal file
Binary file not shown.
@@ -14,6 +14,8 @@ if (!isDev() && !runningUiTestOnCi()) {
|
|||||||
const electronTelemetry = electronTelemetryFactory('9b0c8ca04a361eb8160d98c5', buildOptions)
|
const electronTelemetry = electronTelemetryFactory('9b0c8ca04a361eb8160d98c5', buildOptions)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
app.commandLine.appendSwitch('--no-sandbox')
|
||||||
|
|
||||||
autoUpdater.logger = log
|
autoUpdater.logger = log
|
||||||
log.info('App starting...')
|
log.info('App starting...')
|
||||||
|
|
||||||
@@ -33,7 +35,7 @@ async function createWindow() {
|
|||||||
loadDevTools()
|
loadDevTools()
|
||||||
}
|
}
|
||||||
|
|
||||||
const iconPath = path.join(__dirname, 'icon.png')
|
const iconPath = path.join(__dirname, '..', '..', 'icon.png')
|
||||||
// Create the browser window.
|
// Create the browser window.
|
||||||
mainWindow = new BrowserWindow({
|
mainWindow = new BrowserWindow({
|
||||||
width: 1024,
|
width: 1024,
|
||||||
@@ -42,13 +44,14 @@ async function createWindow() {
|
|||||||
webPreferences: {
|
webPreferences: {
|
||||||
nodeIntegration: true,
|
nodeIntegration: true,
|
||||||
devTools: true,
|
devTools: true,
|
||||||
|
sandbox: false,
|
||||||
},
|
},
|
||||||
icon: iconPath,
|
icon: iconPath,
|
||||||
})
|
})
|
||||||
|
|
||||||
mainWindow.once('ready-to-show', () => {
|
mainWindow.once('ready-to-show', () => {
|
||||||
if (mainWindow) {
|
if (mainWindow) {
|
||||||
runningUiTestOnCi && mainWindow.setFullScreen(true)
|
runningUiTestOnCi() && mainWindow.setFullScreen(true)
|
||||||
mainWindow.show()
|
mainWindow.show()
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -1131,6 +1131,13 @@ dot-prop@^4.1.0:
|
|||||||
dependencies:
|
dependencies:
|
||||||
is-obj "^1.0.0"
|
is-obj "^1.0.0"
|
||||||
|
|
||||||
|
dot-prop@^5.0.0:
|
||||||
|
version "5.0.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/dot-prop/-/dot-prop-5.0.0.tgz#64b7968af349c3a9f966aa12658dbd5829f6b953"
|
||||||
|
integrity sha512-RTmaF2jx3nOBO2GvtFqjnDLycjFUMqt+2pwRx7JVYa81lDauoj9aNkyrJI2ikR58FbBIchiIlRiGG+muLJ4oHQ==
|
||||||
|
dependencies:
|
||||||
|
is-obj "^1.0.0"
|
||||||
|
|
||||||
dotenv-expand@^4.2.0:
|
dotenv-expand@^4.2.0:
|
||||||
version "4.2.0"
|
version "4.2.0"
|
||||||
resolved "https://registry.yarnpkg.com/dotenv-expand/-/dotenv-expand-4.2.0.tgz#def1f1ca5d6059d24a766e587942c21106ce1275"
|
resolved "https://registry.yarnpkg.com/dotenv-expand/-/dotenv-expand-4.2.0.tgz#def1f1ca5d6059d24a766e587942c21106ce1275"
|
||||||
|
|||||||
Reference in New Issue
Block a user