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 #64 from ethereum/slither
Browse files Browse the repository at this point in the history
Remove git, add slither and hardhat
  • Loading branch information
yann300 authored Jul 28, 2021
2 parents 764730e + 18b4510 commit c962adc
Show file tree
Hide file tree
Showing 3 changed files with 160 additions and 56 deletions.
36 changes: 26 additions & 10 deletions main.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
const remixd = require('@remix-project/remixd')
import * as fs from 'fs-extra'
import { services, Websocket, utils } from '@remix-project/remixd'
const path = require('path')
const os = require('os')
const fetch = require('node-fetch')
Expand Down Expand Up @@ -78,12 +79,17 @@ function createWindow () {
})
}

let sharedFolderClient = new remixd.services.sharedFolder()
let gitClient = new remixd.services.GitClient()
let sharedFolderClient = new services.sharedFolder()
let slitherClient = new services.SlitherClient()
let hardhatClient = new services.HardhatClient()
const services = {
git: () => {
gitClient.options.customApi = {}
return gitClient
hardhat: () => {
hardhatClient.options.customApi = {}
return hardhatClient
},
slither: () => {
slitherClient.options.customApi = {}
return slitherClient
},
folder: () => {
sharedFolderClient.options.customApi = {}
Expand Down Expand Up @@ -114,7 +120,7 @@ const ports = {

function startService (service, callback) {
try {
const socket = new remixd.Websocket(ports[service], { remixIdeUrl }, () => services[service]())
const socket = new Websocket(ports[service], { remixIdeUrl }, () => services[service]())
socket.start(callback)
} catch (e) {
console.error(e)
Expand All @@ -127,14 +133,24 @@ let remixdStart = () => {
try {
startService('folder', (ws, client) => {
client.setWebSocket(ws)
client.sharedFolder(currentFolder, false)
client.sharedFolder(currentFolder)
client.setupNotifications(currentFolder)
})

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

// Run hardhat service if a hardhat project is shared as folder
const hardhatConfigFilePath = utils.absolutePath('./', currentFolder) + '/hardhat.config.js'
const isHardhatProject = fs.existsSync(hardhatConfigFilePath)
if (isHardhatProject) {
startService('hardhat', (ws, client) => {
client.setWebSocket(ws)
client.sharedFolder(currentFolder)
})
}

} catch (error) {
throw new Error(error)
Expand Down
175 changes: 131 additions & 44 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -71,12 +71,13 @@
}
},
"dependencies": {
"@remix-project/remixd": "^0.4.0",
"@remix-project/remixd": "^0.5.0",
"electron-app-manager": "0.57.0",
"ipfs": "^0.52.2",
"ipfs-http-gateway": "^0.1.3",
"latest-version": "^5.1.0",
"node-fetch": "^2.6.1",
"semver": "^7.3.5"
"semver": "^7.3.5",
"fs-extra": "^3.0.1"
}
}

0 comments on commit c962adc

Please sign in to comment.