Skip to content

Commit b53dd7f

Browse files
authored
Improve pnpm setup (#694)
1 parent fd135d9 commit b53dd7f

File tree

12 files changed

+463
-84
lines changed

12 files changed

+463
-84
lines changed

.github/workflows/ci.yml

+13-10
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,13 @@ jobs:
1717
- uses: actions/checkout@v1
1818
- uses: pnpm/action-setup@v2
1919
with:
20-
version: 6
20+
version: 7.1.0
2121
- uses: actions/setup-node@v2
2222
with:
2323
node-version: ${{ matrix.node }}
2424
cache: 'pnpm'
2525

26-
- run: pnpm install --frozen-lockfile
26+
- run: pnpm install
2727

2828
- run: pnpm build
2929
- run: pnpm lint
@@ -35,20 +35,23 @@ jobs:
3535
fail-fast: false
3636
matrix:
3737
node: ['14.x']
38-
os: [ubuntu-latest, windows-latest]
38+
os: [
39+
ubuntu-latest
40+
# , windows-latest # disabled windows builds due to stability issues
41+
]
3942
runs-on: ${{ matrix.os }}
4043

4144
steps:
4245
- uses: actions/checkout@v1
4346
- uses: pnpm/action-setup@v2
4447
with:
45-
version: 6
48+
version: 7.1.0
4649
- uses: actions/setup-node@v2
4750
with:
4851
node-version: ${{ matrix.node }}
4952
cache: 'pnpm'
5053

51-
- run: pnpm install --frozen-lockfile
54+
- run: pnpm install
5255

5356
- run: pnpm build
5457
- run: pnpm test
@@ -60,8 +63,6 @@ jobs:
6063

6164
test-examples:
6265
strategy:
63-
# When set to true, GitHub cancels all in-progress jobs if any matrix job fails.
64-
fail-fast: false
6566
matrix:
6667
node: ['14.x']
6768
os: [ubuntu-latest, windows-latest]
@@ -71,13 +72,15 @@ jobs:
7172
- uses: actions/checkout@v1
7273
- uses: pnpm/action-setup@v2
7374
with:
74-
version: 6
75+
version: 7.1.0
7576
- uses: actions/setup-node@v2
7677
with:
7778
node-version: ${{ matrix.node }}
7879
cache: 'pnpm'
79-
- run: pnpm --filter ./packages install --frozen-lockfile
80-
- run: pnpm --filter ./examples install --frozen-lockfile
80+
- run: pnpm install
81+
# Second install is needed to link bin files that were created only after build (post install hook to first pnpm install)
82+
- run: pnpm install
83+
8184
- run: pnpm check-examples
8285
- run: pnpm no-git-changes # ensure that committed types are up to date
8386
if: runner.os == 'Linux'

.github/workflows/release.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,13 @@ jobs:
1717

1818
- uses: pnpm/action-setup@v2
1919
with:
20-
version: 6
20+
version: 7.1.0
2121
- uses: actions/setup-node@v2
2222
with:
2323
node-version: '14.x'
2424
cache: 'pnpm'
2525

26-
- run: pnpm install --frozen-lockfile
26+
- run: pnpm install
2727

2828
- name: Create Release Pull Request or Publish to npm
2929
uses: changesets/action@master

CONTRIBUTING.md

+3
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ We welcome all contributions!
44

55
## Developing
66

7+
Heads up: we use pnpm instead of yarn or npm. It might be new for you but I promise it's worth the hassle - it's really
8+
good at making big monorepos deterministic. Please ensure that you are running pnpm version 7.
9+
710
First, run `pnpm i` to install all deps.
811

912
We use TypeScript monorepo, each target is a separate package and has another package with tests. You need to run

examples/hardhat-truffe-v5/package.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,8 @@
3636
"web3-core-promievent": "^1.2.1",
3737
"web3-eth-abi": "^1.2.1",
3838
"web3-utils": "^1.2.1",
39-
"bn.js": "^4.11.0"
39+
"bn.js": "^4.11.0",
40+
"@types/bn.js": "^4.11.6"
4041
},
4142
"dependencies": {}
4243
}

package.json

+16-10
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,21 @@
33
"private": true,
44
"license": "MIT",
55
"engines": {
6-
"pnpm": ">=6.14.0"
6+
"node": ">=14.0.0",
7+
"pnpm": ">=7.0.0"
78
},
89
"scripts": {
910
"postinstall": "pnpm build",
1011
"format": "prettier --check \"./**/*.ts\" README.md",
1112
"format:fix": "prettier --write \"./**/*.ts\" README.md",
12-
"lint": "pnpm run --parallel --aggregate-output --reporter append-only --filter ./packages lint",
13-
"lint:fix": "pnpm --parallel --aggregate-output --reporter append-only --filter ./packages lint:fix",
14-
"typecheck": "pnpm --parallel --aggregate-output --reporter append-only --filter ./packages typecheck",
15-
"build": "tsc --build --verbose ./tsconfig.prod.json && pnpm run --parallel --filter ./packages post-build",
13+
"lint": "pnpm run --parallel --aggregate-output --reporter append-only --filter './packages/**' lint",
14+
"lint:fix": "pnpm --parallel --aggregate-output --reporter append-only --filter './packages/**' lint:fix",
15+
"typecheck": "pnpm --parallel --aggregate-output --reporter append-only --filter './packages/**' typecheck",
16+
"build": "tsc --build --verbose ./tsconfig.prod.json && pnpm run --parallel --filter './packages/**' post-build",
1617
"watch": "tsc --build --verbose --watch ./tsconfig.prod.json",
17-
"clean": "pnpm --filter ./packages clean",
18-
"compile-contracts": "ts-node --transpile-only ./scripts/compile-contracts && pnpm run --parallel --filter ./packages compile-contracts",
19-
"test": "pnpm compile-contracts && pnpm run --parallel --aggregate-output --reporter append-only --filter ./packages test",
18+
"clean": "pnpm --filter './packages/**' clean",
19+
"compile-contracts": "ts-node --transpile-only ./scripts/compile-contracts && pnpm run --parallel --filter './packages/**' compile-contracts",
20+
"test": "pnpm compile-contracts && pnpm run --parallel --aggregate-output --reporter append-only --filter './packages/**' test",
2021
"test:fix": "pnpm lint:fix && pnpm test && pnpm format:fix && pnpm typecheck",
2122
"no-git-changes": "./scripts/no-git-changes.sh",
2223
"check-examples": "ts-node --transpile-only ./scripts/check-examples.ts",
@@ -30,16 +31,21 @@
3031
"@typescript-eslint/parser": "4.15.1",
3132
"earljs": "0.2.2",
3233
"eslint": "^7.29.0",
33-
"eslint-config-typestrict": "^1.0.2",
34+
"eslint-config-typestrict": "^1.0.3",
3435
"eslint-plugin-import": "^2.23.4",
3536
"eslint-plugin-no-only-tests": "^2.6.0",
3637
"eslint-plugin-simple-import-sort": "^7.0.0",
37-
"eslint-plugin-sonarjs": "^0.8.0-125",
38+
"eslint-plugin-sonarjs": "^0.13.0",
3839
"eslint-plugin-unused-imports": "^1.1.1",
3940
"mocha": "^8.2.0",
4041
"prettier": "^2.3.1",
4142
"ts-node": "^10.7.0",
4243
"@types/node": "^14",
4344
"typescript": "^4.6"
45+
},
46+
"pnpm": {
47+
"peerDependencyRules": {
48+
"ignoreMissing": ["typescript", "@types/node"]
49+
}
4450
}
4551
}

packages/target-truffle-v5-test/package.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
"web3-core": "^1",
3737
"web3-eth-contract": "^1",
3838
"web3-utils": "^1",
39-
"web3": "^1"
39+
"web3": "^1",
40+
"@types/bn.js": "^4.11.6"
4041
}
4142
}

packages/target-web3-v1-test/package.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
"typechain": "workspace:^8.0.0",
2121
"web3": "^1.6.0",
2222
"web3-eth-contract": "^1.6.0",
23-
"web3-core": "^1"
23+
"web3-core": "^1",
24+
"@types/bn.js": "^4.11.6"
2425
}
2526
}

packages/target-web3-v1/package.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,8 @@
4242
"@types/lodash": "^4.14.139",
4343
"web3": "^1",
4444
"web3-core": "^1",
45-
"web3-eth-contract": "^1"
45+
"web3-eth-contract": "^1",
46+
"@types/bn.js": "^4.11.6"
4647
},
4748
"dependencies": {
4849
"lodash": "^4.17.15",

packages/test-e2e/package.json

+1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
},
1515
"dependencies": {
1616
"fs-extra": "^9.1.0",
17+
"@types/fs-extra": "^9.0.7",
1718
"typechain": "workspace:^8.0.0",
1819
"@typechain/ethers-v5": "workspace:^10.0.0"
1920
},

packages/test-utils/package.json

+7-3
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,14 @@
1717
"test:fix": "pnpm lint:fix && pnpm format:fix && pnpm test && pnpm typecheck"
1818
},
1919
"dependencies": {
20-
"ts-essentials": "^7.0.1",
21-
"bignumber.js":"9.0.1",
20+
"@types/glob": "7",
21+
"@types/lodash": "^4.14.139",
22+
"@types/retry-as-promised": "^2.3.3",
23+
"bignumber.js": "9.0.1",
2224
"conditional-type-checks": "^1.0.5",
25+
"glob": "7.1.7",
26+
"lodash": "^4.17.15",
2327
"retry-as-promised": "^5.0.0",
24-
"@types/retry-as-promised": "^2.3.3"
28+
"ts-essentials": "^7.0.1"
2529
}
2630
}

0 commit comments

Comments
 (0)