-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Move Remixd To Monorepo #454
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 242 commits
597bdda
4f38c81
1e7dec2
b5a333e
d64aa20
39d2294
95a8402
a9d193c
e9c1759
89bb8da
7118fec
1c9ace3
4b231d0
1f4ca7b
40ebee6
8c8f8e3
2bb8af1
8719ce8
095bbbf
4cbe4c1
4419de2
71eeccb
6e8a374
331d80f
737be30
8d3535c
35d08d5
59a978d
9afa147
18f43db
ae2fa15
78de88f
67fc597
bb49089
a761f32
433c76c
e11cd15
7fb0d12
54a6e7b
db31196
f01bc34
3ce3197
c950c2a
b533d23
cc10dee
e955474
b799d60
9f5118c
9e2d4f2
c0f15b7
4896738
b6dd52e
8f98313
5c57387
da5193d
ce5b07b
8e95ed4
fbc9175
2400828
abea260
6fa383f
ae26732
eafcb82
252f235
a584d3e
ade0e9d
923864a
0c994d2
4e3104e
c40d7d5
0dd443b
97e53d7
1cfeec7
45b8ca4
48681a8
7e61c9b
014271d
b522bcc
a75754e
c9bea2d
c694ce4
7711dec
2dce934
ea85668
a0823a3
40c8a8b
7ed178b
6c63bc3
2ea09a9
8b0eeb7
23b0e3f
8dc3993
8abe312
21f9fe0
4b216ea
e1cd972
02c8466
c6a60bb
0111fbd
7853663
10e9d27
3612a88
885e423
0bd1b40
24f3e29
45d9e9e
4c8fea7
05ca2b0
bae3873
1a9ec32
6af4735
0c98399
47ede42
8a2a303
b204da5
8a68ebf
5a480a0
00d4010
fbfe18d
69d89a7
59a5149
4c7c1cf
3fe9439
d15e205
aa7d4a2
2596169
30bbfdc
bcfddea
47c781d
f781cff
3a255fb
420392a
f3c5654
e6c71df
b4db7e1
fea3c68
e8e77d9
90ee236
eb3d850
daea355
fbe6ba6
70bf7c3
520c6bf
1140864
ace74ef
a981a19
a0b8438
9e1eff9
49ee3ed
db4e5cd
6ccf999
ea9783d
1780f57
30e3d7f
aaae27f
9113c83
8b4cc0c
44855af
3102f2e
9e95d6b
fc08022
c9203f5
473c9e8
5b7f9a2
7dc8360
dc91150
cbb8e6f
f1ef62b
80ab352
ec9c474
0354e21
3c965c9
80c800e
1a17fbd
0966a57
9bcc15c
a229bc4
9116649
85eaa9c
e376b2e
853e4a2
202198a
1502cd9
ed177e8
91e2f23
5c74bc3
3f2917d
1c92105
a8bb29b
b40a8ef
d96d7db
b891595
5273f51
9538073
4f97b99
b32ee39
d1936c6
4aa3125
1b46e80
e7e938a
fc573bf
17143af
dec0a7e
1e69ffb
0b4ecb3
632d9cd
077223a
bee4b88
a342b78
9b3f6f5
adab5a7
d7de137
59d88b4
4da76d5
9a5c0c9
907d3c5
1d277cf
681de1d
456283e
4341f0a
051808f
cfd5e78
08df378
d050861
7f28e46
daedd1d
5edb5fd
aa88a3e
f304be0
cd470fa
68b8e21
1c7637c
95855a1
2b419e4
d9526c5
53342f2
3cc58f5
fa578e7
2929b70
4239318
55ce0df
7619a0a
2362fda
c027b39
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,4 @@ | ||
| gist_token=<token> | ||
| account_passphrase=<passphrase> | ||
| account_password=<password> | ||
| account_password=<password> | ||
| NODE_OPTIONS=--max-old-space-size=2048 |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,7 +1,8 @@ | ||
| { | ||
| "extends": "../../.eslintrc", | ||
| "rules": { | ||
| "@typescript-eslint/no-explicit-any": "off" | ||
| "@typescript-eslint/no-explicit-any": "off", | ||
| "@typescript-eslint/prefer-namespace-keyword": "off" | ||
| }, | ||
| "ignorePatterns": ["!**/*"] | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| { "extends": "../../.eslintrc", "rules": {}, "ignorePatterns": ["!**/*"] } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,49 @@ | ||
| # Remixd | ||
|
|
||
| `remixd` is a tool that intend to be used with [Remix IDE](http://github.com/ethereum/browser-solidity) (aka. Browser-Solidity). It allows a websocket connection between | ||
| `Remix IDE` (web application) and the local computer. | ||
|
|
||
| Practically Remix IDE make available a folder shared by `remixd`. | ||
ioedeveloper marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| More details are explained in this [tutorial](http://remix.readthedocs.io/en/latest/tutorial_remixd_filesystem.html). | ||
ioedeveloper marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| Alternatively `remixd` can be used to setup a development environment that can be used with other popular frameworks like Embark, Truffle, Ganache, etc.. | ||
|
|
||
| `remixd` needs `npm` and `node` | ||
|
|
||
| ## INSTALLATION | ||
|
|
||
| `npm install -g remixd` | ||
ioedeveloper marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| ## HELP SECTION | ||
|
|
||
| ``` | ||
| Usage: remixd -s <shared folder> --remix-ide https://remix.ethereum.org | ||
|
|
||
| Provide a two-way connection between the local computer and Remix IDE. | ||
|
|
||
|
|
||
| Options: | ||
|
|
||
| --remix-ide <url> URL of remix instance allowed to connect to this | ||
| web sockect connection | ||
| -s, --shared-folder <path> Folder to share with Remix IDE | ||
| --read-only Treat shared folder as read-only (experimental) | ||
| -h, --help output usage information | ||
|
|
||
| ``` | ||
|
|
||
| ## SHARE A FOLDER | ||
|
|
||
| `remixd -s <absolute-path> --remix-ide https://remix.ethereum.org` | ||
|
|
||
| The current user should have `read/write` access to the folder (at least `read` access). | ||
|
|
||
| It is important to notice that changes made to the current file in `Remix IDE` are automatically saved to the local computer every 5000 ms. There is no `Save` action. But the `Ctrl-Z` (undo) can be used. | ||
|
|
||
| Furthermore : | ||
| - No copy of the shared folder are kept in the browser storage. | ||
| - 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. | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| /* eslint-disable */ | ||
| module.exports = { | ||
| name: 'remixd', | ||
| preset: '../../jest.config.js', | ||
| globals: { | ||
| 'ts-jest': { | ||
| tsConfig: '<rootDir>/tsconfig.spec.json' | ||
| } | ||
| }, | ||
| transform: { | ||
| '^.+\\.[tj]sx?$': 'ts-jest' | ||
| }, | ||
| moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'html'], | ||
| coverageDirectory: '../../coverage/libs/remixd' | ||
| }; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| { | ||
| "watch": ["./src", "./bin"], | ||
| "ext": "ts", | ||
| "exec": "npm run build && npm run start" | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,69 @@ | ||
| { | ||
| "name": "remixd", | ||
ioedeveloper marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| "version": "0.2.4-alpha.0", | ||
| "description": "remix server: allow accessing file system from remix.ethereum.org and start a dev environment (see help section)", | ||
| "main": "./index.js", | ||
| "types": "./index.d.ts", | ||
| "bin": { | ||
| "remixd": "./bin/remixd.js" | ||
| }, | ||
| "scripts": { | ||
| "test": "echo \"Error: no test specified\"", | ||
| "start": "./bin/remixd.js", | ||
| "npip": "npip", | ||
| "lint": "eslint ./src ./bin --ext .ts", | ||
| "build": "tsc -p ./ && chmod +x ./bin/remixd.js", | ||
| "dev": "nodemon" | ||
| }, | ||
| "repository": { | ||
| "type": "git", | ||
| "url": "git+https://github.com/ethereum/remixd.git" | ||
ioedeveloper marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| }, | ||
| "keywords": [ | ||
| "remix", | ||
| "ide", | ||
| "ethereum", | ||
| "solidity" | ||
| ], | ||
| "author": "cpp ethereum team", | ||
ioedeveloper marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| "license": "MIT", | ||
| "bugs": { | ||
| "url": "https://github.com/ethereum/remixd/issues" | ||
ioedeveloper marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| }, | ||
| "homepage": "https://github.com/ethereum/remixd#readme", | ||
ioedeveloper marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| "dependencies": { | ||
| "@remixproject/plugin": "0.3.0-beta.5", | ||
| "@remixproject/plugin-api": "0.3.0-beta.5", | ||
| "@remixproject/plugin-utils": "0.3.0-beta.5", | ||
| "@remixproject/plugin-ws": "^0.3.0-beta.8", | ||
| "axios": "^0.20.0", | ||
| "chokidar": "^2.1.8", | ||
| "commander": "^2.20.3", | ||
| "fs-extra": "^3.0.1", | ||
| "isbinaryfile": "^3.0.2", | ||
| "ws": "^7.3.0" | ||
| }, | ||
| "python": { | ||
| "execPath": "python3", | ||
| "dependencies": { | ||
| "vyper": ">=0.1.0b3" | ||
| } | ||
| }, | ||
| "devDependencies": { | ||
| "@types/axios": "^0.14.0", | ||
| "@types/fs-extra": "^9.0.1", | ||
| "@types/node": "^14.0.5", | ||
| "@types/ws": "^7.2.4", | ||
| "@typescript-eslint/eslint-plugin": "^3.2.0", | ||
| "@typescript-eslint/parser": "^3.2.0", | ||
| "eslint": "6.8.0", | ||
| "eslint-config-standard": "14.1.1", | ||
| "eslint-plugin-import": "2.20.2", | ||
| "eslint-plugin-node": "11.1.0", | ||
| "eslint-plugin-promise": "4.2.1", | ||
| "eslint-plugin-standard": "4.0.1", | ||
| "nodemon": "^2.0.4", | ||
| "ts-node": "^8.10.1", | ||
| "typescript": "^3.9.3" | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,99 @@ | ||
| #!/usr/bin/env node | ||
| import WebSocket from '../websocket' | ||
| import * as servicesList from '../serviceList' | ||
| import * as WS from 'ws' | ||
| import { getDomain } from '../utils' | ||
| import Axios from 'axios' | ||
| import * as fs from 'fs-extra' | ||
| import * as path from 'path' | ||
| import * as program from 'commander' | ||
|
|
||
| (async () => { | ||
| program | ||
| .usage('-s <shared folder>') | ||
| .description('Provide a two-way connection between the local computer and Remix IDE') | ||
| .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)') | ||
| .on('--help', function(){ | ||
| console.log('\nExample:\n\n remixd -s ./ --remix-ide http://localhost:8080') | ||
| }).parse(process.argv) | ||
| // eslint-disable-next-line | ||
| const killCallBack: Array<Function> = [] | ||
|
|
||
| if (!program.remixIde) { | ||
| console.log('\x1b[33m%s\x1b[0m', '[WARN] You can only connect to remixd from one of the supported origins.') | ||
| } else { | ||
| const isValid = await isValidOrigin(program.remixIde) | ||
| /* Allow unsupported origins and display warning. */ | ||
| if (!isValid) { | ||
| console.log('\x1b[33m%s\x1b[0m', '[WARN] You are using IDE from an unsupported origin.') | ||
| console.log('\x1b[33m%s\x1b[0m', 'Check https://gist.github.com/EthereumRemix/091ccc57986452bbb33f57abfb13d173 for list of all supported origins.\n') | ||
| // return | ||
| } | ||
| console.log('\x1b[33m%s\x1b[0m', '[WARN] You may now only use IDE at ' + program.remixIde + ' to connect to that instance') | ||
| } | ||
|
|
||
| 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] Symbolic links are not forwarded to Remix IDE\n') | ||
| try { | ||
| const sharedFolderClient = new servicesList['sharedfolder']() | ||
| const websocketHandler = new WebSocket(65520, { remixIdeUrl: program.remixIde }, sharedFolderClient) | ||
|
|
||
| websocketHandler.start((ws: WS) => { | ||
| sharedFolderClient.setWebSocket(ws) | ||
| sharedFolderClient.setupNotifications(program.sharedFolder) | ||
| sharedFolderClient.sharedFolder(program.sharedFolder, program.readOnly || false) | ||
| }) | ||
| killCallBack.push(websocketHandler.close.bind(websocketHandler)) | ||
| } catch(error) { | ||
| throw new Error(error) | ||
| } | ||
| } else { | ||
| console.log('\x1b[31m%s\x1b[0m', '[ERR] No valid shared folder provided.') | ||
| } | ||
|
|
||
| // kill | ||
| function kill () { | ||
| for (const k in killCallBack) { | ||
| try { | ||
| killCallBack[k]() | ||
| } catch (e) { | ||
| console.log(e) | ||
| } | ||
| } | ||
| } | ||
|
|
||
| process.on('SIGINT', kill) // catch ctrl-c | ||
| process.on('SIGTERM', kill) // catch kill | ||
| process.on('exit', kill) | ||
|
|
||
| async function isValidOrigin (origin: string): Promise<any> { | ||
| if (!origin) return false | ||
| const domain = getDomain(origin) | ||
| const gistUrl = 'https://gist.githubusercontent.com/EthereumRemix/091ccc57986452bbb33f57abfb13d173/raw/3367e019335746b73288e3710af2922d4c8ef5a3/origins.json' | ||
|
|
||
| try { | ||
| const { data } = await Axios.get(gistUrl) | ||
|
|
||
| try { | ||
| await fs.writeJSON(path.resolve(__dirname + '/../origins.json'), { data }) | ||
| } catch (e) { | ||
| console.error(e) | ||
| } | ||
|
|
||
| return data.includes(origin) ? data.includes(origin) : data.includes(domain) | ||
| } catch (e) { | ||
| try { | ||
| // eslint-disable-next-line | ||
| const origins = require('../origins.json') | ||
| const { data } = origins | ||
|
|
||
| return data.includes(origin) ? data.includes(origin) : data.includes(domain) | ||
| } catch (e) { | ||
| return false | ||
| } | ||
| } | ||
| } | ||
| })() |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| 'use strict' | ||
| import { RemixdClient as sharedFolder } from './services/remixdClient' | ||
| import Websocket from './websocket' | ||
| import * as utils from './utils' | ||
|
|
||
| module.exports = { | ||
| Websocket, | ||
| utils, | ||
| services: { | ||
| sharedFolder | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| { | ||
| "data":[ | ||
| "http://remix-alpha.ethereum.org", | ||
| "http://remix.ethereum.org", | ||
| "https://remix-alpha.ethereum.org", | ||
| "https://remix.ethereum.org", | ||
| "package://a7df6d3c223593f3550b35e90d7b0b1f.mod", | ||
| "package://6fd22d6fe5549ad4c4d8fd3ca0b7816b.mod", | ||
| "https://ipfsgw.komputing.org" | ||
| ] | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| import { RemixdClient as sharedfolder } from './services/remixdClient' | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. May be you can use
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We should keep this. Making a change to this will break remix-desktop. |
||
|
|
||
| export { sharedfolder } | ||
Uh oh!
There was an error while loading. Please reload this page.