Skip to content

Commit d0c013c

Browse files
authored
Update package for public npm (make ethers a non-dev dep) (#48)
1 parent 2e90bb8 commit d0c013c

File tree

3 files changed

+41
-27
lines changed

3 files changed

+41
-27
lines changed

package.json

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,14 @@
1515
"tsconfig.json"
1616
],
1717
"scripts": {
18-
"build": "yarn compile && yarn patch-hardhat-typechain && yarn typechain && yarn fix-typechain && yarn transpile-dist",
18+
"build": "yarn compile && yarn build:typechain",
19+
"build:npm": "yarn compile:npm && yarn build:typechain",
20+
"build:typechain": "yarn patch-hardhat-typechain && yarn typechain && yarn fix-typechain && yarn transpile-dist",
1921
"chain": "npx hardhat node --no-deploy",
20-
"clean": "rm -f coverage.json; rm -rf .coverage_cache; rm -rf .coverage_contracts; rm -rf cache; rm -rf coverage; rm -rf typechain; rm -rf artifacts",
22+
"clean": "rm -rf coverage.json .coverage_cache .coverage_contracts cache coverage typechain artifacts dist",
2123
"clean-dev-deployment": "rm -rf deployments/50-development.json",
2224
"compile": "npx hardhat compile",
25+
"compile:npm": "SKIP_ABI_GAS_MODS=true npx hardhat compile",
2326
"coverage": "yarn clean && yarn build && yarn cov:command",
2427
"coverage:fork": "yarn clean && yarn build && FORK=true yarn cov:command",
2528
"cov:command": "COVERAGE=true node --max-old-space-size=4096 ./node_modules/.bin/hardhat coverage",
@@ -31,7 +34,7 @@
3134
"patch-hardhat-typechain": "node scripts/patch-hardhat-typechain.js",
3235
"precommit": "lint-staged",
3336
"prepare": "yarn build",
34-
"prepack": "if [[ \"$(basename \"$PWD\")\" == \"index-coop-contracts\" ]]; then echo \"CANNOT PUBLISH FROM THIS REPO\"; exit 1; fi;",
37+
"prepublishOnly": "yarn clean && yarn build:npm",
3538
"rename-extensions": "for f in typechain/*.d.ts; do mv -- \"$f\" \"${f%.d.ts}.ts\"; done",
3639
"test": "npx hardhat test --network localhost",
3740
"test:fast": "TS_NODE_TRANSPILE_ONLY=1 npx hardhat test --network localhost --no-compile",
@@ -53,9 +56,6 @@
5356
"license": "MIT",
5457
"homepage": "https://github.com/SetProtocol",
5558
"devDependencies": {
56-
"@ethersproject/abstract-signer": "^5.0.9",
57-
"@ethersproject/bignumber": "^5.0.12",
58-
"@ethersproject/providers": "^5.0.17",
5959
"@nomiclabs/hardhat-ethers": "^2.0.1",
6060
"@nomiclabs/hardhat-waffle": "^2.0.1",
6161
"@openzeppelin/contracts": "^3.1.0",
@@ -69,7 +69,6 @@
6969
"coveralls": "^3.0.1",
7070
"dotenv": "^8.2.0",
7171
"ethereum-waffle": "^3.2.1",
72-
"ethers": "^5.0.24",
7372
"globby": "^11.0.2",
7473
"hardhat": "^2.0.6",
7574
"hardhat-deploy": "^0.7.0-beta.39",
@@ -87,14 +86,23 @@
8786
"typescript": "^3.9.3"
8887
},
8988
"dependencies": {
89+
"@ethersproject/abstract-signer": "5.0.9",
90+
"@ethersproject/bignumber": "5.0.12",
91+
"@ethersproject/providers": "5.0.17",
9092
"@uniswap/v2-core": "^1.0.1",
9193
"@uniswap/v2-periphery": "^1.1.0-beta.0",
9294
"ethereumjs-util": "^7.0.5",
95+
"ethers": "5.0.24",
9396
"fs-extra": "^5.0.0",
9497
"module-alias": "^2.2.2",
9598
"replace-in-file": "^6.1.0",
9699
"typechain": "^4.0.1"
97100
},
101+
"peerDependencies": {
102+
"@nomiclabs/hardhat-ethers": "^2.0.1",
103+
"ethereum-waffle": "^3.2.1",
104+
"hardhat": "^2.2.1"
105+
},
98106
"_moduleAliases": {
99107
"@utils": "utils",
100108
"@typechain": "typechain"

tasks/subtasks.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,13 @@ import { addGasToAbiMethods, setupNativeSolc } from "../utils/tasks";
1111
subtask(TASK_COMPILE_SOLIDITY_GET_ARTIFACT_FROM_COMPILATION_OUTPUT)
1212
.setAction(async (_, { network }, runSuper) => {
1313
const artifact = await runSuper();
14-
artifact.abi = addGasToAbiMethods(network.config, artifact.abi);
14+
15+
// These changes should be skipped when publishing to npm.
16+
// They override ethers' gas estimation
17+
if (!process.env.SKIP_ABI_GAS_MODS){
18+
artifact.abi = addGasToAbiMethods(network.config, artifact.abi);
19+
}
20+
1521
return artifact;
1622
}
1723
);

yarn.lock

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@
132132
"@ethersproject/transactions" "^5.0.5"
133133
"@ethersproject/web" "^5.0.6"
134134

135-
"@ethersproject/[email protected]", "@ethersproject/abstract-signer@^5.0.2", "@ethersproject/abstract-signer@^5.0.4", "@ethersproject/abstract-signer@^5.0.6", "@ethersproject/abstract-signer@^5.0.9":
135+
"@ethersproject/[email protected]", "@ethersproject/abstract-signer@^5.0.2", "@ethersproject/abstract-signer@^5.0.4", "@ethersproject/abstract-signer@^5.0.6":
136136
version "5.0.9"
137137
resolved "https://registry.yarnpkg.com/@ethersproject/abstract-signer/-/abstract-signer-5.0.9.tgz#238ddc06031aeb9dfceee2add965292d7dd1acbf"
138138
integrity sha512-CM5UNmXQaA03MyYARFDDRjHWBxujO41tVle7glf5kHcQsDDULgqSVpkliLJMtPzZjOKFeCVZBHybTZDEZg5zzg==
@@ -169,7 +169,7 @@
169169
"@ethersproject/bytes" "^5.0.4"
170170
"@ethersproject/properties" "^5.0.3"
171171

172-
"@ethersproject/[email protected]", "@ethersproject/bignumber@>=5.0.0-beta.130", "@ethersproject/bignumber@^5.0.10", "@ethersproject/bignumber@^5.0.12", "@ethersproject/bignumber@^5.0.5", "@ethersproject/bignumber@^5.0.7", "@ethersproject/bignumber@^5.0.8":
172+
"@ethersproject/[email protected]", "@ethersproject/bignumber@>=5.0.0-beta.130", "@ethersproject/bignumber@^5.0.10", "@ethersproject/bignumber@^5.0.5", "@ethersproject/bignumber@^5.0.7", "@ethersproject/bignumber@^5.0.8":
173173
version "5.0.12"
174174
resolved "https://registry.yarnpkg.com/@ethersproject/bignumber/-/bignumber-5.0.12.tgz#fe4a78667d7cb01790f75131147e82d6ea7e7cba"
175175
integrity sha512-mbFZjwthx6vFlHG9owXP/C5QkNvsA+xHpDCkPPPdG2n1dS9AmZAL5DI0InNLid60rQWL3MXpEl19tFmtL7Q9jw==
@@ -293,7 +293,7 @@
293293
dependencies:
294294
"@ethersproject/logger" "^5.0.5"
295295

296-
"@ethersproject/[email protected]", "@ethersproject/providers@^5.0.17", "@ethersproject/providers@^5.0.5":
296+
"@ethersproject/[email protected]", "@ethersproject/providers@^5.0.5":
297297
version "5.0.17"
298298
resolved "https://registry.yarnpkg.com/@ethersproject/providers/-/providers-5.0.17.tgz#f380e7831149e24e7a1c6c9b5fb1d6dfc729d024"
299299
integrity sha512-bJnvs5X7ttU5x2ekGJYG7R3Z+spZawLFfR0IDsbaMDLiCwZOyrgk+VTBU7amSFLT0WUhWFv8WwSUB+AryCQG1Q==
@@ -3541,22 +3541,7 @@ [email protected]:
35413541
utf8 "^3.0.0"
35423542
uuid "^3.3.2"
35433543

3544-
ethers@^4.0.32:
3545-
version "4.0.48"
3546-
resolved "https://registry.yarnpkg.com/ethers/-/ethers-4.0.48.tgz#330c65b8133e112b0613156e57e92d9009d8fbbe"
3547-
integrity sha512-sZD5K8H28dOrcidzx9f8KYh8083n5BexIO3+SbE4jK83L85FxtpXZBCQdXb8gkg+7sBqomcLhhkU7UHL+F7I2g==
3548-
dependencies:
3549-
aes-js "3.0.0"
3550-
bn.js "^4.4.0"
3551-
elliptic "6.5.3"
3552-
hash.js "1.1.3"
3553-
js-sha3 "0.5.7"
3554-
scrypt-js "2.0.4"
3555-
setimmediate "1.0.4"
3556-
uuid "2.0.1"
3557-
xmlhttprequest "1.8.0"
3558-
3559-
ethers@^5.0.0, ethers@^5.0.1, ethers@^5.0.24:
3544+
[email protected], ethers@^5.0.0, ethers@^5.0.1:
35603545
version "5.0.24"
35613546
resolved "https://registry.yarnpkg.com/ethers/-/ethers-5.0.24.tgz#fbb8e4d35070d134f2eb846c07500b8c0eaef6d3"
35623547
integrity sha512-77CEtVC88fJGEhxGXRvQqAEH6e2A+ZFiv2FBT6ikXndlty5sw6vMatAhg1v+w3CaaGZOf1CP81jl4Mc8Zrj08A==
@@ -3592,6 +3577,21 @@ ethers@^5.0.0, ethers@^5.0.1, ethers@^5.0.24:
35923577
"@ethersproject/web" "5.0.11"
35933578
"@ethersproject/wordlists" "5.0.7"
35943579

3580+
ethers@^4.0.32:
3581+
version "4.0.48"
3582+
resolved "https://registry.yarnpkg.com/ethers/-/ethers-4.0.48.tgz#330c65b8133e112b0613156e57e92d9009d8fbbe"
3583+
integrity sha512-sZD5K8H28dOrcidzx9f8KYh8083n5BexIO3+SbE4jK83L85FxtpXZBCQdXb8gkg+7sBqomcLhhkU7UHL+F7I2g==
3584+
dependencies:
3585+
aes-js "3.0.0"
3586+
bn.js "^4.4.0"
3587+
elliptic "6.5.3"
3588+
hash.js "1.1.3"
3589+
js-sha3 "0.5.7"
3590+
scrypt-js "2.0.4"
3591+
setimmediate "1.0.4"
3592+
uuid "2.0.1"
3593+
xmlhttprequest "1.8.0"
3594+
35953595
35963596
version "0.1.6"
35973597
resolved "https://registry.yarnpkg.com/ethjs-unit/-/ethjs-unit-0.1.6.tgz#c665921e476e87bce2a9d588a6fe0405b2c41699"

0 commit comments

Comments
 (0)