resolve ganache-cli bin using pkg-up
This commit is contained in:
parent
2a00fd824f
commit
4821997866
|
@ -1,4 +1,5 @@
|
||||||
const path = require('path');
|
const path = require('path');
|
||||||
|
const pkgUp = require('pkg-up');
|
||||||
let shelljs = require('shelljs');
|
let shelljs = require('shelljs');
|
||||||
let proxy = require('./proxy');
|
let proxy = require('./proxy');
|
||||||
const Ipc = require('../../core/ipc');
|
const Ipc = require('../../core/ipc');
|
||||||
|
@ -14,7 +15,16 @@ class Simulator {
|
||||||
run(options) {
|
run(options) {
|
||||||
let cmds = [];
|
let cmds = [];
|
||||||
|
|
||||||
const ganache = path.join(__dirname, '../../../node_modules/.bin/ganache-cli');
|
const ganache_main = require.resolve('ganache-cli');
|
||||||
|
const ganache_json = pkgUp.sync(path.dirname(ganache_main));
|
||||||
|
const ganache_root = path.dirname(ganache_json);
|
||||||
|
const ganache_bin = require(ganache_json).bin;
|
||||||
|
let ganache;
|
||||||
|
if (typeof ganache_bin === 'string') {
|
||||||
|
ganache = path.join(ganache_root, ganache_bin);
|
||||||
|
} else {
|
||||||
|
ganache = path.join(ganache_root, ganache_bin['ganache-cli']);
|
||||||
|
}
|
||||||
|
|
||||||
let useProxy = this.blockchainConfig.proxy || false;
|
let useProxy = this.blockchainConfig.proxy || false;
|
||||||
let host = (dockerHostSwap(options.host || this.blockchainConfig.rpcHost) || defaultHost);
|
let host = (dockerHostSwap(options.host || this.blockchainConfig.rpcHost) || defaultHost);
|
||||||
|
|
Loading…
Reference in New Issue