From 898cad5f55b984d4c968afc41cc6d27ae56d66b1 Mon Sep 17 00:00:00 2001 From: nitowa Date: Tue, 1 Feb 2022 17:16:31 +0100 Subject: [PATCH] drone config and doc generation --- README.md | 12 +++++-- drone.yml | 83 ++++++++++++++++++++++++++++++++++++++++++++++ package.json | 3 +- test/primitives.ts | 2 +- 4 files changed, 96 insertions(+), 4 deletions(-) create mode 100644 drone.yml diff --git a/README.md b/README.md index a152b40..294601f 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ [![Weekly Downloads](https://img.shields.io/npm/dw/xrpio?color=important)](https://www.npmjs.com/package/xrpio) [![License Type](https://img.shields.io/npm/l/xrpio?color=blueviolet)](https://gitea.nitowa.xyz/docs/xrpio/src/branch/master/LICENSE.md) -xrpio is a library that allows you to write and read arbitrary data to the ripple blockchain. +xrpio is a library that allows you to write and read arbitrary data in the ripple blockchain. # How to install ``` @@ -19,7 +19,15 @@ import {treeRead, treeWrite} from 'xrpio' const api = new RippleAPI({ server: "..." }) await api.connect() -const dataRootHash = await treeWrite(api, "Arbitrary string data 123", {address: "Sender address", secret: "Sender private key"}, "Receiver address") +const dataRootHash = await treeWrite( + api, + "Arbitrary string data 123", + { + address: "Sender address", + secret: "Sender private key" + }, + "Receiver address" +) const data = await treeRead(api, [dataRootHash]) console.log(data) //"Arbitrary string data 123" diff --git a/drone.yml b/drone.yml new file mode 100644 index 0000000..61a04c1 --- /dev/null +++ b/drone.yml @@ -0,0 +1,83 @@ +--- +kind: pipeline +type: docker +name: default + +steps: + +- name: restore cache + image: drillster/drone-volume-cache + settings: + restore: true + mount: + - ./node_modules + volumes: + - name: cache + path: /cache + +- name: npm install + image: node:12 + commands: + - npm install + +- name: npm run build + image: node:12 + commands: + - npm run build + +- name: rebuild cache + image: drillster/drone-volume-cache + settings: + rebuild: true + mount: + - ./node_modules + volumes: + - name: cache + path: /cache + +- name: npm run test + image: node:12 + commands: + - npm run test + +- name: build docs + image: node:12 + commands: + - npm run docs + when: + event: + - tag + +- name: deliver docs + image: node:12 + commands: + - echo ${DRONE_BUILD_CREATED} + - git clone https://gitea.nitowa.xyz/docs/${DRONE_REPO_NAME}.git; cd ${DRONE_REPO_NAME} && rm -rf ./*; cp -r ../docs/* .; cp ../LICENSE.md . + - sed -i '1,3d; $d' README.md && echo "### Version\n\n${DRONE_TAG}\n" >> ./README.md + - sed -i -e 1,4d ./globals.md && cat ./globals.md >> ./README.md + - git add --all; git -c user.email="${DRONE_COMMIT_AUTHOR_EMAIL}" -c user.name="${DRONE_COMMIT_AUTHOR}" commit --all --allow-empty --message "generated from tag ${DRONE_TAG}" + - (git tag ${DRONE_TAG} && git push --force origin master ${DRONE_TAG}) || true + environment: + GIT_USER: + from_secret: git_user + GIT_PASSWORD: + from_secret: git_password + when: + event: + - tag + +- name: npm publish + image: plugins/npm + settings: + username: nitowa + password: + from_secret: npm_password + email: peter.millauer@gmail.com + when: + event: + - tag + +volumes: +- name: cache + host: + path: /tmp \ No newline at end of file diff --git a/package.json b/package.json index e31215e..a8c545b 100644 --- a/package.json +++ b/package.json @@ -13,7 +13,8 @@ "webpack-gui": "webpack --config webpack.gui.js --progress && cp build/gui/main.js gui", "webpack-gateway": "webpack --config webpack.gateway.js --progress && cp build/gateway/main.js gateway", "test": "npm run build && mocha --bail=true ./lib/test/*.js", - "deploy": "node ./lib/Deploy.js" + "deploy": "node ./lib/Deploy.js", + "docs": "typedoc --out docs ./src --readme ./README.md --plugin typedoc-plugin-markdown --mode file --hideBreadcrumbs --hideSources" }, "author": "nitowa", "license": "MIT", diff --git a/test/primitives.ts b/test/primitives.ts index fb55e49..6a58c9b 100644 --- a/test/primitives.ts +++ b/test/primitives.ts @@ -60,7 +60,7 @@ describe('XRPIO', () => { let treeRoot it(`can tree write (${TEST_DATA.length} bytes)`, async function (){ this.timeout(10000) - treeRoot = await treeWrite(api, TEST_DATA, sendWallet, receiveWallet.address) + treeRoot = await treeWrite(api, TEST_DATA, {address: "123", secret: "123"}, receiveWallet.address) }) it('can tree read', async function() {