Files
atom/script/bootstrap

61 lines
1.7 KiB
JavaScript
Executable File

#!/usr/bin/env node
'use strict'
const path = require('path')
const CONFIG = require('./config')
const childProcess = require('child_process')
const cleanDependencies = require('./lib/clean-dependencies')
const deleteMsbuildFromPath = require('./lib/delete-msbuild-from-path')
const dependenciesFingerprint = require('./lib/dependencies-fingerprint')
const installApm = require('./lib/install-apm')
const runApmInstall = require('./lib/run-apm-install')
const installScriptDependencies = require('./lib/install-script-dependencies')
const verifyMachineRequirements = require('./lib/verify-machine-requirements')
process.on('unhandledRejection', function (e) {
console.error(e.stack || e)
process.exit(1)
})
verifyMachineRequirements()
if (dependenciesFingerprint.isOutdated()) {
cleanDependencies()
}
if (process.platform === 'win32') deleteMsbuildFromPath()
installScriptDependencies()
installApm()
childProcess.execFileSync(
CONFIG.getApmBinPath(),
['--version'],
{stdio: 'inherit'}
)
runApmInstall(CONFIG.repositoryRootPath)
if (!process.env.CI) {
const glob = require('glob')
const colors = require('colors')
var files = glob.sync(path.join(CONFIG.repositoryRootPath, 'packages/*/package.json'))
if (files.length > 0) {
console.log('Installing core packages for use in dev mode...')
files.forEach(file => {
const packageDir = path.dirname(file)
process.stdout.write(`Installing packages/${path.basename(packageDir)} `)
runApmInstall(path.dirname(file), true)
if (process.platform === 'win32') {
return process.stdout.write('done\n'.green);
} else {
return process.stdout.write('\u2713\n'.green);
}
})
}
}
dependenciesFingerprint.write()