pulsar/script/config.js
Antonio Scandurra 8249dbbb79 Fix release channel detection on Travis
In the previous build scripts, we were considering all the builds
triggered by a pull-request to be part of the dev channel. We adopted
the same heuristic for the new build scripts, but didn't notice that
Travis always sets the `TRAVIS_PULL_REQUEST` variable to "false" (which
causes the `process.env.TRAVIS_PULL_REQUEST` expression to be evaluated
as truthy).

In the past, this wasn't a problem because we were building artifacts
via Janky, but after switching to Travis this makes it generate the
wrong assets on stable and beta.

To fix this, it seems reasonable to remove the conditional that checks
if we are building a pull-request: in the past this could have been
problematic because assets could be uploaded inadvertently to S3 or
GitHub, but this should be safe now that we rely on the release
publisher to perform that task.
2016-09-01 09:49:37 +02:00

52 lines
1.8 KiB
JavaScript

// This module exports paths, names, and other metadata that is referenced
// throughout the build.
'use strict'
const fs = require('fs')
const path = require('path')
const repositoryRootPath = path.resolve(__dirname, '..')
const apmRootPath = path.join(repositoryRootPath, 'apm')
const scriptRootPath = path.join(repositoryRootPath, 'script')
const buildOutputPath = path.join(repositoryRootPath, 'out')
const docsOutputPath = path.join(repositoryRootPath, 'docs', 'output')
const intermediateAppPath = path.join(buildOutputPath, 'app')
const symbolsPath = path.join(buildOutputPath, 'symbols')
const electronDownloadPath = path.join(repositoryRootPath, 'electron')
const homeDirPath = process.env.HOME || process.env.USERPROFILE
const atomHomeDirPath = path.join(homeDirPath, '.atom')
const appMetadata = require(path.join(repositoryRootPath, 'package.json'))
const apmMetadata = require(path.join(apmRootPath, 'package.json'))
const channel = getChannel()
module.exports = {
appMetadata, apmMetadata, channel,
repositoryRootPath, apmRootPath, scriptRootPath,
buildOutputPath, docsOutputPath, intermediateAppPath, symbolsPath,
electronDownloadPath, atomHomeDirPath, homeDirPath,
getApmBinPath, getNpmBinPath
}
function getChannel () {
if (appMetadata.version.match(/dev/)) {
return 'dev'
} else if (appMetadata.version.match(/beta/)) {
return 'beta'
} else {
return 'stable'
}
}
function getApmBinPath () {
const apmBinName = process.platform === 'win32' ? 'apm.cmd' : 'apm'
return path.join(apmRootPath, 'node_modules', 'atom-package-manager', 'bin', apmBinName)
}
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
}