|
|
|
@ -25,6 +25,7 @@ async function warnLatestVersion () { |
|
|
|
|
const services = { |
|
|
|
|
git: (readOnly: boolean) => new servicesList.GitClient(readOnly), |
|
|
|
|
hardhat: (readOnly: boolean) => new servicesList.HardhatClient(readOnly), |
|
|
|
|
slither: (readOnly: boolean) => new servicesList.SlitherClient(readOnly), |
|
|
|
|
folder: (readOnly: boolean) => new servicesList.Sharedfolder(readOnly) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -32,11 +33,12 @@ const services = { |
|
|
|
|
const ports = { |
|
|
|
|
git: 65521, |
|
|
|
|
hardhat: 65522, |
|
|
|
|
slither: 65523, |
|
|
|
|
folder: 65520 |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
const killCallBack: Array<Function> = [] |
|
|
|
|
function startService<S extends 'git' | 'hardhat' | 'folder'> (service: S, callback: (ws: WS, sharedFolderClient: servicesList.Sharedfolder, error?:Error) => void) { |
|
|
|
|
function startService<S extends 'git' | 'hardhat' | 'slither' | 'folder'> (service: S, callback: (ws: WS, sharedFolderClient: servicesList.Sharedfolder, error?:Error) => void) { |
|
|
|
|
const socket = new WebSocket(ports[service], { remixIdeUrl: program.remixIde }, () => services[service](program.readOnly || false)) |
|
|
|
|
socket.start(callback) |
|
|
|
|
killCallBack.push(socket.close.bind(socket)) |
|
|
|
@ -94,6 +96,10 @@ function errorHandler (error: any, service: string) { |
|
|
|
|
sharedFolderClient.setupNotifications(program.sharedFolder) |
|
|
|
|
sharedFolderClient.sharedFolder(program.sharedFolder) |
|
|
|
|
}) |
|
|
|
|
startService('slither', (ws: WS, sharedFolderClient: servicesList.Sharedfolder) => { |
|
|
|
|
sharedFolderClient.setWebSocket(ws) |
|
|
|
|
sharedFolderClient.sharedFolder(program.sharedFolder) |
|
|
|
|
}) |
|
|
|
|
// Run hardhat service if a hardhat project is shared as folder
|
|
|
|
|
const hardhatConfigFilePath = absolutePath('./', program.sharedFolder) + '/hardhat.config.js' |
|
|
|
|
const isHardhatProject = fs.existsSync(hardhatConfigFilePath) |
|
|
|
|