remove deprecated options

remixd
yann300 5 years ago
parent 47c781db80
commit f781cffda1
  1. 48
      README.md
  2. 37
      bin/remixd
  3. 2206
      package-lock.json
  4. 3
      package.json
  5. 3
      src/index.js
  6. 37
      src/services/autoMine.js
  7. 5
      src/services/startFrontend.js
  8. 100
      src/services/startMistGeth.js
  9. 35
      src/services/vyper.js

@ -29,15 +29,6 @@ Alternatively `remixd` can be used to setup a development environment that can b
web sockect connection
-s, --shared-folder <path> Folder to share with Remix IDE
--read-only Treat shared folder as read-only (experimental)
--vyper Run a local vyper compiler
-m, --mist start mist
-g, --geth start geth
-p, --dev-path <dev-path> Folder used by mist/geth to start the development instance
-f, --frontend <front-end> Folder that should be served by remixd
-p, --frontend-port <front-end-port> Http port used by the frontend (default 8082)
-a, --auto-mine mine pending transactions
-r, --rpc <cors-domains> start rpc server. Values are CORS domain
-rp, --rpc-port rpc server port (default 8545)
-h, --help output usage information
```
@ -55,41 +46,4 @@ Furthermore :
- It is not possible to create a file from `Remix IDE` (that might change).
- If a folder does not contain any file, the folder will not be displayed in the explorer (that might change).
- Symbolic links are not forwarded to Remix IDE.
## START GETH, MIST and setup a development environment
Remix allows to start a dev environment. `Geth` is used to spawn a dev blockchain and `Mist` to provide an user interface to interact with dapps in development and Remix IDE (It is also possible to use `Metamask` and a normal browser)
`Mist` and `Geth` are not shipped with Remixd.
Download `Mist` at https://github.com/ethereum/mist/releases
Download `Geth` at https://ethereum.github.io/go-ethereum/downloads
Usage:
`remixd --dev-path /home/devchains/chain1 --mist --geth --frontend /home/frontend --frontend-port 8084 --auto-mine`
- start `geth`.
- start `mist`.
- create a new data folder (`dev-path` option) if it doesn't exist containing blockchain data and keys.
- serve a local folder through an http server (`frontend` and `frontend-port` option).
This option may be used if you want to browse your dapp using `Mist` or a normal browser and `Metamask` (see third example) (https://metamask.io). In this example the web application located at `/home/frontend` will be available at http://127.0.0.1:8084
- start to mine automatically when new transactions are created.
---
`remixd -s /home/user/project1/contracts --remix-ide https://remix.ethereum.org`
- allow accessing the local folder from Remix IDE (http://remix.ethereum.org)
---
`remixd --dev-path /home/devchains/chain1 --rpc --rpc-port 8545 --geth --frontend /home/frontend --frontend-port 8084 --auto-mine`
- do the same as the first example but do not start `Mist`.
 It is still possible to browse a front end app using a normal browser and `Metamask`. The connection between Metamask and `geth` has to be done via rpc connection and thus the rpc server has to be enabled (`rpc` and `rpc-port` options).
 Note that in that case Remix IDE (remix.ethereum.org) does not need Metamask. It is possible to use the `Web3 Provider` option of Remix to connect to the `Geth` RPC endpoints.
 

@ -2,10 +2,6 @@
var Router = require('../src/router')
var servicesList = require('../src/servicesList')
var program = require('commander')
var startmistGeth = require('../src/services/startMistGeth')
var startFrontend = require('../src/services/startFrontend')
var vyper = require('../src/services/vyper')
var fs = require('fs-extra')
program
.usage('-s <shared folder>')
@ -13,48 +9,17 @@ program
.option('--remix-ide <url>', 'URL of remix instance allowed to connect to this web sockect connection')
.option('-s, --shared-folder <path>', 'Folder to share with Remix IDE')
.option('--read-only', 'Treat shared folder as read-only (experimental)')
.option('--vyper', 'Run a local vyper compiler')
.option('-m, --mist', 'start mist')
.option('-g, --geth', 'start geth')
.option('-p, --dev-path <dev-path>', 'Folder used by mist/geth to start the development instance')
.option('-f, --frontend <front-end>', 'Folder that should be served by remixd')
.option('-p, --frontend-port <front-end-port>', 'Http port used by the frontend (default 8082)')
.option('-a, --auto-mine', 'mine pending transactions')
.option('-r, --rpc <cors-domains>', 'start rpc server. Values are CORS domain')
.option('-rp, --rpc-port', 'rpc server port (default 8545)')
.on('--help', function(){
console.log('\nExample:\n\n remixd --dev-path /home/devchains/chain1 --mist --geth --frontend /home/frontend --frontend-port 8084 --auto-mine')
console.log('\nExample:\n\n remixd -s ./ --remix-ide http://localhost:8080')
}).parse(process.argv)
var killCallBack = []
if (program.vyper) {
console.log('starting vyper compiler')
vyper()
}
if (!program.remixIde) {
return console.log('\x1b[31m%s\x1b[0m', '[ERR] URL Remix IDE instance has to be provided.')
}
console.log('\x1b[33m%s\x1b[0m', '[WARN] You may now only use IDE at ' + program.remixIde + ' to connect to that instance')
if (program.devPath) {
if (fs.existsSync(program.devPath)) {
killCallBack.push(startmistGeth(program.devPath, program.mist, program.geth, program.autoMine, program.rpc, program.rpcPort))
} else {
console.log('\x1b[31m%s\x1b[0m', '[ERR] can\'t start mist/geth. ' + program.devPath + ' does not exist')
}
}
if (program.frontend) {
if (!program.frontendPort) program.frontendPort = 8082
if (fs.existsSync(program.frontend)) {
killCallBack.push(startFrontend(program.frontend, program.frontendPort))
} else {
console.log('\x1b[31m%s\x1b[0m', '[ERR] can\'t start frontend. ' + program.frontend + ' does not exist')
}
}
if (program.sharedFolder) {
console.log('\x1b[33m%s\x1b[0m', '[WARN] Any application that runs on your computer can potentially read from and write to all files in the directory.')
console.log('\x1b[33m%s\x1b[0m', '[WARN] Symbolinc links are not forwarded to Remix IDE\n')

2206
package-lock.json generated

File diff suppressed because it is too large Load Diff

@ -1,6 +1,6 @@
{
"name": "remixd",
"version": "0.1.8-alpha.10",
"version": "0.1.8-alpha.12",
"description": "remix server: allow accessing file system from remix.ethereum.org and start a dev environment (see help section)",
"main": "./src/index.js",
"bin": {
@ -39,7 +39,6 @@
"serve": "7.0.0",
"stdout": "0.0.3",
"watch": "^1.0.2",
"web3": "1.0.0-beta.27",
"websocket": "^1.0.24"
},
"python": {

@ -4,9 +4,6 @@ module.exports = {
Router: require('./router'),
utils: require('./utils'),
services: {
startMistGeth: require('./services/startMistGeth'),
startFrontend: require('./services/startFrontend'),
autoMine: require('./services/autoMine'),
sharedFolder: require('./services/sharedFolder')
}
}

@ -1,37 +0,0 @@
module.exports = function (web3) {
console.log('auto mine transactions')
var methods = []
methods.push({
name: 'start',
call: 'miner_start',
inputFormatter: [null],
params: 1
})
methods.push({
name: 'stop',
call: 'miner_stop',
inputFormatter: [],
params: 0
})
web3.extend({
property: 'miner',
methods: methods,
properties: []
})
var timeOutId
web3.eth.subscribe('pendingTransactions', (error, result) => {
if (error) {
console.log(error)
} else {
console.log('start or continue mining')
web3.miner.start()
if (timeOutId) clearTimeout(timeOutId)
timeOutId = setTimeout(() => {
console.log('stop mining')
web3.miner.stop()
}, 30000)
}
})
}

@ -1,5 +0,0 @@
module.exports = function (path, port) {
console.log('\x1b[31m%s\x1b[0m', '[ERR] Front end capability is not available anymore')
function kill () {}
return kill
}

@ -1,100 +0,0 @@
var spawn = require('child_process').spawn
var stdout = require('stdout')
var autoMine = require('./autoMine')
var Web3 = require('web3')
var net = require('net')
var connectTimeout
module.exports = function (dataDir, mist, geth, mine, rpc, rpcPort) {
console.log('opening dev env at ' + dataDir)
// geth --vmdebug --dev --ipcpath /home/yann/Ethereum/testchains/test2/geth.ipc --datadir /home/yann/Ethereum/testchains/test2
var gethprocess
if (geth) {
var ipcPath = dataDir + '/geth.ipc'
var gethArgs = [
'--vmdebug',
'--dev',
'--ipcpath', ipcPath,
'--datadir', dataDir
]
if (rpc) {
gethArgs.push('--rpc')
gethArgs.push('--rpccorsdomain')
gethArgs.push(rpc)
gethArgs.push('--rpcapi')
gethArgs.push('web3,eth,debug,net,personal')
if (!rpcPort) {
rpcPort = 8545
}
gethArgs.push('--rpcport')
gethArgs.push(rpcPort)
}
console.log(gethArgs)
console.log('starting geth ... ')
gethprocess = run('geth', gethArgs)
connectTimeout = setInterval(() => {
connectWeb3(ipcPath, (web3) => {
clearInterval(connectTimeout)
if (mine) {
autoMine(web3)
}
})
}, 1000)
}
// mist --rpc /home/yann/Ethereum/testchains/test2/geth.ipc
var mistprocess
if (mist) {
const mistArgs = [
'--rpc', ipcPath
]
console.log('starting mist ...')
mistprocess = run('mist', mistArgs)
}
function kill () {
if (connectTimeout) {
clearInterval(connectTimeout)
}
if (mistprocess) {
console.log('stopping mist')
mistprocess.kill()
}
if (gethprocess) {
console.log('stopping geth')
gethprocess.kill()
}
}
return kill
}
function connectWeb3 (ipcpath, cb) {
try {
console.log('connect to ' + ipcpath)
var web3 = new Web3(new Web3.providers.IpcProvider(ipcpath, net))
web3.eth.getBlockNumber(function (error) {
if (error) {
console.log('still trying to connect to node... ' + error)
} else {
console.log('web3', web3.version)
cb(web3)
}
})
} catch (e) {}
}
function run (app, args) {
var proc
try {
proc = spawn(app, args)
proc.on('error', (err) => {
console.log('\x1b[31m%s\x1b[0m', '[ERR] can\'t start ' + app + '. seems not installed')
console.log(err)
})
proc.stdout.pipe(stdout())
} catch (e) {
}
return proc
}

@ -1,35 +0,0 @@
var exec = require('child_process').exec
var stdout = require('stdout')
module.exports = function () {
var vyperServer = run('./node_modules/.bin/nopenv vyper-serve', [])
function kill () {
if (vyperServer) {
console.log('stopping vyper compiler')
vyperServer.kill()
}
}
return kill
}
function run (app, args) {
var proc
try {
proc = exec(app, args)
proc.on('error', (err) => {
console.log('\x1b[31m%s\x1b[0m', '[ERR] can\'t start ' + app + '. seems not installed')
console.log(err)
})
proc.on('exit', function (code, signal) {
console.log('child process exited with ' +
`code ${code} and signal ${signal}`)
})
proc.on('message', function (msg) {
console.log(`from ${app} : ${msg}`)
})
proc.stdout.pipe(stdout())
} catch (e) {
console.log(e)
}
return proc
}
Loading…
Cancel
Save