From cd4da00a68c3c10a482253ed99b568570e124e97 Mon Sep 17 00:00:00 2001 From: Michael Vines Date: Sun, 2 Dec 2018 10:03:46 -0800 Subject: [PATCH] fix: avoid packaging bpf-sdk binaries that the user downloads --- web3.js/.gitignore | 1 + web3.js/package.json | 41 ++++++++++++++++++++------------------ web3.js/src/transaction.js | 12 ++++++----- 3 files changed, 30 insertions(+), 24 deletions(-) diff --git a/web3.js/.gitignore b/web3.js/.gitignore index ebae1163c8..4dc33cd8d2 100644 --- a/web3.js/.gitignore +++ b/web3.js/.gitignore @@ -27,3 +27,4 @@ doc # bpf-sdk /bpf-sdk +/bpf-sdk.tar.bz2 diff --git a/web3.js/package.json b/web3.js/package.json index 494ebaddb7..b5d951d458 100644 --- a/web3.js/package.json +++ b/web3.js/package.json @@ -35,33 +35,36 @@ "/src" ], "scripts": { - "clean": "rimraf ./coverage ./lib", - "dev": "cross-env NODE_ENV=development rollup -c", + "bpf-sdk:install": "set -ex; npm run bpf-sdk:fetch; npm run bpf-sdk:extract", + "bpf-sdk:extract": "test -d bpf-sdk || tar jxvf bpf-sdk.tar.bz2", + "bpf-sdk:fetch": "test -f bpf-sdk.tar.bz2 || curl http://solana-sdk.s3.amazonaws.com/$npm_package_solana_channel/bpf-sdk.tar.bz2 -o bpf-sdk.tar.bz2", + "bpf-sdk:remove-symlinks": "find bpf-sdk -type l -print -exec cp {} {}.tmp \\; -exec mv {}.tmp {} \\;", "build": "cross-env NODE_ENV=production rollup -c", - "doc": "esdoc; node -p '\"\\nDocumentation coverage: \" + require(\"./doc/coverage.json\").coverage'", + "clean": "rimraf ./coverage ./lib", + "codecov": "set -ex; npm run test:cover; cat ./coverage/lcov.info | codecov", + "dev": "cross-env NODE_ENV=development rollup -c", + "doc": "set -ex; esdoc; node -p '\"\\nDocumentation coverage: \" + require(\"./doc/coverage.json\").coverage'", "doc:watch": "watch 'npm run doc' . --wait=1 --ignoreDirectoryPattern=/doc/", - "test": "cross-env NODE_ENV=test jest --useStderr", - "test:live": "cross-env NODE_ENV=test TEST_LIVE=1 jest --useStderr", - "test:watch": "cross-env NODE_ENV=test jest --watch --useStderr", - "test:cover": "cross-env NODE_ENV=test jest --coverage --useStderr", - "codecov": "npm run test:cover && cat ./coverage/lcov.info | codecov", - "fetch-bpf-sdk": "test -d bpf-sdk || curl http://solana-sdk.s3.amazonaws.com/$npm_package_solana_channel/bpf-sdk.tar.bz2 | tar jxv", - "remove-bpf-sdk-symlinks": "find bpf-sdk -type l -print -exec cp {} {}.tmp \\; -exec mv {}.tmp {} \\;", - "flow": "flow stop; flow-typed install jest@22 && flow", - "flow:watch": "flow stop; watch 'flow' . --wait=1 --ignoreDirectoryPattern=/doc/", + "examples": "set -ex; for example in examples/*.js; do node $example; done", + "flow": "set -ex; flow stop; flow-typed install jest@22; flow", "flow:stop": "flow stop", - "lint": "npm run pretty && eslint .", + "flow:watch": "flow stop; watch 'flow' . --wait=1 --ignoreDirectoryPattern=/doc/", + "install": "npm run bpf-sdk:install", + "lint": "set -ex; npm run pretty; eslint .", "lint:fix": "npm run lint -- --fix", "lint:watch": "watch 'npm run lint:fix' . --wait=1 --ignoreDirectoryPattern=/doc/", - "localnet:up": "bin/localnet.sh up $npm_package_solana_channel", "localnet:down": "bin/localnet.sh down", - "localnet:update": "bin/localnet.sh update $npm_package_solana_channel", "localnet:logs": "bin/localnet.sh logs -f", - "ok": "npm run lint && npm run flow && npm run test && npm run doc", + "localnet:up": "bin/localnet.sh up $npm_package_solana_channel", + "localnet:update": "bin/localnet.sh update $npm_package_solana_channel", + "ok": "set -ex; npm run lint; npm run flow; npm run test; npm run doc", + "prepare": "set -ex; npm run clean; npm run bpf-sdk:install; npm run build; rm -rf bpf-sdk; npm rum bpf-sdk:extract; npm run bpf-sdk:remove-symlinks", "pretty": "prettier --write '{,{examples,src,test}/**/}*.js'", - "prepare": "npm run clean && npm run ok && npm run fetch-bpf-sdk && npm run remove-bpf-sdk-symlinks && npm run build", - "examples": "set -ex; for example in examples/*.js; do node $example; done", - "re": "semantic-release --repository-url git@github.com:solana-labs/solana-web3.js.git" + "re": "semantic-release --repository-url git@github.com:solana-labs/solana-web3.js.git", + "test": "cross-env NODE_ENV=test jest --useStderr", + "test:cover": "cross-env NODE_ENV=test jest --coverage --useStderr", + "test:live": "cross-env NODE_ENV=test TEST_LIVE=1 jest --useStderr", + "test:watch": "cross-env NODE_ENV=test jest --watch --useStderr" }, "dependencies": { "babel-runtime": "^6.26.0", diff --git a/web3.js/src/transaction.js b/web3.js/src/transaction.js index 876fd7ca4a..9ac3353794 100644 --- a/web3.js/src/transaction.js +++ b/web3.js/src/transaction.js @@ -168,11 +168,13 @@ export class Transaction { programIds.push(programId); } - instruction.keys.map(key => key.toString()).forEach(key => { - if (!keys.includes(key)) { - keys.push(key); - } - }); + instruction.keys + .map(key => key.toString()) + .forEach(key => { + if (!keys.includes(key)) { + keys.push(key); + } + }); }); const instructions = this.instructions.map(instruction => {