This commit is contained in:
Wliu 2017-01-24 23:41:30 -05:00
parent 86b8f67879
commit 7bb08e39f3
17 changed files with 24 additions and 37 deletions

View File

@ -14,7 +14,7 @@ const yargs = require('yargs')
const argv = yargs
.usage('Usage: $0 [options]')
.help('help')
.describe('code-sign', 'Code-sign executables (macOS and Windows only)')
.describe('code-sign', 'Code-sign executables (macOS and Windows only)')
.describe('create-windows-installer', 'Create installer (Windows only)')
.describe('create-debian-package', 'Create .deb package (Linux only)')
.describe('create-rpm-package', 'Create .rpm package (Linux only)')
@ -71,8 +71,7 @@ dumpSymbols()
} else if (process.platform === 'win32') {
if (argv.createWindowsInstaller) {
return createWindowsInstaller(packagedAppPath, argv.codeSign).then(() => packagedAppPath)
}
else {
} else {
console.log('Skipping creating installer. Specify the --create-windows-installer option to create a Squirrel-based Windows installer. Code-signing was skipped too.'.gray)
}
} else if (process.platform === 'linux') {

View File

@ -9,14 +9,14 @@ module.exports = function () {
const fs = require('fs-extra')
const apmDependenciesPath = path.join(CONFIG.apmRootPath, 'node_modules')
console.log(`Cleaning ${apmDependenciesPath}`);
console.log(`Cleaning ${apmDependenciesPath}`)
fs.removeSync(apmDependenciesPath)
const atomDependenciesPath = path.join(CONFIG.repositoryRootPath, 'node_modules')
console.log(`Cleaning ${atomDependenciesPath}`);
console.log(`Cleaning ${atomDependenciesPath}`)
fs.removeSync(atomDependenciesPath)
const scriptDependenciesPath = path.join(CONFIG.scriptRootPath, 'node_modules')
console.log(`Cleaning ${scriptDependenciesPath}`);
console.log(`Cleaning ${scriptDependenciesPath}`)
fs.removeSync(scriptDependenciesPath)
}

View File

@ -10,8 +10,9 @@ module.exports = function (packagedAppPath) {
return
}
// This declaration is outside of the try block because it is also used for the finally block
const certPath = path.join(os.tmpdir(), 'mac.p12')
try {
const certPath = path.join(os.tmpdir(), 'mac.p12')
downloadFileFromGithub(process.env.ATOM_MAC_CODE_SIGNING_CERT_DOWNLOAD_URL, certPath)
console.log(`Unlocking keychain ${process.env.ATOM_MAC_CODE_SIGNING_KEYCHAIN}`)

View File

@ -10,7 +10,7 @@ const glob = require('glob')
const includePathInPackagedApp = require('./include-path-in-packaged-app')
module.exports = function () {
console.log(`Copying assets to ${CONFIG.intermediateAppPath}`);
console.log(`Copying assets to ${CONFIG.intermediateAppPath}`)
let srcPaths = [
path.join(CONFIG.repositoryRootPath, 'benchmarks', 'benchmark-runner.js'),
path.join(CONFIG.repositoryRootPath, 'dot-atom'),

View File

@ -2,7 +2,6 @@
const assert = require('assert')
const fs = require('fs-extra')
const os = require('os')
const path = require('path')
const spawnSync = require('./spawn-sync')
const template = require('lodash.template')

View File

@ -53,7 +53,7 @@ module.exports = function (packagedAppPath, codeSign) {
}
// Squirrel signs its own copy of the executables but we need them for the portable ZIP
const extractSignedExes = function() {
const extractSignedExes = function () {
if (signing) {
for (let nupkgPath of glob.sync(`${CONFIG.buildOutputPath}/*-full.nupkg`)) {
if (nupkgPath.includes(CONFIG.appMetadata.version)) {

View File

@ -7,13 +7,13 @@ module.exports = function () {
process.env['PATH'] =
process.env['PATH']
.split(';')
.filter(function(p) {
.filter(function (p) {
if (fs.existsSync(path.join(p, 'msbuild.exe'))) {
console.log('Excluding "' + p + '" from PATH to avoid msbuild.exe mismatch that causes errors during module installation')
return false;
return false
} else {
return true;
return true
}
})
.join(';');
.join(';')
}

View File

@ -27,8 +27,8 @@ function buildBundledPackagesMetadata () {
const packagePath = path.join(CONFIG.intermediateAppPath, 'node_modules', packageName)
const packageMetadataPath = path.join(packagePath, 'package.json')
const packageMetadata = JSON.parse(fs.readFileSync(packageMetadataPath, 'utf8'))
normalizePackageData(packageMetadata, () => {
throw new Error(`Invalid package metadata. ${metadata.name}: ${msg}`)
normalizePackageData(packageMetadata, (msg) => {
throw new Error(`Invalid package metadata. ${packageName}: ${msg}`)
}, true)
if (packageMetadata.repository && packageMetadata.repository.url && packageMetadata.repository.type === 'git') {
packageMetadata.repository.url = packageMetadata.repository.url.replace(/^git\+/, '')
@ -118,7 +118,7 @@ function checkDeprecatedPackagesMetadata () {
for (let packageName of Object.keys(deprecatedPackagesMetadata)) {
const packageMetadata = deprecatedPackagesMetadata[packageName]
if (packageMetadata.version && !semver.validRange(packageMetadata.version)) {
throw new Error(`Invalid range: ${version} (${name}).`)
throw new Error(`Invalid range: ${packageMetadata.version} (${packageName}).`)
}
}
}

View File

@ -20,7 +20,7 @@ module.exports = function () {
'with the following licenses:\n\n'
for (let packageName of Object.keys(packagesLicenses).sort()) {
const packageLicense = packagesLicenses[packageName]
text += "-------------------------------------------------------------------------\n\n"
text += '-------------------------------------------------------------------------\n\n'
text += `Package: ${packageName}\n`
text += `License: ${packageLicense.license}\n`
if (packageLicense.source) {

View File

@ -77,7 +77,7 @@ const EXCLUDE_REGEXPS_SOURCES = [
// Ignore test and example folders
'node_modules' + escapeRegExp(path.sep) + '.*' + escapeRegExp(path.sep) + '_*te?sts?_*' + escapeRegExp(path.sep),
'node_modules' + escapeRegExp(path.sep) + '.*' + escapeRegExp(path.sep) + 'examples?' + escapeRegExp(path.sep),
'node_modules' + escapeRegExp(path.sep) + '.*' + escapeRegExp(path.sep) + 'examples?' + escapeRegExp(path.sep)
]
// Ignore spec directories in all bundled packages
@ -95,5 +95,5 @@ const EXCLUDED_PATHS_REGEXP = new RegExp(
)
function escapeRegExp (string) {
return string.replace(/[.?*+^$[\]\\(){}|-]/g, "\\$&")
return string.replace(/[.?*+^$[\]\\(){}|-]/g, '\\$&')
}

View File

@ -1,7 +1,6 @@
'use strict'
const childProcess = require('child_process')
const path = require('path')
const CONFIG = require('../config')

View File

@ -1,7 +1,6 @@
'use strict'
const childProcess = require('child_process')
const path = require('path')
const CONFIG = require('../config')
@ -11,7 +10,7 @@ module.exports = function () {
installEnv.ATOM_RESOURCE_PATH = CONFIG.repositoryRootPath
// Set our target (Electron) version so that node-pre-gyp can download the
// proper binaries.
installEnv.npm_config_target = CONFIG.appMetadata.electronVersion;
installEnv.npm_config_target = CONFIG.appMetadata.electronVersion
childProcess.execFileSync(
CONFIG.getApmBinPath(),
['--loglevel=error', 'install'],

View File

@ -1,7 +1,6 @@
'use strict'
const childProcess = require('child_process')
const path = require('path')
const CONFIG = require('../config')

View File

@ -42,11 +42,11 @@ module.exports = function () {
path.join(CONFIG.intermediateAppPath, 'node_modules', syntaxTheme, 'styles'),
path.join(CONFIG.intermediateAppPath, 'node_modules', uiTheme, 'styles'),
path.join(CONFIG.intermediateAppPath, 'static', 'variables'),
path.join(CONFIG.intermediateAppPath, 'static'),
path.join(CONFIG.intermediateAppPath, 'static')
]
})
function cacheCompiledCSS(lessFilePath, importFallbackVariables) {
function cacheCompiledCSS (lessFilePath, importFallbackVariables) {
let lessSource = fs.readFileSync(lessFilePath, 'utf8')
if (importFallbackVariables) {
lessSource = FALLBACK_VARIABLE_IMPORTS + lessSource

View File

@ -6,15 +6,6 @@ const glob = require('glob')
const path = require('path')
const CONFIG = require('../config')
const BABEL_OPTIONS = require('../../static/babelrc.json')
const BABEL_PREFIXES = [
"'use babel'",
'"use babel"',
'/** @babel */',
'/* @flow */'
]
const PREFIX_LENGTH = Math.max.apply(null, BABEL_PREFIXES.map(prefix => prefix.length))
const BUFFER = Buffer(PREFIX_LENGTH)
module.exports = function () {
console.log(`Transpiling Babel paths in ${CONFIG.intermediateAppPath}`)

View File

@ -1,6 +1,6 @@
'use strict'
const peg = require("pegjs")
const peg = require('pegjs')
const fs = require('fs')
const glob = require('glob')
const path = require('path')

View File

@ -71,7 +71,7 @@ for (let packageName in CONFIG.appMetadata.packageDependencies) {
console.log(`Executing ${packageName} tests`.bold.green)
const cp = childProcess.spawn(executablePath, testArguments)
let stderrOutput = ''
cp.stderr.on('data', data => stderrOutput += data)
cp.stderr.on('data', data => (stderrOutput += data))
cp.on('error', error => { callback(error) })
cp.on('close', exitCode => {
if (exitCode !== 0) {