Skip to content

Commit

Permalink
Merge pull request #35 from tonlabs/0.25.0-rc
Browse files Browse the repository at this point in the history
0.25.0 rc
  • Loading branch information
melsomino authored Jul 24, 2020
2 parents bd2ea9a + 6a782d7 commit 040e6a2
Show file tree
Hide file tree
Showing 18 changed files with 705 additions and 76 deletions.
15 changes: 15 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,18 @@ Jenkinsfile
install.sh
uninstall.sh
/.github/workflows/
/testApp/node_modules/
/testApp/suite/_/assets.js
/testApp/suite/_/binaries.js
/testApp/suite/_/giver.js
/testApp/suite/_/init-tests.js
/testApp/suite/aggregations.js
/testApp/suite/auth.js
/testApp/suite/client.js
/testApp/suite/contracts.js
/testApp/suite/crypto.js
/testApp/suite/deploy-ex.js
/testApp/suite/queries.js
/testApp/suite/run-local.js
/testApp/suite/test-error-messages.js
/testApp/package-lock.json
10 changes: 10 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
.DS_Store
.gitignore
.gitattributes
**/.idea/
node_modules/
package-lock.json
**/*.so
**/*.a
/.github/workflows/
testApp/
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
# Release Notes
All notable changes to this project will be documented in this file.

## 0.25.0 - Jul 8, 2020

### New
- `testApp` to run main js test suite inside puppeteer
- supports for core contexts

## 0.19.1 - January 29, 2020

### Fixed
Expand Down
24 changes: 5 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,27 +4,13 @@ TON Labs SDK Client Library for Web

![npm publish](https://github.com/tonlabs/ton-client-web-js/workflows/npm%20publish/badge.svg)

## Run an example:
* Download and run an example:
```
$ git clone https://github.com/tonlabs/ton-client-web-js.git
$ cd ton-client-web-js
$ npm install
$ cd example
$ npm install
$ npm run web
```
* Open http://localhost:4000/ in the browser

This example connects to net.ton.dev and returns the top 10 accounts holding the most grams (filtered by balance, top to bottom).

# Using `ton-client-web-js`

## Using ton-client-web-js
## Requirements

### Requirements
You can run ton-client-web-js in a browser.
You can run `ton-client-web-js` in a browser.

In this example, we'll use webpack to manage assets. Since it requires[Node.js](nodejs.org), you’ll need to install the latest version.
In this example, we'll use webpack to manage assets. Since it requires [Node.js](nodejs.org), you’ll need to install the latest version.

Let's start with a clean [webpack](https://webpack.js.org/) project:

Expand Down Expand Up @@ -132,4 +118,4 @@ See [https://docs.ton.dev/86757ecb2/p/92b041-overview](https://docs.ton.dev/8675


---
Copyright 2018-2020 TON DEV SOLUTIONS LTD.
Copyright 2018-2020 TON DEV SOLUTIONS LTD.
27 changes: 0 additions & 27 deletions example/index.js

This file was deleted.

14 changes: 0 additions & 14 deletions example/web/server.py

This file was deleted.

33 changes: 28 additions & 5 deletions install.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ const http = require('http');
const zlib = require('zlib');
const {version} = require('./package.json');

const bv = process.env.TON_SDK_BIN_VERSION || (version).split('.')[0];
const bv = process.env.TON_SDK_BIN_VERSION || version.split('.')[0];

const root = process.cwd();
const binariesHost = 'sdkbinaries-ws.tonlabs.io';
Expand Down Expand Up @@ -69,14 +69,37 @@ function downloadAndGunzip(dest, url) {
}


// dev_dl - used when this package installed during CI phase or development process.
// Binaries will be copied from location specified by TC_BIN_SRC environment variable.
function dev_dl(dst, binSrc) {
const srcPath = path.resolve(binSrc, dst);
if (!fs.existsSync(srcPath)) {
process.stdout.write(`Skipping ${dst} from ${srcPath} ...\n`);
return;
}
process.stdout.write(`Copying ${dst} from ${srcPath} ...\n`);
const dstPath = path.resolve(root, dst);
const dstDir = path.dirname(path.resolve(dstPath));
if (!fs.existsSync(dstDir)) {
fs.mkdirSync(dstDir, { recursive: true });
}
fs.copyFileSync(srcPath, dstPath);
}


async function dl(dst, src) {
const dst_path = `${root}/${dst}`;
const src_url = `http://${binariesHost}/${src}.gz`;
process.stdout.write(`Downloading from ${src_url} to ${dst_path} ...`);
await downloadAndGunzip(dst_path, src_url);
if ((process.env.TC_BIN_SRC || '') !== '') {
dev_dl(dst, process.env.TC_BIN_SRC);
return;
}
const dstPath = path.resolve(root, dst);
const srcUrl = `http://${binariesHost}/${src}.gz`;
process.stdout.write(`Downloading from ${srcUrl} to ${dstPath} ...`);
await downloadAndGunzip(dstPath, srcUrl);
process.stdout.write('\n');
}


async function main() {
await dl('tonclient.wasm', `tonclient_${bv}_wasm`);
await dl('index.js', `tonclient_${bv}_wasm_js`);
Expand Down
12 changes: 6 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ton-client-web-js",
"version": "0.24.0",
"version": "0.25.0",
"description": "TON Client Library for Web",
"scripts": {
"install": "node install.js"
Expand All @@ -14,18 +14,18 @@
"author": "TON DEV SOLUTIONS LTD.",
"license": "Apache-2.0",
"licenses": [
{
"type": "Apache-2.0",
"url": "http://www.apache.org/licenses/LICENSE-2.0"
}
{
"type": "Apache-2.0",
"url": "http://www.apache.org/licenses/LICENSE-2.0"
}
],
"repository": {
"type": "git",
"url": "https://github.com/tonlabs/ton-client-web-js.git"
},
"homepage": "https://ton.dev/node-se",
"dependencies": {
"ton-client-js": "^0.24.0"
"ton-client-js": "^0"
},
"main": "index.js"
}
32 changes: 32 additions & 0 deletions testApp/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# ton-client-web-js

TON Labs Client Library for Web Test App

This project contains the `testApp` that runs the main test suite from `ton-client-js`.

# Requirements

Common:
- NodeJs (at least 12)

# Run Tests

```shell script
npm install
node prepare-suite.js
node run-suite.js
```

# Options

There are some options for preparing and testing:
- `ton-client-js` package besided of the `ton-client-web-js` folder – if it exists then this local package will be used instead of the npm version (local `ton-client-js` will be packed with `npm pack` and then installed into the `testApp` package). This may be useful for running tests with a non published version of the `ton-client-js`.
- `USE_NODE_SE` and `TON_NETWORK_ADDRESS` env variables – used to specify blockchain network for tests. Must be set before `prepare-suite.js` script execution.
- `TC_BIN_SRC` env variable – can be used to specify a local path of a folder with alternative WASM binaries. Variable must be set before `prepare-suite.js` execution. This may be useful for running tests with a non published version of the core library. The required content for this folder is:
- `tonclient.wasm`
- `index.js`
- `TON-SDK` project besided of the `ton-client-web-js` folder – if it exists and `TC_BIN_SRC` doesn't specified then `TC_BIN_SRC` will be set to build output for the WASM core library. This may be useful for running tests with a non published version of the core library.


---
Copyright 2018-2020 TON DEV SOLUTIONS LTD.
File renamed without changes.
5 changes: 5 additions & 0 deletions testApp/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import {startTests} from "./suite/_/run";

window.addEventListener('load', () => {
startTests(() => {});
});
16 changes: 11 additions & 5 deletions example/package.json → testApp/package.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"name": "ton-client-web-js-example",
"version": "1.0.0",
"description": "TON Client Library for Web - Example",
"name": "ton-client-web-js-test-suite-runner",
"version": "0.25.0",
"description": "TON Client Library for Web - Test Suite Runner",
"scripts": {
"nmp install": "npm install",
"web": "webpack-dev-server -d --config webpack.config.js --progress --colors --host 0.0.0.0",
"npm install": "npm install",
"web": "webpack-dev-server -d --config webpack.config.js --progress --colors --host 127.0.0.1",
"web:bundle": "webpack -p --config webpack.config.js --progress --colors --display-error-details"
},
"keywords": [
Expand All @@ -21,9 +21,15 @@
},
"homepage": "https://ton.dev/node-se",
"dependencies": {
"error-polyfill": "^0.1.2",
"javascript-biginteger": "^0.9.2",
"jest-lite": "^1.0.0-alpha.4",
"opentracing": "^0.14.4",
"ton-client-js": "^0",
"ton-client-web-js": "../"
},
"devDependencies": {
"puppeteer": "^4.0.1",
"webpack": "4.41.5",
"webpack-cli": "3.3.10",
"webpack-dev-server": "3.10.1",
Expand Down
Loading

0 comments on commit 040e6a2

Please sign in to comment.