Skip to content

Commit

Permalink
Merge pull request #25 from tonlabs/0.23.0-rc
Browse files Browse the repository at this point in the history
Version 0.23.0
  • Loading branch information
diserere authored May 14, 2020
2 parents 52cec81 + fdfb41e commit 7e24724
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 13 deletions.
21 changes: 11 additions & 10 deletions install.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,12 @@ const fs = require('fs');
const path = require('path');
const http = require('http');
const zlib = require('zlib');
const {version, binaries_version} = require('./package.json');

const v = process.env.npm_package_version.split('.');
const binariesVersion = `${v[0]}.${v[1]}.${~~(Number.parseInt(v[2]) / 100) * 100}`;
const bv = binariesVersion.split('.').join('_');
const bv = (binaries_version || version).split('.')[0];

const root = process.cwd();
const binariesHost = 'sdkbinaries.tonlabs.io';
const binariesHost = 'sdkbinaries-ws.tonlabs.io';


function downloadAndGunzip(dest, url) {
Expand All @@ -21,8 +20,8 @@ function downloadAndGunzip(dest, url) {
});
return;
}
fs.mkdirSync(path.dirname(path.resolve(dest)), { recursive: true });
let file = fs.createWriteStream(dest, { flags: "w" });
fs.mkdirSync(path.dirname(path.resolve(dest)), {recursive: true});
let file = fs.createWriteStream(dest, {flags: "w"});
let opened = false;
const failed = (err) => {
if (file) {
Expand Down Expand Up @@ -73,7 +72,7 @@ function downloadAndGunzip(dest, url) {
async function dl(dst, src) {
const dst_path = `${root}/${dst}`;
const src_url = `http://${binariesHost}/${src}.gz`;
process.stdout.write(`Downloading ${dst} from ${binariesHost} ...`);
process.stdout.write(`Downloading ${dst} from ${src_url} to ${dst_path} ...`);
await downloadAndGunzip(dst_path, src_url);
process.stdout.write('\n');
}
Expand All @@ -96,7 +95,8 @@ function getTemplate(name) {

function getWasmWrapperScript() {
let script = fs.readFileSync(path.join(root, 'tonclient.wasm.js'), 'utf-8');
script = script.replace(/^import \* as wasm from .*$/gm,
script = script.replace(
/^import \* as wasm from .*$/gm,
`
const wasmWrapper = (function() {
let wasm = null;
Expand All @@ -105,7 +105,8 @@ const result = {
wasm = newWasm;
},
};
`);
`,
);
script = script.replace(/^export const /gm, 'result.');
script = script.replace(/^export function (\w+)/gm, 'result.$1 = function');
script +=
Expand All @@ -117,7 +118,7 @@ const result = {
function getWorkerScript() {
return [
getWasmWrapperScript(),
getTemplate('install-worker.js')
getTemplate('install-worker.js'),
].join('\n');
}

Expand Down
13 changes: 10 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"name": "ton-client-web-js",
"version": "0.22.0",
"version": "0.23.0",
"binaries_version": "0.23.1",
"description": "TON Client Library for Web",
"scripts": {
"install": "node install.js"
Expand All @@ -12,14 +13,20 @@
"Client"
],
"author": "TON DEV SOLUTIONS LTD.",
"license": "SEE LICENSE IN LICENSE",
"license": "Apache-2.0",
"licenses": [
{
"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.22.0"
"ton-client-js": "^0.23.0"
},
"main": "index.js"
}

0 comments on commit 7e24724

Please sign in to comment.