From a07169b230be0580f2c475bcda4caad2b56bc160 Mon Sep 17 00:00:00 2001 From: Fabian Date: Thu, 23 Nov 2017 16:36:26 +0100 Subject: [PATCH 1/9] make it work --- README.md | 8 + test/e2e/gaia-1/config.toml | 23 +++ test/e2e/gaia-1/genesis.json | 370 +++++++++++++++++++++++++++++++++++ test/e2e/launch.js | 4 +- test/e2e/main.js | 4 +- 5 files changed, 405 insertions(+), 4 deletions(-) create mode 100644 test/e2e/gaia-1/config.toml create mode 100644 test/e2e/gaia-1/genesis.json diff --git a/README.md b/README.md index 0806154865..03c3afdcdd 100644 --- a/README.md +++ b/README.md @@ -73,6 +73,14 @@ i.e.: ```bash $ npm i -g http-server $ http-server test/unit/coverage/lcov-report +``` + +To test the running application e2e: + +```bash +$ npm run pack +$ npm run test:e2e +``` ## Debug diff --git a/test/e2e/gaia-1/config.toml b/test/e2e/gaia-1/config.toml new file mode 100644 index 0000000000..63bdd5d136 --- /dev/null +++ b/test/e2e/gaia-1/config.toml @@ -0,0 +1,23 @@ +# This is a TOML config file. +# For more information, see https://github.com/toml-lang/toml + +proxy_app = "tcp://127.0.0.1:46658" +moniker = "46.101.170.77" +fast_sync = true + +db_backend = "leveldb" +log_level = "state:info,*:error" +#log_level = "*:debug" + + +[rpc] +laddr = "tcp://0.0.0.0:46657" + + +[consensus] +create_empty_blocks_interval = 60 + + +[p2p] +laddr = "tcp://0.0.0.0:46656" +seeds = "159.203.14.24:46656,178.62.54.176:46656,138.197.10.42:46656,188.166.186.94:46656,165.227.28.93:46656,146.185.183.200:46656" diff --git a/test/e2e/gaia-1/genesis.json b/test/e2e/gaia-1/genesis.json new file mode 100644 index 0000000000..8cf033202c --- /dev/null +++ b/test/e2e/gaia-1/genesis.json @@ -0,0 +1,370 @@ +{ + "genesis_time":"2017-11-06T17:29:06Z", + "chain_id":"gaia-1", + "validators": + [ + + { + "pub_key": { + "data": "435564E80E3A8307E232542852A630A27353F7DE092E171A7CD591F78CE926A4", + "type": "ed25519" + }, + "power":1000, + "name":"46.101.170.77" + } + , + { + "pub_key": { + "data": "475D54E3AEE5A654B93FF9AF40E70AE3447914A67B80D2022C127CF176986B3F", + "type": "ed25519" + }, + "power":1000, + "name":"159.203.14.24" + } + , + { + "pub_key": { + "data": "C68D1D47794B9180C3ADDDCE5994F8544E3E5EA570B94428C066A9D95DA5CCEE", + "type": "ed25519" + }, + "power":1000, + "name":"178.62.54.176" + } + , + { + "pub_key": { + "data": "89BAFB4086BFB3D2DC66EF6B68429C29579AB4FA0886766FBE86B59550C3E361", + "type": "ed25519" + }, + "power":1000, + "name":"138.197.10.42" + } + , + { + "pub_key": { + "data": "A50B536E1FF39E205376E3AFDB5E064A41BD3F8DE9DC659D85F9EE7BFC1E1619", + "type": "ed25519" + }, + "power":1000, + "name":"188.166.186.94" + } + , + { + "pub_key": { + "data": "E3DFFA33A97E48EE0F22567BD3B90FB016FE38990DF41AAB9F8124B3EF7C68DD", + "type": "ed25519" + }, + "power":1000, + "name":"165.227.28.93" + } + , + { + "pub_key": { + "data": "B04847636E353C250B3E256FCB1B7182B73873F9359E6A8FDB95FF92A2061DD1", + "type": "ed25519" + }, + "power":1000, + "name":"146.185.183.200" + } + ], + "app_hash":"", + "app_options": { + "accounts": [ + { + "name": "relay", + "address": "1B1BE55F969F54064628A63B9559E7C21C925165", + "pub_key": { + "type": "ed25519", + "data": "619D3678599971ED29C7529DDD4DA537B97129893598A17C82E3AC9A8BA95279" + }, + "coins": [ + { + "denom": "mycoin", + "amount": 9007199254740992 + } + ] + }, + { + "name": "greg", + "address": "B01C264BFE9CBD45458256E613A6F07061A3A6B6", + "pub_key": { + "type": "ed25519", + "data": "E1FFBD187FA2A922CE1B367532CEAC1AD8E606D576AB0D2E2CAA7EC6B7DAC10F" + }, + "coins": [ + { + "denom": "fermion", + "amount": 1000000 + }, + { + "denom": "gregcoin", + "amount": 1000 + } + ] + }, + { + "name": "monitor1", + "address": "CE456B8BA9AFD1CBDF4ED14558E8C30691E549EA", + "coins": [ + { + "denom": "fermion", + "amount": 100 + }, + { + "denom": "moncoin", + "amount": 600000 + }, + { + "denom": "leadertoken", + "amount": 1 + } + ] + }, + { + "name": "monitor2", + "address": "EF708182E21F893634FD8DCB82A5128E16C76B83", + "coins": [ + { + "denom": "fermion", + "amount": 100 + }, + { + "denom": "moncoin", + "amount": 0 + }, + { + "denom": "leadertoken", + "amount": 0 + } + ] + }, + { + "name": "anton", + "address": "40CC622438D3E42148A1FFD3A27C07C100F8FA3D", + "pub_key": { + "type": "ed25519", + "data": "97BD389257763747488803DC686A8819C685936A3CD275D54EABEE51E0117EE6" + }, + "coins": [ + { + "denom": "fermion", + "amount": 100 + }, + { + "denom": "antoncoin", + "amount": 1000 + } + ] + }, + { + "name": "adrian", + "address": "4548017683F771FDBCF7D8E74F4723868AA20009", + "coins": [ + { + "denom": "fermion", + "amount": 100 + }, + { + "denom": "adriancoin", + "amount": 1000 + } + ] + }, + { + "name": "bucky", + "address": "2B24DEE2364762300168DF19B6C18BCE2D399EA2", + "coins": [ + { + "denom": "fermion", + "amount": 10000 + }, + { + "denom": "buckycoin", + "amount": 1000 + } + ] + }, + { + "name": "bucky-new", + "address": "4FE8FFE12EDBA34BE4E587B2125177AC24594BAF", + "coins": [ + { + "denom": "fermion", + "amount": 10000000000 + }, + { + "denom": "buckycoin", + "amount": 2000 + } + ] + }, + { + "name": "rigel", + "address": "C7A6F5FD77DDCA5C43600F33D14533A27C683F55", + "coins": [ + { + "denom": "rigelcoin", + "amount": 1000 + }, + { + "denom": "fermion", + "amount": 10000 + } + ] + }, + { + "name": "rigel2", + "address": "5B228AB64E290F1FC4D3E933B7623CCA3F015C34", + "coins": [ + { + "denom": "rigelcoin", + "amount": 1000 + }, + { + "denom": "fermion", + "amount": 10000 + } + ] + }, + { + "name": "shadow", + "address": "B140EFAAE6D5CA1C8E98814C557AF7112E3B9EAE", + "pub_key": { + "type": "ed25519", + "data": "F492282705DF29ACC3BB803D543B7BF98C8080FA28AE85B62B45827EA9DA8167" + }, + "coins": [ + { + "denom": "fermion", + "amount": 100 + }, + { + "denom": "shadowcoin", + "amount": 1000 + } + ] + }, + { + "name": "peng", + "address": "7B8422A210D0F0B8734908C093ECF0E9A768BDB8", + "coins": [ + { + "denom": "fermion", + "amount": 100 + }, + { + "denom": "pengcoin", + "amount": 1000 + } + ] + }, + { + "name": "matt", + "address": "C2104A8191E282AA45D210BA93282B36768EDDA1", + "coins": [ + { + "denom": "fermion", + "amount": 100 + }, + { + "denom": "mattcoin", + "amount": 1000 + } + ] + }, + { + "name": "frey", + "address": "0F8FB94B5A4D04220F15058B7AA16AF1328B57A9", + "coins": [ + { + "denom": "fermion", + "amount": 100 + }, + { + "denom": "freycoin", + "amount": 1000 + } + ] + }, + { + "name": "wancloud", + "address": "02C1F2CE501DAF30F758E657B71FC7AD568C4BE5", + "coins": [ + { + "denom": "fermion", + "amount": 100 + }, + { + "denom": "wancloudcoin", + "amount": 1000 + } + ] + }, + { + "name": "bianjie", + "address": "7D626173FAA69D96E56523A333EAF78F87843CE5", + "coins": [ + { + "denom": "fermion", + "amount": 100 + }, + { + "denom": "bianjiecoin", + "amount": 1000 + } + ] + }, + { + "name": "alexis", + "address": "42989458D3285F05FE0233EE669A1CCD90AE6F3E", + "coins": [ + { + "denom": "fermion", + "amount": 100 + }, + { + "denom": "alexiscoin", + "amount": 1000 + } + ] + }, + { + "name": "zaki", + "address": "E2080141FEAD5986FD411121CA077F2835294F5A", + "coins": [ + { + "denom": "fermion", + "amount": 100 + }, + { + "denom": "zakicoin", + "amount": 1000 + } + ] + }, + { + "name": "jimyang", + "address": "6F94C5B7FEB6EF926A8901A8E8F4B2077D02B354", + "coins": [ + { + "denom": "fermion", + "amount": 1000 + } + ] + }, + { + "name": "MichaelYuan", + "address": "F75D0FD7036A3BB9092DD0938BBF0A9323224832", + "coins": [ + { + "denom": "fermion", + "amount": 100000 + } + ] + } + + ], + "plugin_options": [ + "coin/issuer", {"app": "sigs", "addr": "B01C264BFE9CBD45458256E613A6F07061A3A6B6"} + ] } +} diff --git a/test/e2e/launch.js b/test/e2e/launch.js index a07108856a..8c7b523357 100644 --- a/test/e2e/launch.js +++ b/test/e2e/launch.js @@ -18,7 +18,7 @@ module.exports = async function launch (t) { app = new Application({ path: electron, args: [ - join(__dirname, '../app/dist/main.js'), + join(__dirname, '../../app/dist/main.js'), '--disable-gpu', '--no-sandbox' ], @@ -27,7 +27,7 @@ module.exports = async function launch (t) { env: { COSMOS_TEST: 'true', COSMOS_HOME: home, - COSMOS_NETWORK: join(__dirname, 'localtestnet') + COSMOS_NETWORK: join(__dirname, 'gaia-1') } }) diff --git a/test/e2e/main.js b/test/e2e/main.js index b740aa475c..fc532ce33a 100644 --- a/test/e2e/main.js +++ b/test/e2e/main.js @@ -9,11 +9,11 @@ console.error(`ui home: ${home}`) Object.assign(process.env, { COSMOS_TEST: 'true', COSMOS_HOME: home, - COSMOS_NETWORK: join(__dirname, 'localtestnet') + COSMOS_NETWORK: join(__dirname, 'gaia-1') }) test('main', async function (t) { - let main = proxyquire('../app/dist/main', { + let main = proxyquire('../../app/dist/main', { electron: { app: { on: () => {}, From 4355332b0fad750ba3fceee46d04f29d41412cbe Mon Sep 17 00:00:00 2001 From: Fabian Date: Fri, 24 Nov 2017 11:49:45 +0100 Subject: [PATCH 2/9] make electron packager use yarn for pruning --- config.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/config.js b/config.js index b3d7e67e82..adfada43f7 100644 --- a/config.js +++ b/config.js @@ -24,7 +24,8 @@ let config = { ignore: /^\/(src|index\.ejs|icons)/, out: path.join(__dirname, 'builds'), overwrite: true, - platform: process.env.PLATFORM_TARGET || 'all' + platform: process.env.PLATFORM_TARGET || 'all', + packageManager: 'yarn' } } From cb7963bb91a1ce66e19971e3f2c0c73516fc992b Mon Sep 17 00:00:00 2001 From: Fabian Date: Fri, 24 Nov 2017 12:57:55 +0100 Subject: [PATCH 3/9] remove progress output from packaging annoying and spams log --- package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 168cfdc7ea..3b3db0b51f 100644 --- a/package.json +++ b/package.json @@ -18,8 +18,8 @@ "lint": "eslint --ext .js,.vue -f ./node_modules/eslint-friendly-formatter app test", "lint:fix": "eslint --ext .js,.vue -f ./node_modules/eslint-friendly-formatter --fix app test", "pack": "npm run pack:main && npm run pack:renderer", - "pack:main": "cross-env NODE_ENV=production webpack --progress --colors --config webpack.main.config.js", - "pack:renderer": "cross-env NODE_ENV=production webpack --progress --colors --config webpack.renderer.config.js", + "pack:main": "cross-env NODE_ENV=production webpack --colors --config webpack.main.config.js", + "pack:renderer": "cross-env NODE_ENV=production webpack --colors --config webpack.renderer.config.js", "test": "npm run test:unit", "test:unit": "cross-env LOGGING=false jest", "test:e2e": "tape \"test/e2e/!(main)*.js\"", From 78352689b95467b84a84e45ed7d66312a49a7c1c Mon Sep 17 00:00:00 2001 From: Fabian Date: Fri, 24 Nov 2017 13:07:17 +0100 Subject: [PATCH 4/9] stop build if pack fails --- tasks/release.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tasks/release.js b/tasks/release.js index 7b83eb62fd..fb346b7b58 100644 --- a/tasks/release.js +++ b/tasks/release.js @@ -21,7 +21,11 @@ function pack () { pack.stdout.on('data', data => console.log(data)) pack.stderr.on('data', data => console.error(data)) - pack.on('exit', code => build()) + pack.on('exit', code => { + if (code === null || code <= 0) { + build() + } + }) } /** From ea23f227d2aa07f0f0e62e1a5bda4ffaa39958aa Mon Sep 17 00:00:00 2001 From: Fabian Date: Fri, 24 Nov 2017 16:39:21 +0100 Subject: [PATCH 5/9] removing not working builds for now --- config.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config.js b/config.js index adfada43f7..64224bcc7f 100644 --- a/config.js +++ b/config.js @@ -24,7 +24,7 @@ let config = { ignore: /^\/(src|index\.ejs|icons)/, out: path.join(__dirname, 'builds'), overwrite: true, - platform: process.env.PLATFORM_TARGET || 'all', + platform: process.env.PLATFORM_TARGET || 'darwin,linux', packageManager: 'yarn' } } From b7fa674de93af668f04f81609c8de486e2ba789a Mon Sep 17 00:00:00 2001 From: Fabian Date: Fri, 24 Nov 2017 16:39:44 +0100 Subject: [PATCH 6/9] fixing problem with compiling go packages for "mas" --- tasks/release.js | 1 + 1 file changed, 1 insertion(+) diff --git a/tasks/release.js b/tasks/release.js index fb346b7b58..83254e5fe9 100644 --- a/tasks/release.js +++ b/tasks/release.js @@ -60,6 +60,7 @@ const GOARCH = { function goBuild (pkg) { return function (buildPath, electronVersion, platform, arch, cb) { if (platform === 'win32') platform = 'windows' + if (platform === 'mas') platform = 'darwin' if (GOARCH[arch]) arch = GOARCH[arch] let name = path.basename(pkg) From 764297453c05947104efaee8ba89350bb0c4c0a9 Mon Sep 17 00:00:00 2001 From: Fabian Date: Fri, 1 Dec 2017 12:35:54 +0100 Subject: [PATCH 7/9] added section on used environment variables --- README.md | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/README.md b/README.md index 002521c6bd..ad0f0a476f 100644 --- a/README.md +++ b/README.md @@ -98,6 +98,22 @@ To debug the electron view, set the environment variable `COSMOS_DEVTOOLS` to so To see the console output of the view in your terminal, set the environment variable `ELECTRON_ENABLE_LOGGING` to something truthy like `1`. +## Flags + +A list of all environment variables and their purpose: + +|Variable|Values|default|Purpose| +|--|--|--|--| +|NODE_ENV|'production', 'development'||| +|LOGGING|'true', 'false'|'true'|Disable logging| +|MOCK|'true', 'false'|'true' in development|Mock data to receive from the chain| +|COSMOS_TEST|'true', 'false'|'false'|Disable code that influences unit tests, like logging to files| +|COSMOS_NETWORK|{path to network configuration folder}|'../networks/gaia-1'|Network to connect to| +|COSMOS_UI_ONLY|'true', 'false'|'false'|Ignore spinning up the tendermint binaries| +|COSMOS_HOME|{path to config persistence folder}|'$HOME/cosmos-ui[-dev]'|| +|PLATFORM_TARGET|'all', 'win32', 'darwin', 'linux', 'mas'|'all'|Which platform to build for| + + ## FAQ - If tendermint crashes and the log shows "Tendermint state.AppHash does not match AppHash after replay." delete the config folders at $HOME/.cosmos-ui[-dev]. From 281d359cef1d1e6a34e34fb55edab1c2eabb6a0f Mon Sep 17 00:00:00 2001 From: Fabian Date: Fri, 1 Dec 2017 15:52:51 +0100 Subject: [PATCH 8/9] working build on windows --- README.md | 7 +++ app/src/renderer/node.js | 2 +- package.json | 2 +- tasks/release.js | 27 ++++++++++- yarn.lock | 99 ++++++++++++++++++++++++++++++++-------- 5 files changed, 116 insertions(+), 21 deletions(-) diff --git a/README.md b/README.md index e1bdc043c7..04611a4e09 100644 --- a/README.md +++ b/README.md @@ -67,6 +67,11 @@ npm run pack && npm run build:darwin open builds/cosmos-ui-darwin-x64/cosmos-ui.app ``` +When you are testing the build system you can skip the repackaging of the JS files with: +```bash +$ npm run build -- --skip-pack +``` + ## Testing To test you need to first package the web content of the app, as this content can only be used bundled by the electron instance. @@ -120,6 +125,8 @@ A list of all environment variables and their purpose: |COSMOS_UI_ONLY|'true', 'false'|'false'|Ignore spinning up the tendermint binaries| |COSMOS_HOME|{path to config persistence folder}|'$HOME/cosmos-ui[-dev]'|| |PLATFORM_TARGET|'all', 'win32', 'darwin', 'linux', 'mas'|'all'|Which platform to build for| +|COSMOS_DEVTOOLS|'true', 'false'|'false'|Open the debug panel in the electron view| +|ELECTRON_ENABLE_LOGGING|'true', 'false'|'false'|Redirect the browser view console output to the console| ## FAQ diff --git a/app/src/renderer/node.js b/app/src/renderer/node.js index 636075b256..4bd28671b1 100644 --- a/app/src/renderer/node.js +++ b/app/src/renderer/node.js @@ -27,7 +27,7 @@ module.exports = async function (nodeIP) { const RestClient = require('cosmos-sdk') const RpcClient = require('tendermint') - let rest = RestClient(MOCK ? 'http://localhost:8999' : null) + let rest = RestClient(MOCK ? 'http://localhost:8999' : undefined) let rpc = RpcClient(`ws://${nodeIP}`) // TODO: handle disconnect, try to reconnect // TODO: eventually, get all data from light-client connection instead of RPC diff --git a/package.json b/package.json index 696f05ded6..e8a661631a 100644 --- a/package.json +++ b/package.json @@ -53,7 +53,7 @@ "electron-debug": "^1.4.0", "electron-devtools-installer": "^2.1.0", "electron-installer-dmg": "^0.2.1", - "electron-packager": "^8.5.0", + "electron-packager": "^10.1.0", "electron-rebuild": "^1.5.7", "eslint": "^3.13.1", "eslint-config-standard": "^6.2.1", diff --git a/tasks/release.js b/tasks/release.js index 83254e5fe9..c04246ab7a 100644 --- a/tasks/release.js +++ b/tasks/release.js @@ -3,13 +3,29 @@ const { exec } = require('child_process') const path = require('path') const packager = require('electron-packager') +const rebuild = require('electron-rebuild').default const mkdirp = require('mkdirp').sync +let skipPack = false +// let binaryPath = null +process.argv.forEach(function (val) { + if (val === '--skip-pack') { + skipPack = true + } + // if (val.startsWith('--binary')) { + // binaryPath = val.replace('--binary=', '') + // } +}) + if (process.env.PLATFORM_TARGET === 'clean') { require('del').sync(['builds/*', '!.gitkeep']) console.log('\x1b[33m`builds` directory cleaned.\n\x1b[0m') } else { - pack() + if (skipPack) { + build() + } else { + pack() + } } /** @@ -37,6 +53,15 @@ function build () { options.afterCopy = [ goBuild(`github.com/cosmos/gaia/cmd/gaia`) ] + // prune installs the packages + options.afterPrune = [ + function rebuildNodeModules (buildPath, electronVersion, platform, arch, callback) { + // we need to rebuild some native packages for the electron environment + rebuild({ buildPath, electronVersion, arch }) + .then(callback) + .catch(callback) + } + ] console.log('\x1b[34mBuilding electron app(s)...\n\x1b[0m') packager(options, (err, appPaths) => { diff --git a/yarn.lock b/yarn.lock index b0a3de869f..e5dabf269a 100644 --- a/yarn.lock +++ b/yarn.lock @@ -159,6 +159,10 @@ ansi-styles@~1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-1.0.0.tgz#cb102df1c56f5123eab8b67cd7b98027a0279178" +any-promise@^1.0.0: + version "1.3.0" + resolved "https://registry.yarnpkg.com/any-promise/-/any-promise-1.3.0.tgz#abc6afeedcea52e809cdc0376aed3ce39635d17f" + anymatch@^1.3.0: version "1.3.2" resolved "https://registry.yarnpkg.com/anymatch/-/anymatch-1.3.2.tgz#553dcb8f91e3c889845dfdba34c77721b90b9d7a" @@ -288,9 +292,9 @@ asap@~2.0.3: version "2.0.6" resolved "https://registry.yarnpkg.com/asap/-/asap-2.0.6.tgz#e50347611d7e690943208bbdafebcbc2fb866d46" -asar@^0.13.0: - version "0.13.1" - resolved "https://registry.yarnpkg.com/asar/-/asar-0.13.1.tgz#dfc73f574a7db256b09ba62d1f0e95cd4a6cb8d3" +asar@^0.14.0: + version "0.14.0" + resolved "https://registry.yarnpkg.com/asar/-/asar-0.14.0.tgz#998b36a26abd0e590e55d9f92cfd3fd7a6051652" dependencies: chromium-pickle-js "^0.2.0" commander "^2.9.0" @@ -365,6 +369,10 @@ attempt-x@^1.1.0, attempt-x@^1.1.1: version "1.1.1" resolved "https://registry.yarnpkg.com/attempt-x/-/attempt-x-1.1.1.tgz#fba64e96ce03c3e0bd92c92622061c4df387cb76" +author-regex@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/author-regex/-/author-regex-1.0.0.tgz#d08885be6b9bbf9439fe087c76287245f0a81450" + autoprefixer@^6.3.1: version "6.7.7" resolved "https://registry.yarnpkg.com/autoprefixer/-/autoprefixer-6.7.7.tgz#1dbd1c835658e35ce3f9984099db00585c782014" @@ -2045,7 +2053,7 @@ de-indent@^1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/de-indent/-/de-indent-1.0.2.tgz#b2038e846dc33baa5796128d0804b455b8c1e21d" -debug@*, debug@^3.1.0: +debug@*, debug@^3.0.0, debug@^3.1.0: version "3.1.0" resolved "https://registry.yarnpkg.com/debug/-/debug-3.1.0.tgz#5bb5a0672628b64149566ba16819e61518c67261" dependencies: @@ -2435,24 +2443,28 @@ electron-osx-sign@^0.4.1: minimist "^1.2.0" plist "^2.1.0" -electron-packager@^8.5.0: - version "8.7.2" - resolved "https://registry.yarnpkg.com/electron-packager/-/electron-packager-8.7.2.tgz#457d3bf24bc9607c06ad4b1eb6daa4accadc2108" +electron-packager@^10.1.0: + version "10.1.0" + resolved "https://registry.yarnpkg.com/electron-packager/-/electron-packager-10.1.0.tgz#b7ce2940e949dbde0dac8fb20afcb9d3d9819f94" dependencies: - asar "^0.13.0" - debug "^2.2.0" + asar "^0.14.0" + debug "^3.0.0" electron-download "^4.0.0" electron-osx-sign "^0.4.1" extract-zip "^1.0.3" - fs-extra "^3.0.0" + fs-extra "^4.0.0" get-package-info "^1.0.0" - minimist "^1.1.1" + mz "^2.6.0" + nodeify "^1.0.1" + parse-author "^2.0.0" + pify "^3.0.0" plist "^2.0.0" + pruner "^0.0.7" rcedit "^0.9.0" resolve "^1.1.6" - run-series "^1.1.1" sanitize-filename "^1.6.0" semver "^5.3.0" + yargs-parser "^8.0.0" electron-rebuild@^1.5.7: version "1.6.0" @@ -3195,7 +3207,7 @@ fs-extra@^2.0.0: graceful-fs "^4.1.2" jsonfile "^2.1.0" -fs-extra@^3.0.0, fs-extra@^3.0.1: +fs-extra@^3.0.1: version "3.0.1" resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-3.0.1.tgz#3794f378c58b342ea7dbbb23095109c4b3b62291" dependencies: @@ -3203,7 +3215,7 @@ fs-extra@^3.0.0, fs-extra@^3.0.1: jsonfile "^3.0.0" universalify "^0.1.0" -fs-extra@^4.0.2: +fs-extra@^4.0.0, fs-extra@^4.0.2: version "4.0.2" resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-4.0.2.tgz#f91704c53d1b461f893452b0c307d9997647ab6b" dependencies: @@ -4117,6 +4129,10 @@ is-promise@^2.0.0, is-promise@^2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/is-promise/-/is-promise-2.1.0.tgz#79a2a9ece7f096e80f36d2b2f3bc16c1ff4bf3fa" +is-promise@~1, is-promise@~1.0.0: + version "1.0.1" + resolved "https://registry.yarnpkg.com/is-promise/-/is-promise-1.0.1.tgz#31573761c057e33c2e91aab9e96da08cefbe76e5" + is-property@^1.0.0: version "1.0.2" resolved "https://registry.yarnpkg.com/is-property/-/is-property-1.0.2.tgz#57fe1c4e48474edd65b09911f26b1cd4095dda84" @@ -5368,6 +5384,14 @@ mute-stream@0.0.7: version "0.0.7" resolved "https://registry.yarnpkg.com/mute-stream/-/mute-stream-0.0.7.tgz#3075ce93bc21b8fab43e1bc4da7e8115ed1e7bab" +mz@^2.6.0: + version "2.7.0" + resolved "https://registry.yarnpkg.com/mz/-/mz-2.7.0.tgz#95008057a56cafadc2bc63dde7f9ff6955948e32" + dependencies: + any-promise "^1.0.0" + object-assign "^4.0.1" + thenify-all "^1.0.0" + nan-x@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/nan-x/-/nan-x-1.0.0.tgz#0ee78e8d1cd0592d5b4260a5940154545c61c121" @@ -5501,6 +5525,13 @@ node-pre-gyp@^0.6.39: tar "^2.2.1" tar-pack "^3.4.0" +nodeify@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/nodeify/-/nodeify-1.0.1.tgz#64ab69a7bdbaf03ce107b4f0335c87c0b9e91b1d" + dependencies: + is-promise "~1.0.0" + promise "~1.3.0" + nomnomnomnom@^2.0.0: version "2.0.1" resolved "https://registry.yarnpkg.com/nomnomnomnom/-/nomnomnomnom-2.0.1.tgz#b2239f031c8d04da67e32836e1e3199e12f7a8e2" @@ -5822,6 +5853,12 @@ parse-asn1@^5.0.0: evp_bytestokey "^1.0.0" pbkdf2 "^3.0.3" +parse-author@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/parse-author/-/parse-author-2.0.0.tgz#d3460bf1ddd0dfaeed42da754242e65fb684a81f" + dependencies: + author-regex "^1.0.0" + parse-color@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/parse-color/-/parse-color-1.0.0.tgz#7b748b95a83f03f16a94f535e52d7f3d94658619" @@ -6324,6 +6361,12 @@ promise@^7.0.1: dependencies: asap "~2.0.3" +promise@~1.3.0: + version "1.3.0" + resolved "https://registry.yarnpkg.com/promise/-/promise-1.3.0.tgz#e5cc9a4c8278e4664ffedc01c7da84842b040175" + dependencies: + is-promise "~1" + property-is-enumerable-x@^1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/property-is-enumerable-x/-/property-is-enumerable-x-1.1.0.tgz#7ca48917476cd0914b37809bfd05776a0d942f6f" @@ -6358,6 +6401,12 @@ prr@~1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/prr/-/prr-1.0.1.tgz#d3fc114ba06995a45ec6893f484ceb1d78f5f476" +pruner@^0.0.7: + version "0.0.7" + resolved "https://registry.yarnpkg.com/pruner/-/pruner-0.0.7.tgz#345fbcb3e80701163a1d7adf56bac229a5a1e4c1" + dependencies: + fs-extra "^4.0.0" + pseudomap@^1.0.1, pseudomap@^1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/pseudomap/-/pseudomap-1.0.2.tgz#f052a28da70e618917ef0a8ac34c1ae5a68286b3" @@ -6955,10 +7004,6 @@ run-async@^2.2.0: dependencies: is-promise "^2.1.0" -run-series@^1.1.1: - version "1.1.4" - resolved "https://registry.yarnpkg.com/run-series/-/run-series-1.1.4.tgz#89a73ddc5e75c9ef8ab6320c0a1600d6a41179b9" - rx-lite-aggregates@^4.0.8: version "4.0.8" resolved "https://registry.yarnpkg.com/rx-lite-aggregates/-/rx-lite-aggregates-4.0.8.tgz#753b87a89a11c95467c4ac1626c4efc4e05c67be" @@ -7732,6 +7777,18 @@ text-table@^0.2.0, text-table@~0.2.0: version "0.2.0" resolved "https://registry.yarnpkg.com/text-table/-/text-table-0.2.0.tgz#7f5ee823ae805207c00af2df4a84ec3fcfa570b4" +thenify-all@^1.0.0: + version "1.6.0" + resolved "https://registry.yarnpkg.com/thenify-all/-/thenify-all-1.6.0.tgz#1a1918d402d8fc3f98fbf234db0bcc8cc10e9726" + dependencies: + thenify ">= 3.1.0 < 4" + +"thenify@>= 3.1.0 < 4": + version "3.3.0" + resolved "https://registry.yarnpkg.com/thenify/-/thenify-3.3.0.tgz#e69e38a1babe969b0108207978b9f62b88604839" + dependencies: + any-promise "^1.0.0" + throat@^4.0.0: version "4.1.0" resolved "https://registry.yarnpkg.com/throat/-/throat-4.1.0.tgz#89037cbc92c56ab18926e6ba4cbb200e15672a6a" @@ -8578,6 +8635,12 @@ yargs-parser@^7.0.0: dependencies: camelcase "^4.1.0" +yargs-parser@^8.0.0: + version "8.0.0" + resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-8.0.0.tgz#21d476330e5a82279a4b881345bf066102e219c6" + dependencies: + camelcase "^4.1.0" + yargs@^6.0.0, yargs@^6.6.0: version "6.6.0" resolved "https://registry.yarnpkg.com/yargs/-/yargs-6.6.0.tgz#782ec21ef403345f830a808ca3d513af56065208" From 1ade02021481c4978e651a54566875d4378a0d18 Mon Sep 17 00:00:00 2001 From: Fabian Date: Fri, 1 Dec 2017 17:04:07 +0100 Subject: [PATCH 9/9] added binarypath option to build --- tasks/release.js | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/tasks/release.js b/tasks/release.js index c04246ab7a..0c0ea4d613 100644 --- a/tasks/release.js +++ b/tasks/release.js @@ -5,16 +5,17 @@ const path = require('path') const packager = require('electron-packager') const rebuild = require('electron-rebuild').default const mkdirp = require('mkdirp').sync +const fs = require('fs-extra') let skipPack = false -// let binaryPath = null +let binaryPath = null process.argv.forEach(function (val) { if (val === '--skip-pack') { skipPack = true } - // if (val.startsWith('--binary')) { - // binaryPath = val.replace('--binary=', '') - // } + if (val.startsWith('--binary')) { + binaryPath = val.replace('--binary=', '') + } }) if (process.env.PLATFORM_TARGET === 'clean') { @@ -51,12 +52,14 @@ function build () { let options = require('../config').building options.afterCopy = [ - goBuild(`github.com/cosmos/gaia/cmd/gaia`) + binaryPath + ? copyBinary('gaia', binaryPath) + : goBuild(`github.com/cosmos/gaia/cmd/gaia`) ] // prune installs the packages options.afterPrune = [ + // we need to rebuild some native packages for the electron environment function rebuildNodeModules (buildPath, electronVersion, platform, arch, callback) { - // we need to rebuild some native packages for the electron environment rebuild({ buildPath, electronVersion, arch }) .then(callback) .catch(callback) @@ -77,6 +80,17 @@ function build () { }) } +function copyBinary (name, binaryLocation) { + return function (buildPath, electronVersion, platform, arch, cb) { + let binPath = path.join(buildPath, 'bin', name) + if (platform === 'win32') { + binPath = binPath + '.exe' + } + fs.copySync(binaryLocation, binPath) + cb() + } +} + const GOARCH = { 'x64': 'amd64', 'ia32': '386'