Skip to content

Commit d94e51a

Browse files
authored
Update VSC core and additional extensions (#84)
1 parent 1e3696b commit d94e51a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

57 files changed

+15025
-3227
lines changed

.github/workflows/ci.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,13 @@ jobs:
1010
test:
1111
runs-on: ubuntu-latest
1212
steps:
13-
- uses: actions/checkout@v1
13+
- uses: actions/checkout@v4
1414
- uses: pnpm/action-setup@v2
1515
with:
16-
version: 7.1.0
17-
- uses: actions/setup-node@v2
16+
version: 8.6.0
17+
- uses: actions/setup-node@v3
1818
with:
19-
node-version: 14
19+
node-version: 18
2020
cache: "pnpm"
2121

2222
- run: pnpm install

.github/workflows/deploy.yml

Lines changed: 82 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -10,51 +10,104 @@ jobs:
1010
build-and-deploy:
1111
runs-on: ubuntu-latest
1212
steps:
13-
- uses: actions/checkout@v1
13+
- uses: actions/checkout@v4
1414
- uses: pnpm/action-setup@v2
1515
with:
16-
version: 7.1.0
17-
- uses: actions/setup-node@v2
16+
version: 8.6.0
17+
- uses: actions/setup-node@v3
1818
with:
19-
node-version: 14
19+
node-version: 18
2020
cache: "pnpm"
21+
- name: Setup Build Environment
22+
run: |
23+
sudo apt-get update
24+
sudo apt-get install -y libxkbfile-dev pkg-config libsecret-1-dev libkrb5-dev libxss1 dbus libgtk-3-0 libgbm1
25+
- run: yarn global add node-gyp
26+
- run: pnpm add -g [email protected]
2127

2228
- run: pnpm install
23-
- run: pnpm build
29+
30+
- name: Build
31+
run: |
32+
if [[ "${{ github.ref }}" == "refs/heads/main" ]]; then
33+
export DETH_IFRAME_URL="https://code.deth.net"
34+
else
35+
export DETH_IFRAME_URL="https://dethcode.vercel.app"
36+
fi
37+
38+
yarn build
2439
2540
- run: pnpm prepare-deploy
2641

27-
# deployment per branch
28-
- uses: superactions/deploy-branch-action@action
29-
if: ${{ github.ref != 'refs/heads/main' }}
42+
# --- preview deployments
43+
- name: Deploy host to Vercel - STAGING
44+
uses: nick-fields/retry@v2
45+
with:
46+
command: |
47+
cd packages/vscode-host/dist
48+
vercel pull --yes --environment=preview --token=${{ secrets.VERCEL_TOKEN }}
49+
vercel build --token=${{ secrets.VERCEL_TOKEN }} # creates vercel output directory
50+
51+
cp -R ./node_modules ./.vercel/output/static/ # force add node_modules to output directory
52+
53+
vercel deploy --prebuilt --token=${{ secrets.VERCEL_TOKEN }}
54+
max_attempts: 3
55+
timeout_minutes: 10
56+
env:
57+
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
58+
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_HOST_PREVIEW_HOST_PROJECT_ID }}
59+
60+
- name: Deploy entrypoint to Vercel - STAGING
61+
uses: nick-fields/retry@v2
3062
with:
31-
directory: packages/vscode-host/dist
63+
command: |
64+
cd packages/entrypoint/dist
65+
vercel pull --yes --environment=preview --token=${{ secrets.VERCEL_TOKEN }}
66+
vercel build --token=${{ secrets.VERCEL_TOKEN }} # creates vercel output directory
67+
68+
cp -R ./node_modules ./.vercel/output/static/ # force add node_modules to output directory
69+
70+
vercel deploy --prebuilt --token=${{ secrets.VERCEL_TOKEN }}
71+
max_attempts: 3
72+
timeout_minutes: 10
73+
env:
74+
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
75+
VERCEL_PROJECT_ID:
76+
${{ secrets.VERCEL_ENTRYPOINT_PREVIEW_HOST_PROJECT_ID }}
3277

3378
# --- production deployments (only on main)
34-
# deploy app
35-
- uses: ngduc/vercel-deploy-action@master
79+
- name: Deploy host to Vercel - PRODUCTION
3680
if: ${{ github.ref == 'refs/heads/main' }}
81+
uses: nick-fields/retry@v2
3782
with:
38-
vercel-cli: vercel
39-
vercel-project-id: ${{ secrets.VERCEL_APP_PROJECT_ID}}
40-
vercel-org-id: ${{ secrets.VERCEL_ORG_ID}}
41-
vercel-token: ${{ secrets.VERCEL_TOKEN }}
42-
scope: ${{ secrets.VERCEL_ORG_ID }}
43-
working-directory: packages/vscode-host/dist
44-
vercel-args: "--prod"
83+
command: |
84+
cd packages/vscode-host/dist
85+
vercel pull --yes --environment=preview --token=${{ secrets.VERCEL_TOKEN }}
86+
vercel build --token=${{ secrets.VERCEL_TOKEN }} # creates vercel output directory
87+
88+
cp -R ./node_modules ./.vercel/output/static/ # force add node_modules to output directory
89+
90+
vercel deploy --prebuilt --production --token=${{ secrets.VERCEL_TOKEN }}
91+
max_attempts: 3
92+
timeout_minutes: 10
4593
env:
46-
ACTIONS_ALLOW_UNSECURE_COMMANDS: true
94+
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
95+
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_APP_PROJECT_ID }}
4796

48-
# deploy entrypoint (no preview)
49-
- uses: ngduc/vercel-deploy-action@master
97+
- name: Deploy entrypoint to Vercel - PRODUCTION
5098
if: ${{ github.ref == 'refs/heads/main' }}
99+
uses: nick-fields/retry@v2
51100
with:
52-
vercel-cli: vercel
53-
vercel-project-id: ${{ secrets.VERCEL_ENTRYPOINT_PROJECT_ID}}
54-
vercel-org-id: ${{ secrets.VERCEL_ORG_ID}}
55-
vercel-token: ${{ secrets.VERCEL_TOKEN }}
56-
scope: ${{ secrets.VERCEL_ORG_ID }}
57-
working-directory: packages/entrypoint/dist
58-
vercel-args: "--prod"
101+
command: |
102+
cd packages/entrypoint/dist
103+
vercel pull --yes --environment=preview --token=${{ secrets.VERCEL_TOKEN }}
104+
vercel build --token=${{ secrets.VERCEL_TOKEN }} # creates vercel output directory
105+
106+
cp -R ./node_modules ./.vercel/output/static/ # force add node_modules to output directory
107+
108+
vercel deploy --prebuilt --production --token=${{ secrets.VERCEL_TOKEN }}
109+
max_attempts: 3
110+
timeout_minutes: 10
59111
env:
60-
ACTIONS_ALLOW_UNSECURE_COMMANDS: true
112+
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
113+
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_ENTRYPOINT_PROJECT_ID }}

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,4 @@ node_modules
88
out
99

1010
.vercel
11+
packages/vscode-host/vscode-web

.mocharc.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,5 @@ module.exports = {
77
"packages/vscode-host/src/**/*.test.ts",
88
"packages/bookmarklet/*.test.ts",
99
],
10+
exclude: ["packages/vscode-host/src/src/vs/editor/test/node/classification/typescript.test.ts"]
1011
};

.npmrc

Lines changed: 0 additions & 2 deletions
This file was deleted.

.nvmrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
18

.prettierignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
packages/vscode-host/src

CONTRIBUTING.md

Lines changed: 48 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -4,50 +4,57 @@ We welcome all kinds of contributions :)
44

55
### Repository structure and package managers
66

7-
The repository contains two packages, `ethereum-viewer` extension and the VSCode
8-
compilation meant for hosting it online.
7+
The repository contains few packages:
98

10-
All packages (currently one) except of `@dethcrypto/ethereum-viewer-vscode-host`
11-
located in `packages/vscode-host` are managed by `pnpm`. As VSCode depends on
12-
Yarn, our `vscode-host` also needs Yarn.
9+
- `ethereum-viewer` - VSCode extension, this is where most of the business logic
10+
resides,
11+
- `vscode-host` - tweaked VSCode instance. Default settings were changed and
12+
some features hidden. Note: since some time, vscode officially supports web
13+
builds which greatly simplified this package,
14+
- `entrypoint` - Simple website that cointains an iframe to vscode host. It's
15+
done so multiple instances of DethCode for different chains, can share the
16+
same settings (because they all use a single instance under the hood).
1317

14-
### Step by step instructions
18+
All packages except of `@dethcrypto/vscode-host` located in
19+
`packages/vscode-host` are managed by `pnpm`. As VSCode depends on Yarn, our
20+
`vscode-host` also needs Yarn.
1521

16-
```sh
17-
# You need to create dummy certs using mkcert - https://github.com/FiloSottile/mkcert
18-
cd ./certs
19-
mkcert localhost
20-
mkcert -install
21-
cd ..
22+
## Development
2223

23-
# install deps
24+
```
2425
pnpm install
2526
26-
pnpm build # this builds whole vscode and can take A LOT of time. If you are having issues, read below
27-
pnpm serve
28-
```
27+
cd packages/ethereum-viewer # build for the first time
28+
pnpm build
29+
30+
cd packages/vscode-host
31+
node scripts/prepareVSCode.js # clones vscode into ./vscode dir
32+
node scripts/compileVSCode.js
33+
node scripts/prepareAdditionalExtensions.js # extensions like solidity and vyper support
34+
node scripts/copyExtensions.js
2935
30-
### Scripts
36+
cd ./vscode
37+
node ./scripts/code-web-deth.js # loads extensions from ./packages/vscode-host/dist/extensions
38+
yarn watch # in a new tab
39+
yarn watch-web # in a new tab
40+
```
3141

32-
- **`pnpm install`** - Installs dependencies for the workspace,
33-
`ethereum-viewer` extension, and triggers `yarn install` for `vscode-host`
34-
through the `postinstall` script.
42+
Changes to vscode will be automatically applied. To make them permanent copy
43+
them to `./packages/vscode-host/src/`.
3544

36-
- **`pnpm build`** - Builds all packages.
45+
After introducing changes to `packages/ethereum-viewer` run
46+
`pnpm run build:dev`.
3747

38-
If you are having issues with MacOS and Python try the following:
39-
```
40-
$ brew install sqlite
41-
$ npm config set sqlite /opt/homebrew/opt/sqlite
42-
$ npm config set python python3
43-
```
48+
Btw. this will be improved soon ;)
4449

45-
- **`pnpm watch`** - Starts webpack for `ethereum-extension` in watch mode.
50+
## Production build
4651

47-
- **`pnpm serve`** - Starts HTTP server with `vscode-host`.
52+
Note: full, production build of VSCode host is painfully slow and takes ~0.5h
53+
even on M1 Mac.
4854

49-
- **`pnpm dev`** - Copies `ethereum-extension` and serves `vscode-host`. Run
50-
alongside `pnpm watch`.
55+
```
56+
pnpm build
57+
```
5158

5259
### Resources
5360

@@ -59,3 +66,13 @@ terms.
5966
- https://code.visualstudio.com/api/extension-guides/web-extensions
6067
- https://code.visualstudio.com/api/references/vscode-api#FileSystemProvider
6168
- https://github.com/microsoft/vscode-extension-samples/blob/main/fsprovider-sample/README.md
69+
70+
### Troubleshooting
71+
72+
If you are having issues with MacOS and Python try the following:
73+
74+
```
75+
$ brew install sqlite
76+
$ npm config set sqlite /opt/homebrew/opt/sqlite
77+
$ npm config set python python3
78+
```

README.md

Lines changed: 21 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,9 @@
55
<h2 align="center">DethCode</h2>
66
<p align="center">
77
<a href="https://github.com/dethcrypto/ethereum-code-viewer/actions"><img alt="Build Status" src="https://github.com/dethcrypto/ethereum-code-viewer/actions/workflows/ci.yml/badge.svg"></a>
8-
<a href="https://discord.gg/wQDkeDgzgv"><img alt="Join our Discord!" src="https://img.shields.io/discord/895381864922091630.svg?color=7289da&label=deth&logo=discord&style=flat-square"></a>
98
</p>
109
<p align="center"><strong>View source of deployed Ethereum smart contracts in VS Code</strong></p>
1110
<p align="center">While on Etherscan, change <code>.io</code> to <code>.deth.net</code> and browse contracts comfortably in ephemeral VS Code instance</p>
12-
<p align="center">
13-
<em>💸 Enjoy using DethCode? Consider funding development via <a href="https://gitcoin.co/grants/4038/deth-typechain">GitCoin</a> 💸</em>
14-
</p>
1511
</p>
1612

1713
## Usage
@@ -38,7 +34,7 @@ javascript: location.href = location.href.replace(/\.\w+(\/)/, ".deth.net/")
3834
supported chains][supported_explorers])
3935

4036
[supported_explorers]:
41-
https://github.com/dethcrypto/ethereum-code-viewer/blob/main/docs/supported-explorers.md
37+
https://github.com/dethcrypto/dethcode/blob/main/packages/ethereum-viewer/src/explorer/networks.ts#L38
4238

4339
## Motivation
4440

@@ -52,8 +48,25 @@ DethCode was born out of frustration, and it's here to fix all of these issues.
5248
In addition, it improves the experience by automatically following the
5349
implementation of proxies and so on.
5450

51+
### Is it still relevant since Etherscan implements something similar?
52+
53+
Etherscan decided that they like the idea of browsing smart contracts in
54+
ephemeral VSCode instances so much that they decided to make it part of the
55+
their offering. We don't hold a grudge against them, however this is precisely
56+
why DethCode needs to live on!
57+
58+
DethCode is a fully open-source, public good that is available for anyone and is
59+
developed by a community. Other blockchain explorers can use it/self-host it
60+
instead of developing the same thing again. Furthermore, we are preparing to
61+
launch, new advanced features that will make DethCode the best way to browse
62+
ethereum's smart contracts.
63+
5564
## Examples
5665

66+
- Optimism L1CrossDomainMessenger:
67+
[dethcode](https://etherscan.deth.net/address/0x25ace71c97b33cc4729cf772ae268934f7ab5fa1)
68+
|
69+
[etherscan](https://etherscan.io/address/0x25ace71c97b33cc4729cf772ae268934f7ab5fa1#code)
5770
- Arbitrum ERC20 Gateway on mainnet:
5871
[dethcode](https://etherscan.deth.net/address/0xa3a7b6f88361f48403514059f1f16c8e78d60eec)
5972
|
@@ -62,19 +75,15 @@ implementation of proxies and so on.
6275
[dethcode](https://arbiscan.deth.net/address/0x09e9222e96e7b4ae2a407b98d48e330053351eee)
6376
|
6477
[arbiscan](https://arbiscan.io/address/0x09e9222e96e7b4ae2a407b98d48e330053351eee#code)
65-
- Optimism L1CrossDomainMessenger:
66-
[dethcode](https://etherscan.deth.net/address/0x25ace71c97b33cc4729cf772ae268934f7ab5fa1)
67-
|
68-
[etherscan](https://etherscan.io/address/0x25ace71c97b33cc4729cf772ae268934f7ab5fa1#code)
6978
- Dai Stablecoin:
7079
[dethcode](https://etherscan.deth.net/address/0x6b175474e89094c44da98b954eedeac495271d0f)
7180
|
7281
[etherscan](https://etherscan.io/address/0x6b175474e89094c44da98b954eedeac495271d0f#code)
7382

74-
## Contributing
83+
## Contributing and development
7584

76-
Check out our [contributing guidelines](./CONTRIBUTING.md)
85+
Check out our [contributing guide](./CONTRIBUTING.md).
7786

7887
## Social
7988

80-
Follow us on [Twitter](https://twitter.com/dethcrypto)!
89+
Follow me on [Twitter](https://twitter.com/krzkaczor).

docs/supported-explorers.md

Lines changed: 0 additions & 23 deletions
This file was deleted.

0 commit comments

Comments
 (0)