remix-project mirror
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
remix-project/apps/remix-ide/ci/download_e2e_assets.js

81 lines
2.2 KiB

2 years ago
const testFolder = './apps/remix-ide-e2e/src/tests/';
const fs = require('fs');
2 years ago
let url = 'https://binaries.soliditylang.org/wasm/list.json'
2 years ago
2 years ago
const axios = require('axios')
// use axios to download the file
2 years ago
/*
2 years ago
axios({
url: url,
method: 'GET',
}).then((response) => {
let info = response.data;
info.builds = info.builds.filter(build => build.path.indexOf('nightly') === -1)
for (let build of info.builds) {
const buildurl = `https://solc-bin.ethereum.org/wasm/${build.path}`;
console.log(buildurl)
const path = `./dist/apps/remix-ide/assets/js/${build.path}`;
// use axios to get the file
try {
axios({
method: 'get',
url: buildurl,
}).then(function (response) {
fs.writeFile(path, response.data, function (err) {
if (err) {
console.log(err);
}
})
})
} catch (e) {
console.log('Failed to download ' + build.path + ' from ' + buildurl)
}
2 years ago
2 years ago
}
2 years ago
}
)
2 years ago
*/
2 years ago
fs.readdirSync(testFolder).forEach(file => {
let c = fs.readFileSync(testFolder + file, 'utf8');
const re = /(?<=soljson).*(?=(.js))/g;
const soljson = c.match(re);
if (soljson) {
2 years ago
console.log(soljson)
2 years ago
for (let i = 0; i < soljson.length; i++) {
const version = soljson[i];
2 years ago
if (version) {
2 years ago
const url = `https://solc-bin.ethereum.org/bin/soljson${version}.js`;
console.log(url)
const path = `./dist/apps/remix-ide/assets/js/soljson${version}.js`;
2 years ago
// 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)
}
2 years ago
}
}
}
2 years ago
});