Skip to content

Commit 6aa7630

Browse files
authored
Build improvements (#69)
1 parent b3df3c6 commit 6aa7630

File tree

11 files changed

+247
-179
lines changed

11 files changed

+247
-179
lines changed

.github/workflows/ci.yml

Lines changed: 9 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -1,69 +1,25 @@
1+
name: "CI"
2+
13
on:
24
pull_request:
3-
types: [opened, synchronize]
45
push:
56
branches:
67
- main
78

8-
name: "Deploy"
9-
109
jobs:
11-
build-and-deploy:
10+
test:
1211
runs-on: ubuntu-latest
1312
steps:
14-
- uses: actions/checkout@v2
15-
- uses: pnpm/action-setup@646cdf48217256a3d0b80361c5a50727664284f2
13+
- uses: actions/checkout@v1
14+
- uses: pnpm/action-setup@v2
1615
with:
17-
version: 6.23.6
16+
version: 7.1.0
1817
- uses: actions/setup-node@v2
1918
with:
20-
node-version: "14"
21-
cache: pnpm
19+
node-version: 14
20+
cache: "pnpm"
2221

2322
- run: pnpm install
24-
- run: pnpm build
23+
2524
- run: pnpm test
2625
- run: pnpm lint
27-
28-
- run: pnpm prepare-deploy
29-
30-
# deploy app
31-
- uses: ngduc/vercel-deploy-action@master
32-
if: ${{ github.ref == 'refs/heads/main' }}
33-
with:
34-
vercel-cli: vercel
35-
vercel-project-id: ${{ secrets.VERCEL_APP_PROJECT_ID}}
36-
vercel-org-id: ${{ secrets.VERCEL_ORG_ID}}
37-
vercel-token: ${{ secrets.VERCEL_TOKEN }}
38-
scope: ${{ secrets.VERCEL_ORG_ID }}
39-
working-directory: packages/vscode-host/dist
40-
vercel-args: "--prod"
41-
env:
42-
ACTIONS_ALLOW_UNSECURE_COMMANDS: true
43-
- uses: ngduc/vercel-deploy-action@master
44-
if: ${{ github.ref != 'refs/heads/main' }}
45-
with:
46-
vercel-cli: vercel
47-
vercel-project-id: ${{ secrets.VERCEL_APP_PROJECT_ID}}
48-
vercel-org-id: ${{ secrets.VERCEL_ORG_ID}}
49-
vercel-token: ${{ secrets.VERCEL_TOKEN }}
50-
github-token: ${{ secrets.GITHUB_TOKEN }}
51-
scope: ${{ secrets.VERCEL_ORG_ID }}
52-
working-directory: packages/vscode-host/dist
53-
vercel-args: "--target staging"
54-
env:
55-
ACTIONS_ALLOW_UNSECURE_COMMANDS: true
56-
57-
# deploy entrypoint (no preview)
58-
- uses: ngduc/vercel-deploy-action@master
59-
if: ${{ github.ref == 'refs/heads/main' }}
60-
with:
61-
vercel-cli: vercel
62-
vercel-project-id: ${{ secrets.VERCEL_ENTRYPOINT_PROJECT_ID}}
63-
vercel-org-id: ${{ secrets.VERCEL_ORG_ID}}
64-
vercel-token: ${{ secrets.VERCEL_TOKEN }}
65-
scope: ${{ secrets.VERCEL_ORG_ID }}
66-
working-directory: packages/entrypoint/dist
67-
vercel-args: "--prod"
68-
env:
69-
ACTIONS_ALLOW_UNSECURE_COMMANDS: true

.github/workflows/deploy.yml

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
name: "Deploy"
2+
3+
on:
4+
pull_request:
5+
push:
6+
branches:
7+
- main
8+
9+
jobs:
10+
build-and-deploy:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v1
14+
- uses: pnpm/action-setup@v2
15+
with:
16+
version: 7.1.0
17+
- uses: actions/setup-node@v2
18+
with:
19+
node-version: 14
20+
cache: "pnpm"
21+
22+
- run: pnpm install
23+
- run: pnpm build
24+
25+
- run: pnpm prepare-deploy
26+
27+
# deploy app
28+
- uses: ngduc/vercel-deploy-action@master
29+
if: ${{ github.ref == 'refs/heads/main' }}
30+
with:
31+
vercel-cli: vercel
32+
vercel-project-id: ${{ secrets.VERCEL_APP_PROJECT_ID}}
33+
vercel-org-id: ${{ secrets.VERCEL_ORG_ID}}
34+
vercel-token: ${{ secrets.VERCEL_TOKEN }}
35+
scope: ${{ secrets.VERCEL_ORG_ID }}
36+
working-directory: packages/vscode-host/dist
37+
vercel-args: "--prod"
38+
env:
39+
ACTIONS_ALLOW_UNSECURE_COMMANDS: true
40+
- uses: ngduc/vercel-deploy-action@master
41+
if: ${{ github.ref != 'refs/heads/main' }}
42+
with:
43+
vercel-cli: vercel
44+
vercel-project-id: ${{ secrets.VERCEL_APP_PROJECT_ID}}
45+
vercel-org-id: ${{ secrets.VERCEL_ORG_ID}}
46+
vercel-token: ${{ secrets.VERCEL_TOKEN }}
47+
github-token: ${{ secrets.GITHUB_TOKEN }}
48+
scope: ${{ secrets.VERCEL_ORG_ID }}
49+
working-directory: packages/vscode-host/dist
50+
vercel-args: "--target staging"
51+
env:
52+
ACTIONS_ALLOW_UNSECURE_COMMANDS: true
53+
54+
# deploy entrypoint (no preview)
55+
- uses: ngduc/vercel-deploy-action@master
56+
if: ${{ github.ref == 'refs/heads/main' }}
57+
with:
58+
vercel-cli: vercel
59+
vercel-project-id: ${{ secrets.VERCEL_ENTRYPOINT_PROJECT_ID}}
60+
vercel-org-id: ${{ secrets.VERCEL_ORG_ID}}
61+
vercel-token: ${{ secrets.VERCEL_TOKEN }}
62+
scope: ${{ secrets.VERCEL_ORG_ID }}
63+
working-directory: packages/entrypoint/dist
64+
vercel-args: "--prod"
65+
env:
66+
ACTIONS_ALLOW_UNSECURE_COMMANDS: true

CONTRIBUTING.md

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
## Contributing
2+
3+
We welcome all kinds of contributions :)
4+
5+
### Repository structure and package managers
6+
7+
The repository contains two packages, `ethereum-viewer` extension and the VSCode
8+
compilation meant for hosting it online.
9+
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.
13+
14+
### Step by step instructions
15+
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+
23+
# install deps
24+
pnpm install
25+
26+
pnpm build # this builds whole vscode and can take A LOT of time
27+
pnpm serve
28+
```
29+
30+
### Scripts
31+
32+
- **`pnpm install`** - Installs dependencies for the workspace,
33+
`ethereum-viewer` extension, and triggers `yarn install` for `vscode-host`
34+
through the `postinstall` script.
35+
36+
- **`pnpm build`** - Builds all packages.
37+
38+
- **`pnpm watch`** - Starts webpack for `ethereum-extension` in watch mode.
39+
40+
- **`pnpm serve`** - Starts HTTP server with `vscode-host`.
41+
42+
- **`pnpm dev`** - Copies `ethereum-extension` and serves `vscode-host`. Run
43+
alongside `pnpm watch`.
44+
45+
### Resources
46+
47+
DethCode's is a VSCode Web Extension using FileSystemProvider API to show
48+
sources of deployed Ethereum smart contracts. The following links might be
49+
provide some insight, if you're not familiar with some of the aforementioned
50+
terms.
51+
52+
- https://code.visualstudio.com/api/extension-guides/web-extensions
53+
- https://code.visualstudio.com/api/references/vscode-api#FileSystemProvider
54+
- https://github.com/microsoft/vscode-extension-samples/blob/main/fsprovider-sample/README.md

README.md

Lines changed: 3 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -73,58 +73,8 @@ implementation of proxies and so on.
7373

7474
## Contributing
7575

76-
### Repository structure and package managers
76+
Check out our [contributing guidelines](./CONTRIBUTING.md)
7777

78-
The repository contains two packages, `ethereum-viewer` extension and the VSCode
79-
compilation meant for hosting it online.
78+
## Social
8079

81-
All packages (currently one) except of `@dethcrypto/ethereum-viewer-vscode-host`
82-
located in `packages/vscode-host` are managed by `pnpm`. As VSCode depends on
83-
Yarn, our `vscode-host` also needs Yarn.
84-
85-
### Step by step instructions
86-
87-
```sh
88-
# You need to create dummy certs using mkcert - https://github.com/FiloSottile/mkcert
89-
cd ./certs
90-
mkcert localhost
91-
mkcert -install
92-
cd ..
93-
94-
# install deps
95-
pnpm install
96-
97-
# install vscode deps
98-
cd packages/vscode-host/
99-
yarn
100-
cd ../../
101-
102-
pnpm build # this builds whole vscode and can take A LOT of time
103-
pnpm serve
104-
```
105-
106-
### Scripts
107-
108-
- **`pnpm install`** - Installs dependencies for the workspace,
109-
`ethereum-viewer` extension, and triggers `yarn install` for `vscode-host`
110-
through the `postinstall` script.
111-
112-
- **`pnpm build`** - Builds all packages.
113-
114-
- **`pnpm watch`** - Starts webpack for `ethereum-extension` in watch mode.
115-
116-
- **`pnpm serve`** - Starts HTTP server with `vscode-host`.
117-
118-
- **`pnpm dev`** - Copies `ethereum-extension` and serves `vscode-host`. Run
119-
alongside `pnpm watch`.
120-
121-
### Resources
122-
123-
DethCode's is a VSCode Web Extension using FileSystemProvider API to show
124-
sources of deployed Ethereum smart contracts. The following links might be
125-
provide some insight, if you're not familiar with some of the aforementioned
126-
terms.
127-
128-
- https://code.visualstudio.com/api/extension-guides/web-extensions
129-
- https://code.visualstudio.com/api/references/vscode-api#FileSystemProvider
130-
- https://github.com/microsoft/vscode-extension-samples/blob/main/fsprovider-sample/README.md
80+
Follow us on [Twitter](https://twitter.com/dethcrypto)!

package.json

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22
"license": "MIT",
33
"scripts": {
44
"postinstall": "cd packages/vscode-host && yarn",
5-
"watch": "pnpm watch --filter ./packages",
6-
"build": "pnpm build --filter ./packages && cd packages/vscode-host && yarn build",
5+
"watch": "pnpm --filter './packages/**' watch",
6+
"build": "pnpm --filter './packages/**' build && cd packages/vscode-host && yarn build",
77
"serve": "run-p serve:**",
88
"serve:host": "cd packages/vscode-host && yarn serve",
9-
"serve:entrypoint": "pnpm serve --filter ./packages/entrypoint",
9+
"serve:entrypoint": "pnpm --filter './packages/entrypoint' serve",
1010
"copy-and-serve": "cd packages/vscode-host && yarn copy-and-serve",
1111
"lint": "eslint --ext .ts ./packages/*/src/**/*.ts",
1212
"lint:fix": "pnpm lint -- --fix",
@@ -43,5 +43,9 @@
4343
"typescript": "^4.5.3",
4444
"webpack": "^5.52.1",
4545
"webpack-cli": "^4.8.0"
46+
},
47+
"engines": {
48+
"node": ">=14.0.0",
49+
"pnpm": ">=7.0.0"
4650
}
4751
}

packages/vscode-host/.github/workflows/npm-publish.yml

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

packages/vscode-host/scripts/copyExtensions.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ const {
1515
const { additionalExtensions } = require("./prepareAdditionalExtensions");
1616

1717
function copyExtensions() {
18-
log.info("Copying extensions to ./dist directory...");
18+
log.info("============ Copying extensions to ./dist directory...");
1919

2020
chdir(__dirname, "../vscode");
2121

packages/vscode-host/scripts/copyPublic.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
const { chdir, existsSync, rimraf, copySync, log } = require("./util");
44

55
function copyPublic() {
6-
log.info("Copying assets from ./public to ./dist");
6+
log.info("============ Copying assets from ./public to ./dist");
77

88
chdir(__dirname, "..");
99

packages/vscode-host/scripts/prepareAdditionalExtensions.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ const additionalExtensions = [
2323
];
2424

2525
function prepareAdditionalExtensions() {
26-
log.info("Cloning additional built-in extensions...");
26+
log.info("============ Cloning additional built-in extensions...");
2727

2828
chdir(__dirname, "../additional-extensions");
2929

packages/vscode-host/scripts/prepareVSCode.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ const { argv } = require("./argv");
66
const vscodeVersion = "1.58.0";
77

88
function prepareVSCode() {
9-
log.info("Cloning VSCode...");
9+
log.info("============ Cloning VSCode...");
1010

1111
chdir(__dirname, "..");
1212

@@ -23,7 +23,7 @@ function prepareVSCode() {
2323

2424
chdir("vscode");
2525

26-
log.info("Installing VSCode dependencies...");
26+
log.info("============ Installing VSCode dependencies...");
2727

2828
changeFileSync("./build/npm/preinstall.js", (s) =>
2929
// This line in vscode/build/npm/preinstall.js checks what's the top-level
@@ -35,6 +35,11 @@ function prepareVSCode() {
3535
)
3636
);
3737

38+
// update playwright version to make it work under M1 macs
39+
changeFileSync("./package.json", (s) =>
40+
s.replace('"playwright": "1.11.1",', '"playwright": "1.22.1",')
41+
);
42+
3843
execSync(["yarn", argv.verbose && "--verbose"], { stdio: "inherit" });
3944
}
4045

0 commit comments

Comments
 (0)