Pārlūkot izejas kodu

refactor: move typechain bindings from "typechain" to "types"

chore: delete "onCompileComplete" and "onIstanbulComplete" hooks in ".solcover.js"
chore: generate TypeChain bindings before running coverage script
Paul Razvan Berg 3 gadi atpakaļ
vecāks
revīzija
afe1da2d87
10 mainītis faili ar 12 papildinājumiem un 19 dzēšanām
  1. 1 1
      .eslintignore
  2. 1 1
      .gitignore
  3. 1 1
      .prettierignore
  4. 1 9
      .solcover.js
  5. 1 1
      hardhat.config.ts
  6. 2 2
      package.json
  7. 2 1
      tasks/deploy/greeter.ts
  8. 1 1
      test/greeter/Greeter.ts
  9. 1 1
      test/types.ts
  10. 1 1
      tsconfig.json

+ 1 - 1
.eslintignore

@@ -9,7 +9,7 @@
 **/coverage
 **/dist
 **/node_modules
-**/typechain
+**/types
 
 # files
 *.env

+ 1 - 1
.gitignore

@@ -14,7 +14,7 @@
 **/.coverage_contracts
 **/dist
 **/node_modules
-**/typechain
+**/types
 
 # files
 *.env

+ 1 - 1
.prettierignore

@@ -9,7 +9,7 @@
 **/coverage
 **/dist
 **/node_modules
-**/typechain
+**/types
 
 # files
 *.env

+ 1 - 9
.solcover.js

@@ -2,16 +2,8 @@ const shell = require("shelljs");
 
 module.exports = {
   istanbulReporter: ["html", "lcov"],
-  onCompileComplete: async function (_config) {
-    await run("typechain");
-  },
-  onIstanbulComplete: async function (_config) {
-    // We need to do this because solcover generates bespoke artifacts.
-    shell.rm("-rf", "./artifacts");
-    shell.rm("-rf", "./typechain");
-  },
   providerOptions: {
     mnemonic: process.env.MNEMONIC,
   },
-  skipFiles: ["mocks", "test"],
+  skipFiles: ["test"],
 };

+ 1 - 1
hardhat.config.ts

@@ -90,7 +90,7 @@ const config: HardhatUserConfig = {
     },
   },
   typechain: {
-    outDir: "typechain",
+    outDir: "types",
     target: "ethers-v5",
   },
 };

+ 2 - 2
package.json

@@ -68,10 +68,10 @@
     "access": "public"
   },
   "scripts": {
-    "clean": "shx rm -rf ./artifacts ./cache ./coverage ./typechain ./coverage.json",
+    "clean": "shx rm -rf ./artifacts ./cache ./coverage ./types ./coverage.json",
     "commit": "git-cz",
     "compile": "cross-env TS_NODE_TRANSPILE_ONLY=true hardhat compile",
-    "coverage": "cross-env CODE_COVERAGE=true hardhat coverage --solcoverjs ./.solcover.js --temp artifacts --testfiles \"./test/**/*.ts\"",
+    "coverage": "yarn typechain && hardhat coverage --solcoverjs ./.solcover.js --temp artifacts --testfiles \"./test/**/*.ts\"",
     "deploy": "hardhat deploy:Greeter",
     "lint": "yarn lint:sol && yarn lint:ts && yarn prettier:check",
     "lint:sol": "solhint --config ./.solhint.json --max-warnings 0 \"contracts/**/*.sol\"",

+ 2 - 1
tasks/deploy/greeter.ts

@@ -1,7 +1,8 @@
 import { task } from "hardhat/config";
 import { TaskArguments } from "hardhat/types";
 
-import { Greeter, Greeter__factory } from "../../typechain";
+import { Greeter } from "../../types/Greeter";
+import { Greeter__factory } from "../../types/Greeter__factory";
 
 task("deploy:Greeter")
   .addParam("greeting", "Say hello, be nice")

+ 1 - 1
test/greeter/Greeter.ts

@@ -2,7 +2,7 @@ import hre from "hardhat";
 import { Artifact } from "hardhat/types";
 import { SignerWithAddress } from "@nomiclabs/hardhat-ethers/dist/src/signer-with-address";
 
-import { Greeter } from "../../typechain/Greeter";
+import { Greeter } from "../../types/Greeter";
 import { Signers } from "../types";
 import { shouldBehaveLikeGreeter } from "./Greeter.behavior";
 

+ 1 - 1
test/types.ts

@@ -1,7 +1,7 @@
 import { SignerWithAddress } from "@nomiclabs/hardhat-ethers/dist/src/signer-with-address";
 import { Fixture } from "ethereum-waffle";
 
-import { Greeter } from "../typechain/Greeter";
+import { Greeter } from "../types/Greeter";
 
 declare module "mocha" {
   export interface Context {

+ 1 - 1
tsconfig.json

@@ -18,5 +18,5 @@
   },
   "exclude": ["node_modules"],
   "files": ["./hardhat.config.ts"],
-  "include": ["tasks/**/*.ts", "test/**/*.ts", "typechain/**/*.d.ts", "typechain/**/*.ts"]
+  "include": ["tasks/**/*", "test/**/*", "types/**/*"]
 }