enso/gui/run
2020-03-16 03:58:00 +01:00

38 lines
1018 B
JavaScript
Executable File

#!/usr/bin/env node
const cmd = require('./build/cmd')
const fs = require('fs').promises
const fss = require('fs')
const paths = require('./build/paths')
process.on('unhandledRejection', error => { throw(error) })
let args = process.argv.slice(2)
let no_validation = '--no-validation'
async function init () {
if(!args.includes(no_validation)) {
await cmd.check_version('npm','6.13.4',{silent:true})
await cmd.check_version('node','v12.16.1',{silent:true})
await cmd.check_version('rustc','1.40.0-nightly',{
preprocess:(v)=>v.substring(6,20),silent:true
})
}
let initialized = fss.existsSync(paths.dist.init)
if (!initialized) {
cmd.section('Initialization')
console.log('Installing build script dependencies.')
await cmd.with_cwd('build', async () => {
await cmd.run('npm',['install'])
})
}
}
async function main() {
await init()
cmd.run('node',[paths.script.run].concat(args))
}
main()