From ac487d90fd88cb648ed021392c2ec0a14ebbe4c0 Mon Sep 17 00:00:00 2001 From: mtyszczak Date: Wed, 18 Oct 2023 15:29:38 +0200 Subject: [PATCH] Add public README file --- programs/beekeeper/beekeeper_wasm/README.md | 52 +++++++++++++------ .../__tests__/detailed/base.spec.ts | 3 ++ .../beekeeper/beekeeper_wasm/building.ts.md | 37 +++++++++++++ .../beekeeper/beekeeper_wasm/package.json | 1 + 4 files changed, 77 insertions(+), 16 deletions(-) create mode 100644 programs/beekeeper/beekeeper_wasm/building.ts.md diff --git a/programs/beekeeper/beekeeper_wasm/README.md b/programs/beekeeper/beekeeper_wasm/README.md index f0f33a6abe..e94a67d03a 100644 --- a/programs/beekeeper/beekeeper_wasm/README.md +++ b/programs/beekeeper/beekeeper_wasm/README.md @@ -1,39 +1,59 @@ # beekeeper -## TypeScript +call hived functions from JavaScript -### Configure +## Install -**It is strongly advised to use our development image: `registry.gitlab.syncad.com/hive/common-ci-configuration/emsdk:3.1.43`** +This is a [Node.js](https://nodejs.org/en/) module available through the +[npm registry](https://www.npmjs.com/). -If you want to test our package locally follow those steps: +Before installing, [download and install Node.js](https://nodejs.org/en/download/). +Node.js 12 or higher is required. -First install the package manager: +Installation is done using the +[`npm install` command](https://docs.npmjs.com/getting-started/installing-npm-packages-locally): ```bash -sudo npm i -g pnpm +npm install @hiveio/beekeeper ``` -And all of the required dependencies: +## Usage -```bash -pnpm install +```js +import beekeeperFactory from '@hiveio/beekeeper'; + +const beekeeper = await beekeeperFactory(); + +const sessionData = await beekeeper.create_session('pear'); + +console.log(beekeeper.get_info(sessionData.token)); ``` -### Build +## API + +**(WIP)** + +## Support and tests + +Tested on the latest Chromium (v117) + +[Automated CI test](https://gitlab.syncad.com/hive/hive/-/pipelines) runs are available. + +To run the tests on your own, clone the Hive repo and install the dependencies: ```bash -npm run build +git clone https://gitlab.syncad.com/hive/hive.git --depth 1 +cd hive/programs/beekeeper/beekeeper_wasm +sudo npm install -g pnpm +pnpm install ``` -### Test - -We use playwright in our tests to emulate WASM behaviour in the browser environment: +Then run tests: ```bash npm run test ``` -### License +## License -See license in the [LICENSE.md](../../../LICENSE.md) file +See license in the [LICENSE.md](LICENSE.md) file diff --git a/programs/beekeeper/beekeeper_wasm/__tests__/detailed/base.spec.ts b/programs/beekeeper/beekeeper_wasm/__tests__/detailed/base.spec.ts index f468ec7057..cee5e7ea84 100644 --- a/programs/beekeeper/beekeeper_wasm/__tests__/detailed/base.spec.ts +++ b/programs/beekeeper/beekeeper_wasm/__tests__/detailed/base.spec.ts @@ -24,6 +24,9 @@ test.describe('WASM Base tests', () => { // Base browser type test test('Should test on chromium', async () => { const browserType = browser.browserType(); + const version = browser.version(); + + console.info(`Using browser ${browserType} v${version}`);; expect(browserType.name()).toBe('chromium'); }); diff --git a/programs/beekeeper/beekeeper_wasm/building.ts.md b/programs/beekeeper/beekeeper_wasm/building.ts.md new file mode 100644 index 0000000000..5c45ec2657 --- /dev/null +++ b/programs/beekeeper/beekeeper_wasm/building.ts.md @@ -0,0 +1,37 @@ +# TypeScript beekeeper + +## Configure + +**It is strongly advised to use our development image: `registry.gitlab.syncad.com/hive/common-ci-configuration/emsdk:3.1.43`** + +If you want to test our package locally follow those steps: + +First install the package manager: + +```bash +sudo npm i -g pnpm +``` + +And all of the required dependencies: + +```bash +pnpm install +``` + +## Build + +```bash +npm run build +``` + +## Test + +We use playwright in our tests to emulate WASM behaviour in the browser environment: + +```bash +npm run test +``` + +## License + +See license in the [LICENSE.md](../../../LICENSE.md) file diff --git a/programs/beekeeper/beekeeper_wasm/package.json b/programs/beekeeper/beekeeper_wasm/package.json index c5c9f92a32..5325206594 100644 --- a/programs/beekeeper/beekeeper_wasm/package.json +++ b/programs/beekeeper/beekeeper_wasm/package.json @@ -15,6 +15,7 @@ "license": "SEE LICENSE IN LICENSE.md", "files": [ "LICENSE.md", + "README.md", "build/beekeeper_wasm.js", "build/beekeeper_wasm.d.ts", "dist/*.d.ts",