diff --git a/js/npm/jsonrpc/README.md b/js/npm/jsonrpc/README.md new file mode 100644 index 000000000..5c9eb96db --- /dev/null +++ b/js/npm/jsonrpc/README.md @@ -0,0 +1,5 @@ +# @parity/jsonrpc + +JSON and JS interface defintions for RPC calls. + +[https://github.com/ethcore/parity/tree/master/js/src/jsonrpc](https://github.com/ethcore/parity/tree/master/js/src/jsonrpc) diff --git a/js/npm/jsonrpc/package.json b/js/npm/jsonrpc/package.json new file mode 100644 index 000000000..26e24dac1 --- /dev/null +++ b/js/npm/jsonrpc/package.json @@ -0,0 +1,29 @@ +{ + "name": "@parity/jsonrpc", + "description": "JSON and JS interface defintions for RPC", + "version": "0.0.0", + "main": "library.js", + "author": "Parity Team ", + "maintainers": [ + "Jaco Greeff" + ], + "contributors": [], + "license": "GPL-3.0", + "repository": { + "type": "git", + "url": "git+https://github.com/ethcore/parity.git" + }, + "keywords": [ + "Ethereum", + "ABI", + "API", + "RPC", + "Parity" + ], + "scripts": { + }, + "devDependencies": { + }, + "dependencies": { + } +} diff --git a/js/package.json b/js/package.json index 852c095d5..ba423017c 100644 --- a/js/package.json +++ b/js/package.json @@ -36,6 +36,7 @@ "ci:build:lib": "NODE_ENV=production webpack --config webpack/libraries", "ci:build:dll": "NODE_ENV=production webpack --config webpack/vendor", "ci:build:npm": "NODE_ENV=production webpack --config webpack/npm", + "ci:build:jsonrpc": "babel-node ./scripts/build-rpc-json.js --output .npmjs/jsonrpc", "start": "npm install && npm run build:lib && npm run build:dll && npm run start:app", "start:app": "node webpack/dev.server", "clean": "rm -rf ./.build ./.coverage ./.happypack ./.npmjs ./build", @@ -48,7 +49,7 @@ "test": "NODE_ENV=test mocha --compilers ejs:ejsify 'src/**/*.spec.js'", "test:coverage": "NODE_ENV=test istanbul cover _mocha -- --compilers ejs:ejsify 'src/**/*.spec.js'", "test:e2e": "NODE_ENV=test mocha 'src/**/*.e2e.js'", - "test:npm": "(cd .npmjs && npm i) && node test/npmParity && (rm -rf .npmjs/node_modules)", + "test:npm": "(cd .npmjs && npm i) && node test/npmParity && node test/npmJsonRpc && (rm -rf .npmjs/node_modules)", "prepush": "npm run lint:cached" }, "devDependencies": { @@ -135,7 +136,8 @@ "webpack-dev-middleware": "1.9.0", "webpack-error-notification": "0.1.6", "webpack-hot-middleware": "2.14.0", - "websocket": "1.0.24" + "websocket": "1.0.24", + "yargs": "6.6.0" }, "dependencies": { "bignumber.js": "3.0.1", diff --git a/js/scripts/build-rpc-json.js b/js/scripts/build-rpc-json.js index 2f7b827f9..740f96aa1 100644 --- a/js/scripts/build-rpc-json.js +++ b/js/scripts/build-rpc-json.js @@ -16,10 +16,13 @@ import fs from 'fs'; import path from 'path'; +import yargs from 'yargs'; import interfaces from '../src/jsonrpc'; -const INDEX_JSON = path.join(__dirname, '../release/index.json'); +const argv = yargs.default('output', 'release').argv; + +const INDEX_JSON = path.join(__dirname, `../${argv.output}/index.json`); const methods = []; function formatDescription (obj) { diff --git a/js/scripts/dryrun-npm.sh b/js/scripts/dryrun-npm.sh index 6d9412f62..bf8a151a8 100755 --- a/js/scripts/dryrun-npm.sh +++ b/js/scripts/dryrun-npm.sh @@ -2,12 +2,17 @@ set -e # variables -PACKAGES=( "parity" "etherscan" "shapeshift" ) +PACKAGES=( "parity" "etherscan" "shapeshift" "jsonrpc" ) # change into the build directory BASEDIR=`dirname $0` cd $BASEDIR/.. +# build jsonrpc +echo "*** Building JSONRPC .json" +mkdir -p .npmjs/jsonrpc +npm run ci:build:jsonrpc + # build all packages echo "*** Building packages for npmjs" echo "$NPM_TOKEN" >> ~/.npmrc @@ -19,8 +24,6 @@ do DIRECTORY=.npmjs/$PACKAGE cd $DIRECTORY - echo "*** Executing $PACKAGE tests from $DIRECTORY" - npm test echo "*** Publishing $PACKAGE from $DIRECTORY" echo "npm publish --access public || true" diff --git a/js/scripts/release.sh b/js/scripts/release.sh index 88422df0a..80c0fc819 100755 --- a/js/scripts/release.sh +++ b/js/scripts/release.sh @@ -3,7 +3,7 @@ set -e # variables UTCDATE=`date -u "+%Y%m%d-%H%M%S"` -PACKAGES=( "parity" "etherscan" "shapeshift" ) +PACKAGES=( "parity" "etherscan" "shapeshift" "jsonrpc" ) BRANCH=$CI_BUILD_REF_NAME GIT_JS_PRECOMPILED="https://${GITHUB_JS_PRECOMPILED}:@github.com/ethcore/js-precompiled.git" GIT_PARITY="https://${GITHUB_JS_PRECOMPILED}:@github.com/ethcore/parity.git" @@ -67,6 +67,11 @@ if [ "$BRANCH" == "master" ]; then echo "*** Building packages for npmjs" echo "$NPM_TOKEN" >> ~/.npmrc + # build jsonrpc + echo "*** Building JSONRPC .json" + mkdir -p .npmjs/jsonrpc + npm run ci:build:jsonrpc + for PACKAGE in ${PACKAGES[@]} do echo "*** Building $PACKAGE" diff --git a/js/src/library.jsonrpc.js b/js/src/library.jsonrpc.js new file mode 100644 index 000000000..c409ee421 --- /dev/null +++ b/js/src/library.jsonrpc.js @@ -0,0 +1,19 @@ +// Copyright 2015-2017 Parity Technologies (UK) Ltd. +// This file is part of Parity. + +// Parity is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// Parity is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with Parity. If not, see . + +import JsonRpc from './jsonrpc'; + +module.exports = JsonRpc; diff --git a/js/test/npmJsonRpc.js b/js/test/npmJsonRpc.js new file mode 100644 index 000000000..a72b367d2 --- /dev/null +++ b/js/test/npmJsonRpc.js @@ -0,0 +1,29 @@ +// Copyright 2015-2017 Parity Technologies (UK) Ltd. +// This file is part of Parity. + +// Parity is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// Parity is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with Parity. If not, see . + +try { + var JsonRpc = require('../.npmjs/jsonRpc/library.js'); + + if (typeof JsonRpc !== 'object') { + throw new Error('JsonRpc'); + } + + console.log(JsonRpc); + process.exit(0); +} catch (e) { + console.error('An error occured:', e.toString().split('\n')[0]); + process.exit(1); +}