This commit is contained in:
Thomas Nordquist
2019-02-21 17:42:18 +01:00
parent 766a283b01
commit 4c58d4af69
4 changed files with 37 additions and 42 deletions
+4 -1
View File
@@ -10,11 +10,14 @@ install:
- ps: Install-Product node 10
build_script:
# - rm .travis.yml
- yarn
- yarn prepare-release
- yarn package win
artifacts:
- path: 'build\clean\build\MQTT-Explorer*.appx'
- path: 'build\clean\build\MQTT-Explorer*.exe'
test_script:
- yarn test
+5 -2
View File
@@ -32,8 +32,11 @@
"category": "Development",
"maintainer": "Thomas Nordquist"
},
"windows": {
"applicationId": "de.t7n.apps.mqttexplorer"
"appx": {
"applicationId": "de.t7n.apps.mqttexplorer",
"identityName": "51031thomas.nordquist.MQTT-Explorer",
"publisherDisplayName": "Thomas Nordquist",
"publisher": "0A6DE643-4AA2-4FF2-9729-6935C9ED8C13"
},
"directories": {
"app": "./",
-26
View File
@@ -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"
+28 -13
View File
@@ -3,13 +3,30 @@ import * as path from 'path'
import { spawn, ChildProcess } from 'child_process'
import { chdir } from 'process'
async function waitFor(child: ChildProcess) {
child.stdout.on('data', (data: Buffer) => {
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())
})
child.stderr.on('data', (data: Buffer) => {
}
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())
})
@@ -21,28 +38,26 @@ async function prepareRelease() {
await fs.remove(targetDir)
await fs.mkdirp(targetDir)
let process = spawn('git', ['clone', '.git', targetDir], { shell: true })
await waitFor(process)
// Create fresh clone of the local git repo
await exec('git', ['clone', '.git', targetDir])
// Enter git repo
chdir(targetDir)
// Install app dependencies
chdir('app')
process = spawn('yarn', [], { shell: true })
await waitFor(process)
await exec('yarn')
chdir('..')
// Install electron dependencies
process = spawn('yarn', [], { shell: true })
await waitFor(process)
await exec('yarn')
// Build App and Electron backend
process = spawn('yarn', ['build'], { shell: true })
await waitFor(process)
await exec('yarn', ['build'])
// Clean up
await fs.remove('node_modules')
process = spawn('yarn', ['install', '--production'], { shell: true })
await exec('yarn', ['install', '--production'])
await fs.remove(path.join('app', 'node_modules'))
chdir(originalDir)