2016-03-23 07:40:44 +03:00
|
|
|
// This module exports paths, names, and other metadata that is referenced
|
|
|
|
// throughout the build.
|
|
|
|
|
|
|
|
'use strict'
|
|
|
|
|
2016-08-02 15:04:45 +03:00
|
|
|
const fs = require('fs')
|
2016-03-23 07:40:44 +03:00
|
|
|
const path = require('path')
|
|
|
|
|
|
|
|
const repositoryRootPath = path.resolve(__dirname, '..')
|
2016-08-02 15:04:45 +03:00
|
|
|
const apmRootPath = path.join(repositoryRootPath, 'apm')
|
|
|
|
const scriptRootPath = path.join(repositoryRootPath, 'script')
|
2016-03-23 07:40:44 +03:00
|
|
|
const buildOutputPath = path.join(repositoryRootPath, 'out')
|
2016-08-03 18:45:43 +03:00
|
|
|
const docsOutputPath = path.join(repositoryRootPath, 'docs', 'output')
|
2016-07-28 03:47:33 +03:00
|
|
|
const intermediateAppPath = path.join(buildOutputPath, 'app')
|
2016-08-01 18:22:30 +03:00
|
|
|
const symbolsPath = path.join(buildOutputPath, 'symbols')
|
2016-08-11 13:18:33 +03:00
|
|
|
const electronDownloadPath = path.join(repositoryRootPath, 'electron')
|
2016-07-30 01:55:27 +03:00
|
|
|
const homeDirPath = process.env.HOME || process.env.USERPROFILE
|
2017-03-31 03:25:04 +03:00
|
|
|
const atomHomeDirPath = process.env.ATOM_HOME || path.join(homeDirPath, '.atom')
|
2016-03-23 07:40:44 +03:00
|
|
|
|
2016-08-02 15:04:45 +03:00
|
|
|
const appMetadata = require(path.join(repositoryRootPath, 'package.json'))
|
|
|
|
const apmMetadata = require(path.join(apmRootPath, 'package.json'))
|
|
|
|
const channel = getChannel()
|
|
|
|
|
2016-03-23 07:40:44 +03:00
|
|
|
module.exports = {
|
2017-01-25 19:13:42 +03:00
|
|
|
appMetadata,
|
|
|
|
apmMetadata,
|
|
|
|
channel,
|
|
|
|
repositoryRootPath,
|
|
|
|
apmRootPath,
|
|
|
|
scriptRootPath,
|
|
|
|
buildOutputPath,
|
|
|
|
docsOutputPath,
|
|
|
|
intermediateAppPath,
|
|
|
|
symbolsPath,
|
|
|
|
electronDownloadPath,
|
|
|
|
atomHomeDirPath,
|
|
|
|
homeDirPath,
|
|
|
|
getApmBinPath,
|
2017-03-24 07:27:57 +03:00
|
|
|
getNpmBinPath,
|
2017-03-09 16:23:58 +03:00
|
|
|
snapshotAuxiliaryData: {}
|
2016-03-23 07:40:44 +03:00
|
|
|
}
|
2016-07-28 19:52:23 +03:00
|
|
|
|
|
|
|
function getChannel () {
|
2016-09-01 10:47:42 +03:00
|
|
|
if (appMetadata.version.match(/dev/)) {
|
2016-07-28 19:52:23 +03:00
|
|
|
return 'dev'
|
|
|
|
} else if (appMetadata.version.match(/beta/)) {
|
|
|
|
return 'beta'
|
|
|
|
} else {
|
|
|
|
return 'stable'
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-08-02 15:04:45 +03:00
|
|
|
function getApmBinPath () {
|
|
|
|
const apmBinName = process.platform === 'win32' ? 'apm.cmd' : 'apm'
|
2016-08-02 15:55:34 +03:00
|
|
|
return path.join(apmRootPath, 'node_modules', 'atom-package-manager', 'bin', apmBinName)
|
2016-08-02 15:04:45 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
function getNpmBinPath () {
|
|
|
|
const npmBinName = process.platform === 'win32' ? 'npm.cmd' : 'npm'
|
|
|
|
const localNpmBinPath = path.resolve(repositoryRootPath, 'script', 'node_modules', '.bin', npmBinName)
|
|
|
|
return fs.existsSync(localNpmBinPath) ? localNpmBinPath : npmBinName
|
|
|
|
}
|