Publish parity.js to npmjs registry (#2978)
* Skeleton packages * Publish parity.js package to npm * [ci skip] js-precompiled 20161029-190427 * Extra step information * [ci skip] js-precompiled 20161029-192209 * Use autToken for npmjs (cannot run headless in docker) * [ci skip] js-precompiled 20161029-193414 * Correct package.json structure * [ci skip] js-precompiled 20161029-194003 * Scope package to public * [ci skip] js-precompiled 20161029-194529 * Start package version at 0.1.0 * Build proper umd library * [ci skip] js-precompiled 20161029-231233 * Update build/release stage * [ci skip] js-precompiled 20161030-071454 * Basic README.md to satisfy npmjs * [ci skip] js-precompiled 20161030-073150 * CommonJs format * [ci skip] js-precompiled 20161030-075034 * Update README.md * update dependencies * [ci skip] js-precompiled 20161030-075727 * Starting package version * Build only on master
This commit is contained in:
parent
acaa40e221
commit
70f87ea002
@ -3,7 +3,7 @@ stages:
|
|||||||
- test
|
- test
|
||||||
variables:
|
variables:
|
||||||
GIT_DEPTH: "3"
|
GIT_DEPTH: "3"
|
||||||
SIMPLECOV: "true"
|
SIMPLECOV: "true"
|
||||||
RUST_BACKTRACE: "1"
|
RUST_BACKTRACE: "1"
|
||||||
RUSTFLAGS: "-D warnings"
|
RUSTFLAGS: "-D warnings"
|
||||||
cache:
|
cache:
|
||||||
@ -26,7 +26,7 @@ linux-stable:
|
|||||||
- export VER=$(grep -m 1 version Cargo.toml | awk '{print $3}' | tr -d '"' | tr -d "\n")
|
- export VER=$(grep -m 1 version Cargo.toml | awk '{print $3}' | tr -d '"' | tr -d "\n")
|
||||||
- dpkg-deb -b deb "parity_"$VER"_amd64.deb"
|
- dpkg-deb -b deb "parity_"$VER"_amd64.deb"
|
||||||
- md5sum "parity_"$VER"_amd64.deb" >> "parity_"$VER"_amd64.deb.md5"
|
- md5sum "parity_"$VER"_amd64.deb" >> "parity_"$VER"_amd64.deb.md5"
|
||||||
- aws configure set aws_access_key_id $s3_key
|
- aws configure set aws_access_key_id $s3_key
|
||||||
- aws configure set aws_secret_access_key $s3_secret
|
- aws configure set aws_secret_access_key $s3_secret
|
||||||
- aws s3api put-object --bucket builds-parity --key $CI_BUILD_REF_NAME/x86_64-unknown-linux-gnu/parity --body target/release/parity
|
- aws s3api put-object --bucket builds-parity --key $CI_BUILD_REF_NAME/x86_64-unknown-linux-gnu/parity --body target/release/parity
|
||||||
- aws s3api put-object --bucket builds-parity --key $CI_BUILD_REF_NAME/x86_64-unknown-linux-gnu/parity.md5 --body parity.md5
|
- aws s3api put-object --bucket builds-parity --key $CI_BUILD_REF_NAME/x86_64-unknown-linux-gnu/parity.md5 --body parity.md5
|
||||||
@ -56,7 +56,7 @@ linux-stable-14.04:
|
|||||||
- export VER=$(grep -m 1 version Cargo.toml | awk '{print $3}' | tr -d '"' | tr -d "\n")
|
- export VER=$(grep -m 1 version Cargo.toml | awk '{print $3}' | tr -d '"' | tr -d "\n")
|
||||||
- dpkg-deb -b deb "parity_"$VER"_amd64.deb"
|
- dpkg-deb -b deb "parity_"$VER"_amd64.deb"
|
||||||
- md5sum "parity_"$VER"_amd64.deb" >> "parity_"$VER"_amd64.deb.md5"
|
- md5sum "parity_"$VER"_amd64.deb" >> "parity_"$VER"_amd64.deb.md5"
|
||||||
- aws configure set aws_access_key_id $s3_key
|
- aws configure set aws_access_key_id $s3_key
|
||||||
- aws configure set aws_secret_access_key $s3_secret
|
- aws configure set aws_secret_access_key $s3_secret
|
||||||
- aws s3api put-object --bucket builds-parity --key $CI_BUILD_REF_NAME/x86_64-unknown-ubuntu_14_04-gnu/parity --body target/release/parity
|
- aws s3api put-object --bucket builds-parity --key $CI_BUILD_REF_NAME/x86_64-unknown-ubuntu_14_04-gnu/parity --body target/release/parity
|
||||||
- aws s3api put-object --bucket builds-parity --key $CI_BUILD_REF_NAME/x86_64-unknown-ubuntu_14_04-gnu/parity.md5 --body parity.md5
|
- aws s3api put-object --bucket builds-parity --key $CI_BUILD_REF_NAME/x86_64-unknown-ubuntu_14_04-gnu/parity.md5 --body parity.md5
|
||||||
@ -121,7 +121,7 @@ linux-centos:
|
|||||||
- cargo build --release --verbose
|
- cargo build --release --verbose
|
||||||
- strip target/release/parity
|
- strip target/release/parity
|
||||||
- md5sum target/release/parity >> parity.md5
|
- md5sum target/release/parity >> parity.md5
|
||||||
- aws configure set aws_access_key_id $s3_key
|
- aws configure set aws_access_key_id $s3_key
|
||||||
- aws configure set aws_secret_access_key $s3_secret
|
- aws configure set aws_secret_access_key $s3_secret
|
||||||
- aws s3api put-object --bucket builds-parity --key $CI_BUILD_REF_NAME/x86_64-unknown-centos-gnu/parity --body target/release/parity
|
- aws s3api put-object --bucket builds-parity --key $CI_BUILD_REF_NAME/x86_64-unknown-centos-gnu/parity --body target/release/parity
|
||||||
- aws s3api put-object --bucket builds-parity --key $CI_BUILD_REF_NAME/x86_64-unknown-centos-gnu/parity.md5 --body parity.md5
|
- aws s3api put-object --bucket builds-parity --key $CI_BUILD_REF_NAME/x86_64-unknown-centos-gnu/parity.md5 --body parity.md5
|
||||||
@ -158,7 +158,7 @@ linux-armv7:
|
|||||||
- export VER=$(grep -m 1 version Cargo.toml | awk '{print $3}' | tr -d '"' | tr -d "\n")
|
- export VER=$(grep -m 1 version Cargo.toml | awk '{print $3}' | tr -d '"' | tr -d "\n")
|
||||||
- dpkg-deb -b deb "parity_"$VER"_armhf.deb"
|
- dpkg-deb -b deb "parity_"$VER"_armhf.deb"
|
||||||
- md5sum "parity_"$VER"_armhf.deb" >> "parity_"$VER"_armhf.deb.md5"
|
- md5sum "parity_"$VER"_armhf.deb" >> "parity_"$VER"_armhf.deb.md5"
|
||||||
- aws configure set aws_access_key_id $s3_key
|
- aws configure set aws_access_key_id $s3_key
|
||||||
- aws configure set aws_secret_access_key $s3_secret
|
- aws configure set aws_secret_access_key $s3_secret
|
||||||
- aws s3api put-object --bucket builds-parity --key $CI_BUILD_REF_NAME/armv7-unknown-linux-gnueabihf/parity --body target/armv7-unknown-linux-gnueabihf/release/parity
|
- aws s3api put-object --bucket builds-parity --key $CI_BUILD_REF_NAME/armv7-unknown-linux-gnueabihf/parity --body target/armv7-unknown-linux-gnueabihf/release/parity
|
||||||
- aws s3api put-object --bucket builds-parity --key $CI_BUILD_REF_NAME/armv7-unknown-linux-gnueabihf/parity.md5 --body parity.md5
|
- aws s3api put-object --bucket builds-parity --key $CI_BUILD_REF_NAME/armv7-unknown-linux-gnueabihf/parity.md5 --body parity.md5
|
||||||
@ -198,7 +198,7 @@ linux-arm:
|
|||||||
- export VER=$(grep -m 1 version Cargo.toml | awk '{print $3}' | tr -d '"' | tr -d "\n")
|
- export VER=$(grep -m 1 version Cargo.toml | awk '{print $3}' | tr -d '"' | tr -d "\n")
|
||||||
- dpkg-deb -b deb "parity_"$VER"_armhf.deb"
|
- dpkg-deb -b deb "parity_"$VER"_armhf.deb"
|
||||||
- md5sum "parity_"$VER"_armhf.deb" >> "parity_"$VER"_armhf.deb.md5"
|
- md5sum "parity_"$VER"_armhf.deb" >> "parity_"$VER"_armhf.deb.md5"
|
||||||
- aws configure set aws_access_key_id $s3_key
|
- aws configure set aws_access_key_id $s3_key
|
||||||
- aws configure set aws_secret_access_key $s3_secret
|
- aws configure set aws_secret_access_key $s3_secret
|
||||||
- aws s3api put-object --bucket builds-parity --key $CI_BUILD_REF_NAME/arm-unknown-linux-gnueabihf/parity --body target/arm-unknown-linux-gnueabihf/release/parity
|
- aws s3api put-object --bucket builds-parity --key $CI_BUILD_REF_NAME/arm-unknown-linux-gnueabihf/parity --body target/arm-unknown-linux-gnueabihf/release/parity
|
||||||
- aws s3api put-object --bucket builds-parity --key $CI_BUILD_REF_NAME/arm-unknown-linux-gnueabihf/parity.md5 --body parity.md5
|
- aws s3api put-object --bucket builds-parity --key $CI_BUILD_REF_NAME/arm-unknown-linux-gnueabihf/parity.md5 --body parity.md5
|
||||||
@ -231,8 +231,8 @@ linux-armv6:
|
|||||||
- cat .cargo/config
|
- cat .cargo/config
|
||||||
- cargo build --target arm-unknown-linux-gnueabi --release --verbose
|
- cargo build --target arm-unknown-linux-gnueabi --release --verbose
|
||||||
- arm-linux-gnueabi-strip target/arm-unknown-linux-gnueabi/release/parity
|
- arm-linux-gnueabi-strip target/arm-unknown-linux-gnueabi/release/parity
|
||||||
- md5sum target/arm-unknown-linux-gnueabi/release/parity >> parity.md5
|
- md5sum target/arm-unknown-linux-gnueabi/release/parity >> parity.md5
|
||||||
- aws configure set aws_access_key_id $s3_key
|
- aws configure set aws_access_key_id $s3_key
|
||||||
- aws configure set aws_secret_access_key $s3_secret
|
- aws configure set aws_secret_access_key $s3_secret
|
||||||
- aws s3api put-object --bucket builds-parity --key $CI_BUILD_REF_NAME/arm-unknown-linux-gnueabi/parity --body target/arm-unknown-linux-gnueabi/release/parity
|
- aws s3api put-object --bucket builds-parity --key $CI_BUILD_REF_NAME/arm-unknown-linux-gnueabi/parity --body target/arm-unknown-linux-gnueabi/release/parity
|
||||||
- aws s3api put-object --bucket builds-parity --key $CI_BUILD_REF_NAME/arm-unknown-linux-gnueabi/parity.md5 --body parity.md5
|
- aws s3api put-object --bucket builds-parity --key $CI_BUILD_REF_NAME/arm-unknown-linux-gnueabi/parity.md5 --body parity.md5
|
||||||
@ -270,7 +270,7 @@ linux-aarch64:
|
|||||||
- export VER=$(grep -m 1 version Cargo.toml | awk '{print $3}' | tr -d '"' | tr -d "\n")
|
- export VER=$(grep -m 1 version Cargo.toml | awk '{print $3}' | tr -d '"' | tr -d "\n")
|
||||||
- dpkg-deb -b deb "parity_"$VER"_arm64.deb"
|
- dpkg-deb -b deb "parity_"$VER"_arm64.deb"
|
||||||
- md5sum "parity_"$VER"_arm64.deb" >> "parity_"$VER"_arm64.deb.md5"
|
- md5sum "parity_"$VER"_arm64.deb" >> "parity_"$VER"_arm64.deb.md5"
|
||||||
- aws configure set aws_access_key_id $s3_key
|
- aws configure set aws_access_key_id $s3_key
|
||||||
- aws configure set aws_secret_access_key $s3_secret
|
- aws configure set aws_secret_access_key $s3_secret
|
||||||
- aws s3api put-object --bucket builds-parity --key $CI_BUILD_REF_NAME/aarch64-unknown-linux-gnu/parity --body target/aarch64-unknown-linux-gnu/release/parity
|
- aws s3api put-object --bucket builds-parity --key $CI_BUILD_REF_NAME/aarch64-unknown-linux-gnu/parity --body target/aarch64-unknown-linux-gnu/release/parity
|
||||||
- aws s3api put-object --bucket builds-parity --key $CI_BUILD_REF_NAME/aarch64-unknown-linux-gnu/parity.md5 --body parity.md5
|
- aws s3api put-object --bucket builds-parity --key $CI_BUILD_REF_NAME/aarch64-unknown-linux-gnu/parity.md5 --body parity.md5
|
||||||
@ -295,7 +295,7 @@ darwin:
|
|||||||
- cargo build --release --verbose
|
- cargo build --release --verbose
|
||||||
- rm -rf parity.md5
|
- rm -rf parity.md5
|
||||||
- md5sum target/release/parity >> parity.md5
|
- md5sum target/release/parity >> parity.md5
|
||||||
- aws configure set aws_access_key_id $s3_key
|
- aws configure set aws_access_key_id $s3_key
|
||||||
- aws configure set aws_secret_access_key $s3_secret
|
- aws configure set aws_secret_access_key $s3_secret
|
||||||
- aws s3api put-object --bucket builds-parity --key $CI_BUILD_REF_NAME/x86_64-apple-darwin/parity --body target/release/parity
|
- aws s3api put-object --bucket builds-parity --key $CI_BUILD_REF_NAME/x86_64-apple-darwin/parity --body target/release/parity
|
||||||
- aws s3api put-object --bucket builds-parity --key $CI_BUILD_REF_NAME/x86_64-apple-darwin/parity.md5 --body parity.md5
|
- aws s3api put-object --bucket builds-parity --key $CI_BUILD_REF_NAME/x86_64-apple-darwin/parity.md5 --body parity.md5
|
||||||
@ -391,9 +391,6 @@ js-release:
|
|||||||
image: ethcore/javascript:latest
|
image: ethcore/javascript:latest
|
||||||
only:
|
only:
|
||||||
- master
|
- master
|
||||||
- beta
|
|
||||||
- tags
|
|
||||||
- stable
|
|
||||||
before_script:
|
before_script:
|
||||||
- ./js/scripts/install-deps.sh
|
- ./js/scripts/install-deps.sh
|
||||||
script:
|
script:
|
||||||
|
1
js/.gitignore
vendored
1
js/.gitignore
vendored
@ -5,3 +5,4 @@ build
|
|||||||
.coverage
|
.coverage
|
||||||
.dist
|
.dist
|
||||||
.happypack
|
.happypack
|
||||||
|
.npmjs
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
{
|
{
|
||||||
"name": "parity.js",
|
"name": "parity.js",
|
||||||
"version": "0.0.1",
|
"version": "0.1.0",
|
||||||
"main": "release/index.js",
|
"main": "release/index.js",
|
||||||
"jsnext:main": "src/index.js",
|
"jsnext:main": "src/index.js",
|
||||||
"author": "Ethcore Team <admin@ethcore.io>",
|
"author": "Parity Team <admin@parity.io>",
|
||||||
"maintainers": [
|
"maintainers": [
|
||||||
"Jaco Greeff"
|
"Jaco Greeff"
|
||||||
],
|
],
|
||||||
@ -11,7 +11,7 @@
|
|||||||
"license": "GPL-3.0",
|
"license": "GPL-3.0",
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "git+https://github.com/ethcore/parity.js.git"
|
"url": "git+https://github.com/ethcore/parity.git"
|
||||||
},
|
},
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"Ethereum",
|
"Ethereum",
|
||||||
@ -27,15 +27,13 @@
|
|||||||
"build:app": "webpack --progress",
|
"build:app": "webpack --progress",
|
||||||
"build:lib": "webpack --config webpack.libraries --progress",
|
"build:lib": "webpack --config webpack.libraries --progress",
|
||||||
"build:dll": "webpack --config webpack.vendor --progress",
|
"build:dll": "webpack --config webpack.vendor --progress",
|
||||||
|
|
||||||
"ci:build": "npm run ci:build:dll && npm run ci:build:app && npm run ci:build:lib",
|
"ci:build": "npm run ci:build:dll && npm run ci:build:app && npm run ci:build:lib",
|
||||||
"ci:build:app": "NODE_ENV=production webpack",
|
"ci:build:app": "NODE_ENV=production webpack",
|
||||||
"ci:build:lib": "NODE_ENV=production webpack --config webpack.libraries",
|
"ci:build:lib": "NODE_ENV=production webpack --config webpack.libraries",
|
||||||
"ci:build:dll": "NODE_ENV=production webpack --config webpack.vendor",
|
"ci:build:dll": "NODE_ENV=production webpack --config webpack.vendor",
|
||||||
|
"ci:build:npm": "NODE_ENV=production webpack --config webpack.npm",
|
||||||
"start": "npm install && npm run build:dll && npm run start:app",
|
"start": "npm install && npm run build:dll && npm run start:app",
|
||||||
"start:app": "webpack-dev-server -d --history-api-fallback --open --hot --inline --progress --colors --port 3000",
|
"start:app": "webpack-dev-server -d --history-api-fallback --open --hot --inline --progress --colors --port 3000",
|
||||||
|
|
||||||
"clean": "rm -rf ./build ./coverage",
|
"clean": "rm -rf ./build ./coverage",
|
||||||
"coveralls": "npm run testCoverage && coveralls < coverage/lcov.info",
|
"coveralls": "npm run testCoverage && coveralls < coverage/lcov.info",
|
||||||
"lint": "eslint --ignore-path .gitignore ./src/",
|
"lint": "eslint --ignore-path .gitignore ./src/",
|
||||||
@ -65,7 +63,7 @@
|
|||||||
"chai": "^3.5.0",
|
"chai": "^3.5.0",
|
||||||
"chai-enzyme": "0.4.2",
|
"chai-enzyme": "0.4.2",
|
||||||
"cheerio": "0.20.0",
|
"cheerio": "0.20.0",
|
||||||
"copy-webpack-plugin": "^3.0.1",
|
"copy-webpack-plugin": "^4.0.0",
|
||||||
"core-js": "^2.4.1",
|
"core-js": "^2.4.1",
|
||||||
"coveralls": "^2.11.11",
|
"coveralls": "^2.11.11",
|
||||||
"css-loader": "^0.23.1",
|
"css-loader": "^0.23.1",
|
||||||
@ -79,6 +77,7 @@
|
|||||||
"eslint-plugin-standard": "^2.0.0",
|
"eslint-plugin-standard": "^2.0.0",
|
||||||
"extract-text-webpack-plugin": "^1.0.1",
|
"extract-text-webpack-plugin": "^1.0.1",
|
||||||
"file-loader": "^0.8.5",
|
"file-loader": "^0.8.5",
|
||||||
|
"fs-extra": "^0.30.0",
|
||||||
"happypack": "^2.2.1",
|
"happypack": "^2.2.1",
|
||||||
"history": "^2.0.0",
|
"history": "^2.0.0",
|
||||||
"html-loader": "^0.4.3",
|
"html-loader": "^0.4.3",
|
||||||
|
81
js/parity.md
Normal file
81
js/parity.md
Normal file
@ -0,0 +1,81 @@
|
|||||||
|
# parity.js
|
||||||
|
|
||||||
|
Parity.js is a thin, fast, Promise-based wrapper around the Ethereum APIs.
|
||||||
|
|
||||||
|
## installation
|
||||||
|
|
||||||
|
Install the package with `npm install --save @parity/parity.js`
|
||||||
|
|
||||||
|
## usage
|
||||||
|
|
||||||
|
### initialisation
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
// import the actual Api class
|
||||||
|
import { Api } from '@parity/parity.js';
|
||||||
|
|
||||||
|
// do the setup
|
||||||
|
const transport = new Api.Transport.Http('http://localhost:8545');
|
||||||
|
const api = new Api(transport);
|
||||||
|
```
|
||||||
|
|
||||||
|
### making calls
|
||||||
|
|
||||||
|
perform a call
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
api.eth
|
||||||
|
.coinbase()
|
||||||
|
.then((coinbase) => {
|
||||||
|
console.log(`The coinbase is ${coinbase}`);
|
||||||
|
});
|
||||||
|
```
|
||||||
|
|
||||||
|
multiple promises
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
Promise
|
||||||
|
.all([
|
||||||
|
api.eth.coinbase(),
|
||||||
|
api.net.listening()
|
||||||
|
])
|
||||||
|
.then(([coinbase, listening]) => {
|
||||||
|
// do stuff here
|
||||||
|
});
|
||||||
|
```
|
||||||
|
|
||||||
|
chaining promises
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
api.eth
|
||||||
|
.newFilter({...})
|
||||||
|
.then((filterId) => api.eth.getFilterChanges(filterId))
|
||||||
|
.then((changes) => {
|
||||||
|
console.log(changes);
|
||||||
|
});
|
||||||
|
```
|
||||||
|
|
||||||
|
### contracts
|
||||||
|
|
||||||
|
attach contract
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
const abi = [{ name: 'callMe', inputs: [{ type: 'bool', ...}, { type: 'string', ...}]}, ...abi...];
|
||||||
|
const address = '0x123456...9abc';
|
||||||
|
const contract = new api.newContract(abi, address);
|
||||||
|
```
|
||||||
|
|
||||||
|
find & call a function
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
contract.instance
|
||||||
|
.callMe
|
||||||
|
.call({ gas: 21000 }, [true, 'someString']) // or estimateGas or postTransaction
|
||||||
|
.then((result) => {
|
||||||
|
console.log(`the result was ${result}`);
|
||||||
|
});
|
||||||
|
```
|
||||||
|
|
||||||
|
## apis
|
||||||
|
|
||||||
|
APIs implement the calls as exposed in the [Ethcore JSON Ethereum RPC](https://github.com/ethcore/ethereum-rpc-json/) definitions. Mapping follows the naming conventions of the originals, i.e. `eth_call` becomes `eth.call`, `personal_accounts` becomes `personal.accounts`, etc.
|
32
js/parity.package.json
Normal file
32
js/parity.package.json
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
{
|
||||||
|
"name": "@parity/parity.js",
|
||||||
|
"description": "The Parity Promise-base API & ABI library for interfacing with Ethereum over 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",
|
||||||
|
"Promise"
|
||||||
|
],
|
||||||
|
"scripts": {
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"bignumber.js": "^2.3.0",
|
||||||
|
"js-sha3": "^0.5.2"
|
||||||
|
}
|
||||||
|
}
|
@ -1,11 +1,18 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
|
# variables
|
||||||
|
UTCDATE=`date -u "+%Y%m%d-%H%M%S"`
|
||||||
|
PACKAGES=( "parity.js" )
|
||||||
|
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"
|
||||||
|
|
||||||
# setup the git user defaults for the current repo
|
# setup the git user defaults for the current repo
|
||||||
function setup_git_user {
|
function setup_git_user {
|
||||||
git config push.default simple
|
git config push.default simple
|
||||||
git config merge.ours.driver true
|
git config merge.ours.driver true
|
||||||
git config user.email "jaco+gitlab@ethcore.io"
|
git config user.email "$GITHUB_EMAIL"
|
||||||
git config user.name "GitLab Build Bot"
|
git config user.name "GitLab Build Bot"
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -15,47 +22,63 @@ GITLOG=./.git/gitcommand.log
|
|||||||
pushd $BASEDIR
|
pushd $BASEDIR
|
||||||
cd ../.dist
|
cd ../.dist
|
||||||
|
|
||||||
# variables
|
# add local files and send it up
|
||||||
UTCDATE=`date -u "+%Y%m%d-%H%M%S"`
|
echo "*** Setting up GitHub config for js-precompiled"
|
||||||
|
|
||||||
# init git
|
|
||||||
rm -rf ./.git
|
rm -rf ./.git
|
||||||
git init
|
git init
|
||||||
|
|
||||||
# add local files and send it up
|
|
||||||
echo "Setting up GitHub config for js-precompiled"
|
|
||||||
setup_git_user
|
setup_git_user
|
||||||
|
|
||||||
echo "Checking out $CI_BUILD_REF_NAME branch"
|
echo "*** Checking out $BRANCH branch"
|
||||||
git remote add origin https://${GITHUB_JS_PRECOMPILED}:@github.com/ethcore/js-precompiled.git
|
git remote add origin $GIT_JS_PRECOMPILED
|
||||||
git fetch origin 2>$GITLOG
|
git fetch origin 2>$GITLOG
|
||||||
git checkout -b $CI_BUILD_REF_NAME
|
git checkout -b $BRANCH
|
||||||
|
|
||||||
echo "Committing compiled files for $UTCDATE"
|
echo "*** Committing compiled files for $UTCDATE"
|
||||||
git add .
|
git add .
|
||||||
git commit -m "$UTCDATE"
|
git commit -m "$UTCDATE"
|
||||||
|
|
||||||
echo "Merging remote"
|
echo "*** Merging remote"
|
||||||
git merge origin/$CI_BUILD_REF_NAME -X ours --commit -m "$UTCDATE [release]"
|
git merge origin/$BRANCH -X ours --commit -m "$UTCDATE [release]"
|
||||||
git push origin HEAD:refs/heads/$CI_BUILD_REF_NAME 2>$GITLOG
|
git push origin HEAD:refs/heads/$BRANCH 2>$GITLOG
|
||||||
PRECOMPILED_HASH=`git rev-parse HEAD`
|
PRECOMPILED_HASH=`git rev-parse HEAD`
|
||||||
|
|
||||||
# back to root
|
# move to root
|
||||||
popd
|
cd ../..
|
||||||
|
|
||||||
echo "Setting up GitHub config for parity"
|
echo "*** Setting up GitHub config for parity"
|
||||||
setup_git_user
|
setup_git_user
|
||||||
git remote set-url origin https://${GITHUB_JS_PRECOMPILED}:@github.com/ethcore/parity.git
|
git remote set-url origin $GIT_PARITY
|
||||||
git reset --hard origin/$CI_BUILD_REF_NAME 2>$GITLOG
|
git reset --hard origin/$BRANCH 2>$GITLOG
|
||||||
|
|
||||||
echo "Updating cargo package parity-ui-precompiled#$PRECOMPILED_HASH"
|
echo "*** Bumping package.json patch version"
|
||||||
|
cd js
|
||||||
|
npm --no-git-tag-version version
|
||||||
|
npm version patch
|
||||||
|
cd ..
|
||||||
|
|
||||||
|
echo "*** Updating cargo parity-ui-precompiled#$PRECOMPILED_HASH"
|
||||||
cargo update -p parity-ui-precompiled
|
cargo update -p parity-ui-precompiled
|
||||||
# --precise "$PRECOMPILED_HASH"
|
# --precise "$PRECOMPILED_HASH"
|
||||||
|
|
||||||
echo "Committing updated files"
|
echo "*** Committing updated files"
|
||||||
git add .
|
git add Cargo.lock js/package.json
|
||||||
git commit -m "[ci skip] js-precompiled $UTCDATE"
|
git commit -m "[ci skip] js-precompiled $UTCDATE"
|
||||||
git push origin HEAD:refs/heads/$CI_BUILD_REF_NAME 2>$GITLOG
|
git push origin HEAD:refs/heads/$BRANCH 2>$GITLOG
|
||||||
|
|
||||||
|
echo "*** Building packages for npmjs"
|
||||||
|
cd js
|
||||||
|
# echo -e "$NPM_USERNAME\n$NPM_PASSWORD\n$NPM_EMAIL" | npm login
|
||||||
|
echo "$NPM_TOKEN" >> ~/.npmrc
|
||||||
|
npm run ci:build:npm
|
||||||
|
|
||||||
|
echo "*** Publishing $PACKAGE to npmjs"
|
||||||
|
cd .npmjs
|
||||||
|
npm publish --access public
|
||||||
|
cd ..
|
||||||
|
|
||||||
|
# back to root
|
||||||
|
echo "*** Release completed"
|
||||||
|
popd
|
||||||
|
|
||||||
# exit with exit code
|
# exit with exit code
|
||||||
exit 0
|
exit 0
|
||||||
|
23
js/src/library.js
Normal file
23
js/src/library.js
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
// Copyright 2015, 2016 Ethcore (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 Abi from './abi';
|
||||||
|
import Api from './api';
|
||||||
|
|
||||||
|
export {
|
||||||
|
Abi,
|
||||||
|
Api
|
||||||
|
};
|
82
js/webpack.npm.js
Normal file
82
js/webpack.npm.js
Normal file
@ -0,0 +1,82 @@
|
|||||||
|
// Copyright 2015, 2016 Ethcore (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/>.
|
||||||
|
|
||||||
|
const path = require('path');
|
||||||
|
const webpack = require('webpack');
|
||||||
|
const CopyWebpackPlugin = require('copy-webpack-plugin');
|
||||||
|
const packageJson = require('./package.json');
|
||||||
|
|
||||||
|
const ENV = process.env.NODE_ENV || 'development';
|
||||||
|
const isProd = ENV === 'production';
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
context: path.join(__dirname, './src'),
|
||||||
|
entry: 'library.js',
|
||||||
|
output: {
|
||||||
|
path: path.join(__dirname, '.npmjs'),
|
||||||
|
filename: 'library.js',
|
||||||
|
libraryTarget: 'commonjs'
|
||||||
|
},
|
||||||
|
module: {
|
||||||
|
loaders: [
|
||||||
|
{
|
||||||
|
test: /(\.jsx|\.js)$/,
|
||||||
|
loader: 'babel',
|
||||||
|
exclude: /node_modules/
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
resolve: {
|
||||||
|
root: path.resolve('./src'),
|
||||||
|
extensions: ['', '.js']
|
||||||
|
},
|
||||||
|
plugins: (function () {
|
||||||
|
const plugins = [
|
||||||
|
new CopyWebpackPlugin([
|
||||||
|
{
|
||||||
|
from: '../parity.package.json',
|
||||||
|
to: 'package.json',
|
||||||
|
transform: function (content, path) {
|
||||||
|
const json = JSON.parse(content.toString());
|
||||||
|
json.version = packageJson.version;
|
||||||
|
return new Buffer(JSON.stringify(json, null, ' '), 'utf-8');
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
from: '../LICENSE'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
from: '../parity.md',
|
||||||
|
to: 'README.md'
|
||||||
|
}
|
||||||
|
], { copyUnmodified: true })
|
||||||
|
];
|
||||||
|
|
||||||
|
if (isProd) {
|
||||||
|
plugins.push(new webpack.optimize.UglifyJsPlugin({
|
||||||
|
screwIe8: true,
|
||||||
|
compress: {
|
||||||
|
warnings: false
|
||||||
|
},
|
||||||
|
output: {
|
||||||
|
comments: false
|
||||||
|
}
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
|
||||||
|
return plugins;
|
||||||
|
}())
|
||||||
|
};
|
Loading…
Reference in New Issue
Block a user