Skip to content

Commit 1f58a72

Browse files
filip mertensAniket-Engg
authored andcommitted
cleanup
1 parent 00caebd commit 1f58a72

File tree

6 files changed

+38
-75
lines changed

6 files changed

+38
-75
lines changed

apps/remix-ide/ci/downloadsoljson.sh

Lines changed: 37 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,50 @@
11
#!/usr/bin/env bash
22

3-
echo "Downloading latest soljson.js from https://binaries.soliditylang.org/wasm/list.json"
3+
echo "Downloading specified soljson.js version based on defaultVersion in package.json"
4+
45
set -e
5-
# check if curl is installed
6-
if ! command -v curl &> /dev/null
7-
then
6+
7+
# Check if curl and jq are installed
8+
if ! command -v curl &> /dev/null; then
89
echo "curl could not be found"
9-
exit
10+
exit 1
11+
fi
12+
13+
if ! command -v jq &> /dev/null; then
14+
echo "jq could not be found"
15+
exit 1
1016
fi
1117

18+
# Read the defaultVersion from package.json
19+
defaultVersion=$(jq -r '.defaultVersion' package.json)
20+
echo "Specified version from package.json: $defaultVersion"
1221

13-
# download https://binaries.soliditylang.org/wasm/list.json as json
22+
# Download the list.json file containing available versions
1423
curl -s https://binaries.soliditylang.org/wasm/list.json > list.json
15-
# get the latest version without jq
16-
latest=$(grep 'latestRelease' list.json | cut -d '"' -f 4)
17-
echo "latest version: $latest"
18-
# get url
19-
url=$(grep "\"$latest\":" list.json | cut -d '"' -f 4)
20-
echo "url: $url"
21-
path="https://binaries.soliditylang.org/bin/$url"
22-
echo "path: $path"
23-
# download the file to ./apps/remix-ide/src/assets/js/soljson.js
24-
curl -s $path > ./apps/remix-ide/src/assets/js/soljson.js
25-
# if directory ./apps/remix-ide/src/assets/js/soljson does not exist, create it
24+
25+
# Use jq to extract the path for the specified version from the builds array
26+
path=$(jq -r --arg version "$defaultVersion" '.builds[] | select(.path==$version) | .path' list.json)
27+
if [ -z "$path" ]; then
28+
echo "The specified version $defaultVersion could not be found in the list"
29+
exit 1
30+
fi
31+
32+
echo "Path for the specified version: $path"
33+
fullPath="https://binaries.soliditylang.org/bin/$path"
34+
echo "Download fullPath: $fullPath"
35+
36+
# Ensure the target directory exists
2637
if [ ! -d "./apps/remix-ide/src/assets/js/soljson" ]; then
27-
mkdir ./apps/remix-ide/src/assets/js/soljson
38+
mkdir -p ./apps/remix-ide/src/assets/js/soljson
2839
fi
29-
cp ./apps/remix-ide/src/assets/js/soljson.js ./apps/remix-ide/src/assets/js/soljson/$url
40+
41+
# Download the file to ./apps/remix-ide/src/assets/js/soljson.js
42+
echo "Downloading soljson.js from "$fullPath" to ./apps/remix-ide/src/assets/js/soljson.js"
43+
curl -s "$fullPath" > ./apps/remix-ide/src/assets/js/soljson.js
44+
45+
# Copy the downloaded soljson.js to the specific version directory
46+
cp ./apps/remix-ide/src/assets/js/soljson.js "./apps/remix-ide/src/assets/js/soljson/$path"
3047
cp list.json ./apps/remix-ide/src/assets/list.json
3148

32-
# remove list.json
49+
# Clean up by removing the list.json
3350
rm list.json
34-

apps/remix-ide/ci/downloadsoljson2.sh

Lines changed: 0 additions & 50 deletions
This file was deleted.

apps/remix-ide/webpack.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ const versionData = {
1717
const loadLocalSolJson = async () => {
1818
//execute apps/remix-ide/ci/downloadsoljson.sh
1919
console.log('loading local soljson')
20-
const child = require('child_process').execSync('bash ' + __dirname + '/ci/downloadsoljson2.sh', { encoding: 'utf8', cwd: process.cwd(), shell: true })
20+
const child = require('child_process').execSync('bash ' + __dirname + '/ci/downloadsoljson.sh', { encoding: 'utf8', cwd: process.cwd(), shell: true })
2121
// show output
2222
console.log(child)
2323
}

libs/remix-solidity/src/compiler/compiler.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,6 @@ export class Compiler {
112112
*/
113113

114114
onCompilerLoaded(version: string, license: string): void {
115-
console.log('compiler loaded:', version)
116115
this.state.currentVersion = version
117116
this.state.compilerLicense = license
118117
this.event.trigger('compilerLoaded', [version, license])

libs/remix-ui/solidity-compiler/src/lib/compiler-container.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ import { CompilerDropdown } from './components/compiler-dropdown'
1919

2020

2121
const defaultPath = 'compiler_config.json'
22-
console.log('local version', packageJson.defaultVersion)
2322

2423
declare global {
2524
interface Window {

libs/remix-ui/solidity-compiler/src/lib/solidity-compiler.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ import './css/style.css'
1111
import { iSolJsonBinData, iSolJsonBinDataBuild } from '@remix-project/remix-lib'
1212

1313
const defaultPath = 'compiler_config.json'
14-
console.log('local version', packageJson.defaultVersion)
1514

1615
export const SolidityCompiler = (props: SolidityCompilerProps) => {
1716
const {

0 commit comments

Comments
 (0)