fix: inline testnet-default-channel.js

This commit is contained in:
Michael Vines 2019-06-19 10:30:44 -07:00
parent 6b68e2d610
commit b4c80b1464
3 changed files with 25 additions and 12 deletions

View File

@ -6,7 +6,19 @@ if [[ -z $installDir ]]; then
installDir="$(cd "$(dirname "$0")"/..; pwd)"
fi
channel=$("$(dirname "$0")"/testnet-default-channel.js)
channel=$(
cd "$(dirname "$0")";
node -p '
let p = [
"../lib/node_modules/@solana/web3.js/package.json",
"../@solana/web3.js/package.json",
"../package.json"
].find(require("fs").existsSync);
if (!p) throw new Error("Unable to locate solana-web3.js directory");
require(p)["testnetDefaultChannel"]
'
)
if [[ -n $2 ]]; then
channel=$2
fi

View File

@ -1,7 +1,18 @@
#!/usr/bin/env bash
set -e
channel=$("$(dirname "$0")"/testnet-default-channel.js)
channel=$(
cd "$(dirname "$0")";
node -p '
let p = [
"../lib/node_modules/@solana/web3.js/package.json",
"../@solana/web3.js/package.json",
"../package.json"
].find(require("fs").existsSync);
if (!p) throw new Error("Unable to locate solana-web3.js directory");
require(p)["testnetDefaultChannel"]
'
)
usage() {
exitcode=0

View File

@ -1,10 +0,0 @@
#!/usr/bin/env node
let p = [
__dirname + '/../lib/node_modules/@solana/web3.js/package.json',
__dirname + '/../@solana/web3.js/package.json',
__dirname + '/../package.json'
].find(require('fs').existsSync);
if (!p) throw new Error('Unable to locate solana-web3.js directory');
console.log(require(p)['testnetDefaultChannel']);