From 20e3b666e846f12a74ca7f51572bed46840cbc32 Mon Sep 17 00:00:00 2001 From: filip mertens Date: Mon, 1 May 2023 12:21:16 +0200 Subject: [PATCH] grep script --- apps/remix-ide/ci/download_e2e_assets.js | 51 +++++++++++++++++++++++- apps/remix-ide/webpack.config.js | 2 +- 2 files changed, 51 insertions(+), 2 deletions(-) diff --git a/apps/remix-ide/ci/download_e2e_assets.js b/apps/remix-ide/ci/download_e2e_assets.js index 392941536a..edd73ba57a 100644 --- a/apps/remix-ide/ci/download_e2e_assets.js +++ b/apps/remix-ide/ci/download_e2e_assets.js @@ -1,9 +1,11 @@ const testFolder = './apps/remix-ide-e2e/src/tests/'; const fs = require('fs'); +var child_process = require('child_process'); let url = 'https://binaries.soliditylang.org/wasm/list.json' -const axios = require('axios') +const axios = require('axios'); +const { exit } = require('process'); // use axios to download the file /* @@ -41,6 +43,51 @@ axios({ ) */ + + +var child = child_process.spawnSync('grep', ['-ir', '"\soljson-v0"', 'libs/*', 'apps/*'], { encoding: 'utf8', cwd: process.cwd(), shell: true }); + +if (child.error) { + console.log("ERROR: ", child); + exit(1); +} + + +const re = /(?<=soljson).*(?=(.js))/g; +const soljson = child.stdout.match(re); +if (soljson) { + for (let i = 0; i < soljson.length; i++) { + const version = soljson[i]; + if (version) { + let url = '' + + url = `https://binaries.soliditylang.org/bin/soljson${version}.js`; + console.log(url) + const path = `./dist/apps/remix-ide/assets/js/soljson${version}.js`; + // use axios to get the file + try { + axios({ + method: 'get', + url: url, + }).then(function (response) { + fs.writeFile(path, response.data, function (err) { + if (err) { + console.log(err); + } + }) + }) + } catch (e) { + console.log('Failed to download soljson' + version + ' from ' + url) + } + + + } + + } +} + +/* + fs.readdirSync(testFolder).forEach(file => { let c = fs.readFileSync(testFolder + file, 'utf8'); const re = /(?<=soljson).*(?=(.js))/g; @@ -78,3 +125,5 @@ fs.readdirSync(testFolder).forEach(file => { } }); + +*/ diff --git a/apps/remix-ide/webpack.config.js b/apps/remix-ide/webpack.config.js index a10a6a3e47..8006ff5591 100644 --- a/apps/remix-ide/webpack.config.js +++ b/apps/remix-ide/webpack.config.js @@ -23,7 +23,7 @@ const loadLocalSolJson = async () => { let info = response.data; info.builds = info.builds.filter(build => build.path.indexOf('nightly') === -1) info.builds = info.builds.slice(-1) - const buildurl = `https://solc-bin.ethereum.org/wasm/${info.builds[0].path}`; + const buildurl = `https://binaries.soliditylang.org/bin/${info.builds[0].path}`; console.log(`Copying... ${buildurl} to assets`) const path = `./apps/remix-ide/src/assets/js/soljson.js`; axios({