Build a binary to the /dist directory using the node module 'pkg'. Create a new directory for the platform and architecture of the host machine building the file.

This commit is contained in:
mmcw-dev 2019-01-03 21:58:24 -05:00
parent f34b1810de
commit 4aef3459ba
1 changed files with 21 additions and 0 deletions

21
build.js Normal file
View File

@ -0,0 +1,21 @@
'use strict'
const { exec } = require('pkg')
const os = require('os')
const fs = require('fs-extra')
const platform = os.platform()
const arch = os.arch()
//exec(args) takes an array of command line arguments and returns a promise. For example:
if (!fs.existsSync(`./dist/${platform}_${arch}`)) {
fs.mkdirSync(`./dist/${platform}_${arch}`)
}
exec([ 'frameloom', '--target', 'host', '--output', `./dist/${platform}_${arch}/frameloom` ]).then(res => {
console.log('built')
}).catch(err => {
console.error(err)
})
// do something with app.exe, run, test, upload, deploy, etc