Publish @parity/jsonrpc (#4365)

* Add npm/jsonrpc

* Allow ci:build:jsonrpc

* Publish @parity/jsonrpc
This commit is contained in:
Jaco Greeff 2017-01-31 16:52:48 +01:00 committed by Gav Wood
parent 983a0e3d0b
commit d3ee15c6fb
8 changed files with 102 additions and 7 deletions

5
js/npm/jsonrpc/README.md Normal file
View File

@ -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)

View File

@ -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 <admin@parity.io>",
"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": {
}
}

View File

@ -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",

View File

@ -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) {

View File

@ -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"

View File

@ -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"

19
js/src/library.jsonrpc.js Normal file
View File

@ -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 <http://www.gnu.org/licenses/>.
import JsonRpc from './jsonrpc';
module.exports = JsonRpc;

29
js/test/npmJsonRpc.js Normal file
View File

@ -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 <http://www.gnu.org/licenses/>.
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);
}