pulsar/script/bootstrap
DeeDeeG e49879918f script/bootstrap: apm prints the current Atom ver
Lets apm know where this repository's Atom metadata is located,
so that `apm --version` prints the version of Atom being bootstrapped.

Previously, this would print "unknown" if no Atom was installed to the
system, or whatever stable version was installed...
which was irrelevant info during the bootstrapping process.

This should be more straightforward, and less confusing.
2020-09-30 12:34:10 -04:00

50 lines
1.5 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)
})
// We can't use yargs until installScriptDependencies() is executed, so...
let ci = process.argv.indexOf('--ci') !== -1
if (!ci && process.env.CI === 'true' && process.argv.indexOf('--no-ci') === -1) {
console.log('Automatically enabling --ci because CI is set in the environment')
ci = true
}
verifyMachineRequirements(ci)
if (dependenciesFingerprint.isOutdated()) {
cleanDependencies()
}
if (process.platform === 'win32') deleteMsbuildFromPath()
installScriptDependencies(ci)
installApm(ci)
const apmVersionEnv = Object.assign({}, process.env);
// Set resource path so that apm can load Atom's version.
apmVersionEnv.ATOM_RESOURCE_PATH = CONFIG.repositoryRootPath;
childProcess.execFileSync(
CONFIG.getApmBinPath(),
['--version'],
{stdio: 'inherit', env: apmVersionEnv}
)
runApmInstall(CONFIG.repositoryRootPath, ci)
dependenciesFingerprint.write()