chore: update package.json scripts for gn build and automated releases (#14612)

* Removes un-used and non-functional code coverage helpers
* Removes un-used release script aliases
* Moves TLS to a lib folder for cleaner directory structure
* Implements start.py as start.js for the GN build
* Adds a re-usable getElectronExec helper for future scripts
* Refactors spec runner to use the helper
This commit is contained in:
Samuel Attard 2018-09-14 02:57:39 +10:00 committed by GitHub
parent 774395d910
commit 238ea29fa8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 52 additions and 26 deletions

View file

@ -4,9 +4,10 @@ const fs = require('fs')
const { hashElement } = require('folder-hash')
const path = require('path')
const utils = require('./lib/utils')
const BASE = path.resolve(__dirname, '../..')
const NPM_CMD = process.platform === 'win32' ? 'npm.cmd' : 'npm'
const OUT_DIR = process.env.ELECTRON_SPEC_OUT_DIR || 'Default'
const specHashPath = path.resolve(__dirname, '../spec/.hash')
@ -20,7 +21,7 @@ getSpecHash().then(([currentSpecHash, currentSpecInstallHash]) => {
if (specChanged || installChanged) {
const out = cp.spawnSync(NPM_CMD, ['install'], {
env: Object.assign({}, process.env, {
npm_config_nodedir: path.resolve(BASE, `out/${OUT_DIR}/gen/node_headers`),
npm_config_nodedir: path.resolve(BASE, `out/${utils.OUT_DIR}/gen/node_headers`),
npm_config_msvs_version: '2017'
}),
cwd: path.resolve(__dirname, '../spec')
@ -35,7 +36,7 @@ getSpecHash().then(([currentSpecHash, currentSpecInstallHash]) => {
})
}
}).then(() => {
let exe = path.resolve(BASE, getElectronExec())
let exe = path.resolve(BASE, utils.getElectronExec())
const args = process.argv.slice(2)
if (process.platform === 'linux') {
args.unshift(path.resolve(__dirname, 'lib/dbus_mock.py'), exe)
@ -50,19 +51,6 @@ getSpecHash().then(([currentSpecHash, currentSpecInstallHash]) => {
})
})
function getElectronExec () {
switch (process.platform) {
case 'darwin':
return 'out/Default/Electron.app/Contents/MacOS/Electron'
case 'win32':
return 'out/Default/electron.exe'
case 'linux':
return 'out/Default/electron'
default:
throw new Error('Unknown path')
}
}
function getSpecHash () {
return Promise.all([
new Promise((resolve) => {