Update code formatting

This commit is contained in:
Thomas Nordquist
2019-06-15 14:56:57 +02:00
parent 6176859c7c
commit 92e045297e
115 changed files with 2988 additions and 1042 deletions

View File

@@ -3,7 +3,6 @@ import * as path from 'path'
import { chdir } from 'process'
import { exec } from './util'
interface Target {
name: 'appImage' | string
}

View File

@@ -12,7 +12,10 @@ async function cutScenes(scenes: Array<Scene>) {
fs.unlinkSync(outputFile)
}
await exec('ffmpeg', `-i app2.mp4 -ss ${scene.start / 1000} -t ${scene.duration / 1000} ${scene.name}.mp4`.split(' '))
await exec(
'ffmpeg',
`-i app2.mp4 -ss ${scene.start / 1000} -t ${scene.duration / 1000} ${scene.name}.mp4`.split(' ')
)
}
}
@@ -37,7 +40,7 @@ class TransitionBuilder {
return {
output: outputFile,
videos: this.scenes.map(s => `${s}.mp4`),
transistions: this.transitions.map(name => ({
transitions: this.transitions.map(name => ({
name: name !== 'none' ? name : 'fade',
duration: name !== 'none' ? 1000 : 10,
})),
@@ -47,7 +50,7 @@ class TransitionBuilder {
// const scenes: Array<Scene> = JSON.parse(fs.readFileSync('./scenes.json').toString())
// cutScenes(scenes)
let builder = new TransitionBuilder()
const builder = new TransitionBuilder()
.startWith('connect')
.transitionTo('numeric_plots', 'cube')
.transitionTo('diffs', 'pixelize')

View File

@@ -7,7 +7,9 @@ import * as mime from 'mime'
const githubToken = process.env.GH_TOKEN
async function tagUrl(tag: string): Promise<string | undefined> {
const response = await axios.get(`https://api.github.com/repos/thomasnordquist/mqtt-explorer/releases?access_token=${githubToken}`)
const response = await axios.get(
`https://api.github.com/repos/thomasnordquist/mqtt-explorer/releases?access_token=${githubToken}`
)
const tagRelease = response.data.find((release: any) => release.tag_name === tag)
return tagRelease ? cleanUploadUrl(tagRelease.upload_url) : undefined
@@ -29,8 +31,9 @@ async function createDraft(tag: string) {
return cleanUploadUrl(response.data.upload_url)
}
function cleanUploadUrl(url: string) {
return url.match(/(.*){/)![1]
function cleanUploadUrl(url: string): string | undefined {
const match = url.match(/(.*){/)
return match ? match[1] : undefined
}
async function uploadAsset() {

View File

@@ -1,6 +1,6 @@
import { spawn, ChildProcess } from 'child_process'
export async function exec(cmd: string, args: string[] = []) {
export async function exec(cmd: string, args: Array<string> = []) {
const child = spawn(cmd, args, { shell: true })
redirectOutputFor(child)
await waitFor(child)
@@ -23,7 +23,7 @@ function redirectOutputFor(child: ChildProcess) {
}
async function waitFor(child: ChildProcess) {
return new Promise((resolve) => {
return new Promise(resolve => {
child.once('close', () => resolve())
})
}