@@ -2,6 +2,7 @@
|
||||
[](https://travis-ci.org/thomasnordquist/MQTT-Explorer/releases)
|
||||
[](https://travis-ci.org/thomasnordquist/MQTT-Explorer/releases)
|
||||
[](https://travis-ci.org/thomasnordquist/MQTT-Explorer)
|
||||
[](https://ci.appveyor.com/project/thomasnordquist/mqtt-explorer/branch/master)
|
||||
|
||||
### Version {{ version }}
|
||||
|
||||
|
||||
32
appveyor.yml
Normal file
32
appveyor.yml
Normal file
@@ -0,0 +1,32 @@
|
||||
image: Visual Studio 2017
|
||||
platform: x64
|
||||
|
||||
cache:
|
||||
- node_modules
|
||||
- '%LOCALAPPDATA%\electron\Cache'
|
||||
- '%LOCALAPPDATA%\electron-builder\cache'
|
||||
|
||||
install:
|
||||
- ps: Install-Product node 10
|
||||
|
||||
build_script:
|
||||
- yarn
|
||||
- yarn build
|
||||
|
||||
test_script:
|
||||
- yarn test
|
||||
|
||||
before_deploy:
|
||||
- yarn prepare-release
|
||||
- yarn package appx
|
||||
|
||||
deploy:
|
||||
- provider: Environment
|
||||
name: production
|
||||
on:
|
||||
branch: master # only this will work
|
||||
APPVEYOR_REPO_TAG: true # condition will never be evaluated
|
||||
|
||||
artifacts:
|
||||
- path: 'build\clean\build\MQTT-Explorer*.appx'
|
||||
|
||||
12
package.json
12
package.json
@@ -6,10 +6,10 @@
|
||||
"scripts": {
|
||||
"start": "electron .",
|
||||
"test": "yarn run test-backend",
|
||||
"install": "cd app; yarn; cd ..",
|
||||
"install": "cd app && yarn && cd ..",
|
||||
"build": "tsc && cd app && yarn run build && cd ..",
|
||||
"test-backend": "cd backend && yarn run test && cd ..",
|
||||
"prepare-release": "./scripts/prepare-release.sh",
|
||||
"prepare-release": "ts-node scripts/prepare-release.ts",
|
||||
"package": "ts-node package.ts",
|
||||
"ui-test": "./scripts/uiTests.sh",
|
||||
"upload-video-artifacts": "./scripts/uploadVideoAsset.ts ui-test.mp4 ui-test.gif",
|
||||
@@ -32,6 +32,12 @@
|
||||
"category": "Development",
|
||||
"maintainer": "Thomas Nordquist"
|
||||
},
|
||||
"appx": {
|
||||
"applicationId": "mqttexplorer",
|
||||
"identityName": "51031thomas.nordquist.MQTT-Explorer",
|
||||
"publisherDisplayName": "Thomas Nordquist",
|
||||
"publisher": "CN=0A6DE643-4AA2-4FF2-9729-6935C9ED8C13"
|
||||
},
|
||||
"directories": {
|
||||
"app": "./",
|
||||
"buildResources": "res",
|
||||
@@ -44,6 +50,7 @@
|
||||
"license": "ISC",
|
||||
"devDependencies": {
|
||||
"@types/chai": "^4.1.7",
|
||||
"@types/fs-extra": "^5.0.5",
|
||||
"@types/lowdb": "^1.0.6",
|
||||
"@types/mime": "^2.0.0",
|
||||
"@types/mocha": "^5.2.5",
|
||||
@@ -55,6 +62,7 @@
|
||||
"chai": "^4.2.0",
|
||||
"electron": "^4.0.2",
|
||||
"electron-builder": "^20.38.5",
|
||||
"fs-extra": "^7.0.1",
|
||||
"mime": "^2.4.0",
|
||||
"mocha": "^5.2.0",
|
||||
"mustache": "^3.0.1",
|
||||
|
||||
14
package.ts
14
package.ts
@@ -30,6 +30,16 @@ const win: builder.CliOptions = {
|
||||
publish: 'always',
|
||||
}
|
||||
|
||||
const winAppx: builder.CliOptions = {
|
||||
x64: true,
|
||||
ia32: true,
|
||||
armv7l: false,
|
||||
arm64: false,
|
||||
win: ['appx'],
|
||||
projectDir: './build/clean',
|
||||
publish: 'never',
|
||||
}
|
||||
|
||||
const mac: builder.CliOptions = {
|
||||
x64: true,
|
||||
ia32: true,
|
||||
@@ -41,11 +51,13 @@ const mac: builder.CliOptions = {
|
||||
}
|
||||
|
||||
async function executeBuild() {
|
||||
console.log(process.argv[2])
|
||||
switch (process.argv[2]) {
|
||||
case 'win':
|
||||
await builder.build(win)
|
||||
break
|
||||
case 'appx':
|
||||
await builder.build(winAppx)
|
||||
break
|
||||
case 'linux':
|
||||
await builder.build(linux)
|
||||
break
|
||||
|
||||
@@ -1,26 +0,0 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
ORIGINAL_DIR=`pwd`
|
||||
DIR=build/clean
|
||||
|
||||
rm -rf "$DIR" || echo "Directory did not exist"
|
||||
mkdir -p "$DIR"
|
||||
|
||||
git clone .git "$DIR"
|
||||
cd $DIR
|
||||
|
||||
# App
|
||||
cd app
|
||||
yarn
|
||||
cd ..
|
||||
|
||||
# Build
|
||||
yarn
|
||||
yarn build
|
||||
rm -rf node_modules
|
||||
yarn install --production
|
||||
|
||||
rm -rf app/node_modules
|
||||
|
||||
cd "$ORIGINAL_DIR"
|
||||
66
scripts/prepare-release.ts
Normal file
66
scripts/prepare-release.ts
Normal file
@@ -0,0 +1,66 @@
|
||||
import * as fs from 'fs-extra'
|
||||
import * as path from 'path'
|
||||
import { spawn, ChildProcess } from 'child_process'
|
||||
import { chdir } from 'process'
|
||||
|
||||
async function exec(cmd: string, args: string[] = []) {
|
||||
const child = spawn(cmd, args, { shell: true })
|
||||
redirectOutputFor(child)
|
||||
await waitFor(child)
|
||||
}
|
||||
|
||||
function redirectOutputFor(child: ChildProcess) {
|
||||
const printStdout = (data: Buffer) => {
|
||||
process.stdout.write(data.toString())
|
||||
}
|
||||
const printStderr = (data: Buffer) => {
|
||||
process.stderr.write(data.toString())
|
||||
}
|
||||
child.stdout.on('data', printStdout)
|
||||
child.stderr.on('data', printStderr)
|
||||
|
||||
child.once('close', () => {
|
||||
child.stdout.off('data', printStdout)
|
||||
child.stderr.off('data', printStderr)
|
||||
})
|
||||
}
|
||||
|
||||
async function waitFor(child: ChildProcess) {
|
||||
|
||||
return new Promise((resolve) => {
|
||||
child.once('close', () => resolve())
|
||||
})
|
||||
}
|
||||
|
||||
const targetDir = path.join('build', 'clean')
|
||||
async function prepareRelease() {
|
||||
const originalDir = __dirname
|
||||
await fs.remove(targetDir)
|
||||
await fs.mkdirp(targetDir)
|
||||
|
||||
// Create fresh clone of the local git repo
|
||||
await exec('git', ['clone', '.git', targetDir])
|
||||
|
||||
// Enter git repo
|
||||
chdir(targetDir)
|
||||
|
||||
// Install app dependencies
|
||||
chdir('app')
|
||||
await exec('yarn')
|
||||
chdir('..')
|
||||
|
||||
// Install electron dependencies
|
||||
await exec('yarn')
|
||||
|
||||
// Build App and Electron backend
|
||||
await exec('yarn', ['build'])
|
||||
|
||||
// Clean up
|
||||
await fs.remove('node_modules')
|
||||
await exec('yarn', ['install', '--production'])
|
||||
await fs.remove(path.join('app', 'node_modules'))
|
||||
|
||||
chdir(originalDir)
|
||||
}
|
||||
|
||||
prepareRelease()
|
||||
@@ -119,6 +119,13 @@
|
||||
resolved "https://registry.yarnpkg.com/@types/chai/-/chai-4.1.7.tgz#1b8e33b61a8c09cbe1f85133071baa0dbf9fa71a"
|
||||
integrity sha512-2Y8uPt0/jwjhQ6EiluT0XCri1Dbplr0ZxfFXUz+ye13gaqE8u5gL5ppao1JrUYr9cIip5S6MvQzBS7Kke7U9VA==
|
||||
|
||||
"@types/fs-extra@^5.0.5":
|
||||
version "5.0.5"
|
||||
resolved "https://registry.yarnpkg.com/@types/fs-extra/-/fs-extra-5.0.5.tgz#080d90a792f3fa2c5559eb44bd8ef840aae9104b"
|
||||
integrity sha512-w7iqhDH9mN8eLClQOYTkhdYUOSpp25eXxfc6VbFOGtzxW34JcvctH2bKjj4jD4++z4R5iO5D+pg48W2e03I65A==
|
||||
dependencies:
|
||||
"@types/node" "*"
|
||||
|
||||
"@types/lodash@*":
|
||||
version "4.14.121"
|
||||
resolved "https://registry.yarnpkg.com/@types/lodash/-/lodash-4.14.121.tgz#9327e20d49b95fc2bf983fc2f045b2c6effc80b9"
|
||||
@@ -1460,7 +1467,7 @@ fs-extra@^4.0.1:
|
||||
jsonfile "^4.0.0"
|
||||
universalify "^0.1.0"
|
||||
|
||||
fs-extra@^7.0.0:
|
||||
fs-extra@^7.0.0, fs-extra@^7.0.1:
|
||||
version "7.0.1"
|
||||
resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-7.0.1.tgz#4f189c44aa123b895f722804f55ea23eadc348e9"
|
||||
integrity sha512-YJDaCJZEnBmcbw13fvdAM9AwNOJwOzrE4pqMqBq5nFiEqXUqHwlK4B+3pUw6JNvfSPtX05xFHtYy/1ni01eGCw==
|
||||
|
||||
Reference in New Issue
Block a user