Skip to content
This repository has been archived by the owner on May 23, 2024. It is now read-only.

Commit

Permalink
Merge pull request #98 from ethereum/fixremixd
Browse files Browse the repository at this point in the history
Fixremixd
  • Loading branch information
bunsenstraat committed Dec 3, 2021
2 parents d502e8d + 0d460f3 commit 22925bf
Show file tree
Hide file tree
Showing 6 changed files with 5,235 additions and 1,951 deletions.
10 changes: 6 additions & 4 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,15 @@ aliases:
# run: node --version && yarn install

- &install
run: node --version && npm install
run: node --version && yarn

- &test_e2e
run: yarn test:e2e -s

- &run_script
run:
name: "Building app (deploy if on master)"
no_output_timeout: 30m
command: |
if [[ "${CIRCLE_BRANCH}" == 'master' ]]; then
yarn release --$GRID_ENV;
Expand All @@ -58,23 +59,24 @@ aliases:
jobs:
build:
docker:
- image: electronuserland/builder:10
- image: electronuserland/builder:14
environment:
GRID_ENV: linux
working_directory: ~/repo
<<: *run_steps

build-win:
docker:
- image: electronuserland/builder:wine-01.19
- image: electronuserland/builder:wine
environment:
GRID_ENV: win
working_directory: ~/repo
<<: *run_steps

build-mac:
resource_class: xlarge
macos:
xcode: '10.0'
xcode: 13.1.0
environment:
GRID_ENV: mac
working_directory: ~/repo
Expand Down
3 changes: 2 additions & 1 deletion applicationMenu.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const {Menu, shell, app} = require('electron')
const os = require('os')
const config = require('./config')
const selectFolder = require('./selectFolder')

module.exports = (outdatedVersion, sharedFolderClient) => {
Expand Down Expand Up @@ -31,6 +31,7 @@ const template = [
click: async () => {
selectFolder().then((folder) => {
sharedFolderClient(folder)
config.write({sharedFolder:folder})
}).catch(console.log)
}
},
Expand Down
28 changes: 28 additions & 0 deletions config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
const fs = require('fs')
const os = require('os')
const path = require('path')

const cacheDir = path.join(os.homedir(), '.cache_remix_ide')
const write = (data) => {
const cache = read()
try {
fs.writeFileSync(cacheDir + '/config.json', JSON.stringify({...cache, ...data}))
} catch (e) {
console.error('Can\'t write config file', e)
}
}

const read = () => {
if(fs.existsSync(cacheDir + '/config.json')){
try {
const data = JSON.parse(fs.readFileSync(cacheDir + '/config.json'))
return data
}catch(e){
console.error('Can\'t read config file', e)
}
}
return undefined
}

exports.write = write
exports.read = read
27 changes: 20 additions & 7 deletions main.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
const fs = require('fs')
const remixd = require('@remix-project/remixd')
const utils = remixd.utils
const remixd = require('@remix-project/remixd/src')
const path = require('path')
const os = require('os')
const fetch = require('node-fetch')
const semver = require('semver')
const IPFS = require('ipfs')
const config = require('./config')
const IPFSGateway = require('ipfs-http-gateway')

const { version } = require('./package.json')
Expand Down Expand Up @@ -132,24 +132,37 @@ function startService (service, callback) {
}
}

// return either current folder in client, or the one in cache or by default the os homedir
function getFolder(client) {
if(client.currentSharedFolder) return client.currentSharedFolder
const cache = config.read()
if(cache){
try {
const folder = cache.sharedFolder
if(fs.existsSync(folder)) return folder
}catch(e){
}
}
return os.homedir()
}

let remixdStart = () => {
console.log('start shared folder service')
const currentFolder = process.cwd()
try {
startService('folder', (ws, client) => {
client.setWebSocket(ws)
client.sharedFolder(currentFolder)
client.setupNotifications(currentFolder)
client.sharedFolder(getFolder(client))
client.setupNotifications(getFolder(client))
})

startService('slither', (ws, client) => {
client.setWebSocket(ws)
client.sharedFolder(currentFolder)
client.sharedFolder(getFolder(client))
})

startService('hardhat', (ws, client) => {
client.setWebSocket(ws)
client.sharedFolder(currentFolder)
client.sharedFolder(getFolder(client))
})

} catch (error) {
Expand Down
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "1.3.2",
"version": "1.3.3",
"name": "remix-ide",
"description": "Remix - Ethereum IDE",
"main": "main.js",
Expand Down Expand Up @@ -34,6 +34,7 @@
"selectFolder.js",
"setFolder.js",
"applicationMenu.js",
"config.js",
"build/icon.png",
"*.asar",
"*.zip"
Expand Down Expand Up @@ -71,7 +72,7 @@
}
},
"dependencies": {
"@remix-project/remixd": "^0.5.0",
"@remix-project/remixd": "^0.5.5",
"electron-app-manager": "0.57.0",
"ipfs": "^0.52.2",
"ipfs-http-gateway": "^0.1.3",
Expand Down
Loading

2 comments on commit 22925bf

@alexincrypto
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello) How to use this fix on M1 ?

@mangesh-singh
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

kindly explain how to use this

Please sign in to comment.