mirror of
https://github.com/enso-org/enso.git
synced 2024-12-20 22:31:29 +03:00
8b5cd73f4d
Original commit: c8bfe4296d
45 lines
1.4 KiB
JavaScript
Executable File
45 lines
1.4 KiB
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 skip_validation = '--skip-version-validation'
|
|
async function init () {
|
|
if(!args.includes(skip_validation)) {
|
|
cmd.section('Version Validation')
|
|
console.log("Use the `" + skip_validation + "` flag to skip it.")
|
|
console.log("Querying npm for the latest LTS versions.")
|
|
let [node_lts_version,npm_lts_version] = await cmd.get_node_lts_version()
|
|
console.log("Checking versions of installed packages.")
|
|
await cmd.check_version('node',node_lts_version)
|
|
await cmd.check_version('npm',npm_lts_version)
|
|
await cmd.check_version('rustc','1.40.0-nightly',{
|
|
preprocess:(v)=>v.substring(6,20)
|
|
})
|
|
}
|
|
|
|
let initialized = fss.existsSync(paths.dist.buildInit)
|
|
if (!initialized) {
|
|
cmd.section('Initialization')
|
|
console.log('Installing build script dependencies.')
|
|
await cmd.with_cwd('build', async () => {
|
|
await cmd.run('npm',['install'])
|
|
})
|
|
await fs.mkdir(paths.dist.root, {recursive:true})
|
|
await fs.open(paths.dist.buildInit,'w')
|
|
}
|
|
}
|
|
|
|
async function main() {
|
|
await init()
|
|
cmd.run('node',[paths.script.run].concat(args))
|
|
}
|
|
|
|
main()
|