diff --git a/javascript/package-lock.json b/javascript/package-lock.json index f36651f94..00bdaf15e 100644 --- a/javascript/package-lock.json +++ b/javascript/package-lock.json @@ -4477,11 +4477,11 @@ }, "packages/cli": { "name": "@zombienet/cli", - "version": "1.3.14", + "version": "1.3.16", "license": "GPL-3.0-or-later", "dependencies": { "@zombienet/dsl-parser-wrapper": "^0.1.6", - "@zombienet/orchestrator": "^0.0.9", + "@zombienet/orchestrator": "^0.0.10", "@zombienet/utils": "^0.0.5", "axios": "^0.27.2", "debug": "^4.3.2", @@ -4501,32 +4501,6 @@ "node": ">=16" } }, - "packages/cli/node_modules/@zombienet/orchestrator": { - "version": "0.0.9", - "resolved": "https://registry.npmjs.org/@zombienet/orchestrator/-/orchestrator-0.0.9.tgz", - "integrity": "sha512-5fDisa46WBymL09s3NjmgnAtxxe3by8Flif+i1Ri5uNGBOGh2uIa0sceVBb5cJT77s2VbTu6guZNz05Dm4HZ4A==", - "dependencies": { - "@polkadot/api": "^9.2.4", - "@polkadot/keyring": "^10.1.6", - "@polkadot/util-crypto": "^10.1.6", - "@zombienet/utils": "^0.0.5", - "axios": "^0.27.2", - "chai": "^4.3.4", - "debug": "^4.3.2", - "execa": "^5.1.1", - "fs-extra": "^10.0.0", - "jsdom": "^20.0.0", - "json-bigint": "^1.0.0", - "libp2p-crypto": "^0.21.2", - "minimatch": "^5.1.0", - "mocha": "^10.0.0", - "napi-maybe-compressed-blob": "0.0.2", - "peer-id": "^0.16.0", - "tmp-promise": "^3.0.2", - "typescript": "^4.8.2", - "yaml": "^2.0.0-9" - } - }, "packages/orchestrator": { "name": "@zombienet/orchestrator", "version": "0.0.10", @@ -5257,7 +5231,7 @@ "@types/nunjucks": "^3.2.1", "@types/progress": "^2.0.5", "@zombienet/dsl-parser-wrapper": "^0.1.6", - "@zombienet/orchestrator": "^0.0.9", + "@zombienet/orchestrator": "^0.0.10", "@zombienet/utils": "^0.0.5", "axios": "^0.27.2", "debug": "^4.3.2", @@ -5265,34 +5239,6 @@ "pkg": "~5.8.0", "progress": "^2.0.3", "typescript": "^4.8.2" - }, - "dependencies": { - "@zombienet/orchestrator": { - "version": "0.0.9", - "resolved": "https://registry.npmjs.org/@zombienet/orchestrator/-/orchestrator-0.0.9.tgz", - "integrity": "sha512-5fDisa46WBymL09s3NjmgnAtxxe3by8Flif+i1Ri5uNGBOGh2uIa0sceVBb5cJT77s2VbTu6guZNz05Dm4HZ4A==", - "requires": { - "@polkadot/api": "^9.2.4", - "@polkadot/keyring": "^10.1.6", - "@polkadot/util-crypto": "^10.1.6", - "@zombienet/utils": "^0.0.5", - "axios": "^0.27.2", - "chai": "^4.3.4", - "debug": "^4.3.2", - "execa": "^5.1.1", - "fs-extra": "^10.0.0", - "jsdom": "^20.0.0", - "json-bigint": "^1.0.0", - "libp2p-crypto": "^0.21.2", - "minimatch": "^5.1.0", - "mocha": "^10.0.0", - "napi-maybe-compressed-blob": "0.0.2", - "peer-id": "^0.16.0", - "tmp-promise": "^3.0.2", - "typescript": "^4.8.2", - "yaml": "^2.0.0-9" - } - } } }, "@zombienet/dsl-parser-wrapper": { diff --git a/javascript/packages/cli/src/cli.ts b/javascript/packages/cli/src/cli.ts index 44f1ec272..e05345723 100644 --- a/javascript/packages/cli/src/cli.ts +++ b/javascript/packages/cli/src/cli.ts @@ -63,50 +63,56 @@ let network: Network | undefined; // Download the binaries const downloadBinaries = async (binaries: string[]): Promise => { - console.log(`${decorators.yellow("\nStart download...\n")}`); - const promises = []; - let count = 0; - for (let binary of binaries) { - promises.push( - new Promise(async (resolve) => { - const { url, name } = options[binary]; - const { data, headers } = await axios({ - url, - method: "GET", - responseType: "stream", - }); - const totalLength = headers["content-length"]; - - const progressBar = new progress( - "-> downloading [:bar] :percent :etas", - { - width: 40, - complete: "=", - incomplete: " ", - renderThrottle: 1, - total: parseInt(totalLength), - }, - ); - - const writer = fs.createWriteStream(path.resolve(__dirname, name)); - - data.on("data", (chunk: any) => progressBar.tick(chunk.length)); - data.pipe(writer); - data.on("end", () => { - console.log(decorators.yellow(`Binary "${name}" downloaded`)); - // Add permissions to the binary - console.log(decorators.cyan(`Giving permissions to "${name}"`)); - fs.chmodSync(path.resolve(__dirname, name), 0o755); - resolve(); - }); - }), + try { + console.log(`${decorators.yellow("\nStart download...\n")}`); + const promises = []; + let count = 0; + for (let binary of binaries) { + promises.push( + new Promise(async (resolve) => { + const { url, name } = options[binary]; + const { data, headers } = await axios({ + url, + method: "GET", + responseType: "stream", + }); + const totalLength = headers["content-length"]; + + const progressBar = new progress( + "-> downloading [:bar] :percent :etas", + { + width: 40, + complete: "=", + incomplete: " ", + renderThrottle: 1, + total: parseInt(totalLength), + }, + ); + + const writer = fs.createWriteStream(path.resolve(name)); + + data.on("data", (chunk: any) => progressBar.tick(chunk.length)); + data.pipe(writer); + data.on("end", () => { + console.log(decorators.yellow(`Binary "${name}" downloaded`)); + // Add permissions to the binary + console.log(decorators.cyan(`Giving permissions to "${name}"`)); + fs.chmodSync(path.resolve(name), 0o755); + resolve(); + }); + }), + ); + } + await Promise.all(promises); + console.log( + decorators.cyan( + `Please add the current dir to your $PATH by running the command:\n`, + ), + decorators.blue(`export PATH=${process.cwd()}:$PATH`), ); + } catch (err) { + console.log("Unexpected error: ", err); } - await Promise.all(promises); - console.log( - decorators.cyan(`Please add the dir to your $PATH by running the command:`), - decorators.blue(`export PATH=${__dirname}:$PATH`), - ); }; // Retrieve the latest release for polkadot