From 4e304aa2a0f283fcae81855bc8d7587bf0b0bcf0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20B=C3=A9ranger?= Date: Mon, 29 Jan 2024 17:34:59 +0100 Subject: [PATCH] Fix the autoInstallPeers error (#30) * fix script * fix pnpm * clean up * clean up * fix Linux-pnpm-store --- .github/workflows/node.js.yml | 71 ++++++++++++++++------------------- deploy/deploy-basic.ts | 5 +-- package.json | 3 +- pnpm-lock.yaml | 12 +++++- test/Basic.ts | 8 ++-- 5 files changed, 50 insertions(+), 49 deletions(-) diff --git a/.github/workflows/node.js.yml b/.github/workflows/node.js.yml index a299c16..4377018 100644 --- a/.github/workflows/node.js.yml +++ b/.github/workflows/node.js.yml @@ -1,6 +1,3 @@ -# This workflow will do a clean installation of node dependencies, cache/restore them, build the source code and run tests across different versions of node -# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-nodejs - name: Node.js CI on: @@ -8,46 +5,44 @@ on: branches: [ "main" ] pull_request: branches: [ "main" ] - jobs: build: - runs-on: ubuntu-latest - strategy: matrix: node-version: [18.x] - # See supported Node.js release schedule at https://nodejs.org/en/about/releases/ steps: - - name: Checkout source code - uses: actions/checkout@v3 - - - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v3 - with: - node-version: ${{ matrix.node-version }} - - - name: Install pnpm - uses: pnpm/action-setup@v2 - with: - version: 7 - run_install: false - - - name: Get pnpm store directory - shell: bash - run: | - echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV - - - name: Setup pnpm cache - uses: actions/cache@v3 - with: - path: ${{ env.STORE_PATH }} - key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} - restore-keys: | - ${{ runner.os }}-pnpm-store- - - - name: Install dependencies and run tests - run: | - pnpm install - pnpm test + - name: Checkout source code + uses: actions/checkout@v3 + + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v3 + with: + node-version: ${{ matrix.node-version }} + + - name: Install pnpm + uses: pnpm/action-setup@v2 + with: + version: 7 + run_install: false + + - name: Get pnpm store directory + run: | + echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV + + - name: Setup pnpm cache + uses: actions/cache@v3 + with: + path: ${{ env.STORE_PATH }} + key: Linux-pnpm-store-${{ runner.os }}-${{ hashFiles('**/pnpm-lock.yaml') }} + restore-keys: | + Linux-pnpm-store- + + - name: Update pnpm lockfile + run: pnpm install --no-frozen-lockfile + + - name: Install dependencies and run tests + run: | + pnpm install + pnpm test diff --git a/deploy/deploy-basic.ts b/deploy/deploy-basic.ts index 51b0e89..c66c2d4 100644 --- a/deploy/deploy-basic.ts +++ b/deploy/deploy-basic.ts @@ -1,5 +1,5 @@ import "@nomiclabs/hardhat-ethers" -const color = require("cli-color") +import color from "cli-color" var msg = color.xterm(39).bgXterm(128) import hre, { ethers, network } from "hardhat" @@ -17,9 +17,6 @@ export default async ({ getNamedAccounts, deployments }: any) => { log: true }) - console.log("basic.receipt.contractAddress:", basic.receipt.contractAddress) - console.log("hre.network.name:", hre.network.name) - switch (hre.network.name) { case "arthera": console.log( diff --git a/package.json b/package.json index 7a6f0fb..938942c 100644 --- a/package.json +++ b/package.json @@ -8,7 +8,7 @@ "compile": "hardhat compile", "deploy:arthera": "hardhat deploy --network arthera", "deploy:sepolia": "hardhat deploy --network sepolia", - "deploy:arthera-testnet": "hardhat deploy --network arthera-testnet", + "deploy:arthera-testnet": "hardhat deploy --network arthera-testnet && hardhat sourcify --network arthera-testnet", "deploy:op-sepolia": "hardhat deploy --network op-sepolia", "sourcify:arthera": "hardhat sourcify --network arthera", "sourcify:arthera-testnet": "hardhat sourcify --network arthera-testnet", @@ -35,6 +35,7 @@ "@typechain/ethers-v6": "^0.4.3", "@typechain/hardhat": "^8.0.3", "@types/chai": "^4.3.5", + "@types/cli-color": "^2.0.6", "@types/mocha": "^10.0.1", "chai": "^4.3.8", "hardhat": "^2.17.2", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 6aa734c..01600f9 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -1,7 +1,7 @@ lockfileVersion: "6.0" settings: - autoInstallPeers: false + autoInstallPeers: true excludeLinksFromLockfile: false dependencies: @@ -52,6 +52,9 @@ devDependencies: "@types/chai": specifier: ^4.3.5 version: 4.3.5 + "@types/cli-color": + specifier: ^2.0.6 + version: 2.0.6 "@types/mocha": specifier: ^10.0.1 version: 10.0.1 @@ -1304,6 +1307,13 @@ packages: } dev: true + /@types/cli-color@2.0.6: + resolution: + { + integrity: sha512-uLK0/0dOYdkX8hNsezpYh1gc8eerbhf9bOKZ3e24sP67703mw9S14/yW6mSTatiaKO9v+mU/a1EVy4rOXXeZTA== + } + dev: true + /@types/concat-stream@1.6.1: resolution: { diff --git a/test/Basic.ts b/test/Basic.ts index 9bb197f..6c36f0a 100644 --- a/test/Basic.ts +++ b/test/Basic.ts @@ -1,8 +1,6 @@ -const { - loadFixture -} = require("@nomicfoundation/hardhat-toolbox/network-helpers") -const { expect } = require("chai") -const { ethers } = require("hardhat") +import { loadFixture } from "@nomicfoundation/hardhat-toolbox/network-helpers" +import { expect } from "chai" +import { ethers } from "hardhat" describe("Basic ERC-20", function () { async function deployContracts() {