grep script

pull/3668/head^2
filip mertens 2 years ago
parent 78e0bc7631
commit 20e3b666e8
  1. 51
      apps/remix-ide/ci/download_e2e_assets.js
  2. 2
      apps/remix-ide/webpack.config.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 => {
}
});
*/

@ -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({

Loading…
Cancel
Save