#!/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.14.4',{silent:true}) await cmd.check_version('node','v12.18.0',{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()