Skip to content

Commit

Permalink
♻️ Upgrade to pnpm and Hardhat Configuration Variables (#208)
Browse files Browse the repository at this point in the history
Signed-off-by: Pascal Marco Caversaccio <[email protected]>
  • Loading branch information
pcaversaccio authored Nov 6, 2023
1 parent 06c9bf7 commit abc6b2f
Show file tree
Hide file tree
Showing 18 changed files with 4,799 additions and 5,983 deletions.
3 changes: 3 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
module.exports = {
root: true,
parser: "@typescript-eslint/parser",
parserOptions: {
ecmaVersion: 12,
},
plugins: ["@typescript-eslint"],
extends: [
"eslint:recommended",
Expand Down
6 changes: 5 additions & 1 deletion .github/ISSUE_TEMPLATE/bug_report.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,14 @@ body:
Please check the [issues tab](https://github.com/pcaversaccio/xdeployer/issues) to avoid duplicates.
Thanks for taking the time to fill out this bug report!
type: markdown

- attributes:
label: "Describe the issue:"
id: what-happened
type: textarea
validations:
required: true

- attributes:
label: "Code example to reproduce the issue:"
description: "It can be a GitHub repository/gist or a simple code snippet."
Expand All @@ -25,15 +27,17 @@ body:
type: textarea
validations:
required: true

- attributes:
label: "Version:"
description: |
What version of xdeployer are you running?
Run `npm list --depth=0` and check the xdeployer version.
Run `pnpm list --depth=0` and check the xdeployer version.
id: version
type: textarea
validations:
required: true

- attributes:
label: "Relevant log output:"
description: |
Expand Down
6 changes: 4 additions & 2 deletions .github/ISSUE_TEMPLATE/feature_request.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: Feature Request
description: Suggest an idea for xdeployer.
name: "Feature Request"
description: "Suggest an idea for xdeployer."
title: "[Feature-Request]: "
labels:
- feature 💥
Expand All @@ -11,13 +11,15 @@ body:
Please check the [issues tab](https://github.com/pcaversaccio/xdeployer/issues) to avoid duplicates.
Thanks for taking the time to provide feedback on xdeployer!
type: markdown

- attributes:
label: "Describe the desired feature:"
description: Explain what the feature solves/improves.
id: feature-request
type: textarea
validations:
required: true

- attributes:
label: "Code example that solves the feature:"
description: "It can be a GitHub repository/gist or a simple code snippet."
Expand Down
8 changes: 7 additions & 1 deletion .github/pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Please:
- DELETE the items that DON'T make sense for your PR.
-->

#### PR Checklist
#### PR Checklist

- [ ] Because this PR includes a **bug fix**, relevant tests have been included.
- [ ] Because this PR includes a **new feature**, the change was previously discussed in an [issue](https://github.com/pcaversaccio/xdeployer/issues) or in the [discussions](https://github.com/pcaversaccio/xdeployer/discussions) section.
Expand All @@ -18,3 +18,9 @@ Please:
---

<!-- Add a description of your PR here -->

---

#### 🐶 Cute Animal Picture

![Put a link to a cute animal picture inside the parenthesis-->]()
27 changes: 19 additions & 8 deletions .github/workflows/checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,24 +20,35 @@ jobs:
- name: Checkout
uses: actions/checkout@v4

- name: Cache node modules
- name: Install pnpm
uses: pnpm/action-setup@v2
with:
version: latest
run_install: false

- name: Get pnpm cache directory path
id: pnpm-cache-dir-path
run: echo "dir=$(pnpm store path --silent)" >> $GITHUB_OUTPUT

- name: Restore pnpm cache
uses: actions/cache@v3
id: pnpm-cache
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
path: ${{ steps.pnpm-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-node-
${{ runner.os }}-pnpm-store-
- name: Use Node.js ${{ matrix.node_version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node_version }}

- name: Install npm project with a clean slate
run: npm ci --prefer-offline
- name: Install pnpm project with a clean slate
run: pnpm install --prefer-offline --frozen-lockfile

- name: Prettier and lint
run: npm run lint:check
run: pnpm lint:check

codespell:
runs-on: ${{ matrix.os }}
Expand All @@ -54,7 +65,7 @@ jobs:
uses: codespell-project/[email protected]
with:
check_filenames: true
skip: ./.git,package-lock.json
skip: ./.git,pnpm-lock.yaml

validate-links:
runs-on: ${{ matrix.os }}
Expand Down
25 changes: 18 additions & 7 deletions .github/workflows/publish-npm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,24 +19,35 @@ jobs:
- name: Checkout
uses: actions/checkout@v4

- name: Cache node modules
- name: Install pnpm
uses: pnpm/action-setup@v2
with:
version: latest
run_install: false

- name: Get pnpm cache directory path
id: pnpm-cache-dir-path
run: echo "dir=$(pnpm store path --silent)" >> $GITHUB_OUTPUT

- name: Restore pnpm cache
uses: actions/cache@v3
id: pnpm-cache
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
path: ${{ steps.pnpm-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-node-
${{ runner.os }}-pnpm-store-
- name: Setup .npmrc file to publish to npm
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node_version }}
registry-url: "https://registry.npmjs.org"

- name: Install npm project with a clean slate
run: npm ci --prefer-offline
- name: Install pnpm project with a clean slate
run: pnpm install --prefer-offline --frozen-lockfile

- name: Publish to npm
run: npm publish
run: pnpm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
31 changes: 21 additions & 10 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,25 +20,36 @@ jobs:
- name: Checkout
uses: actions/checkout@v4

- name: Cache node modules
- name: Install pnpm
uses: pnpm/action-setup@v2
with:
version: latest
run_install: false

- name: Get pnpm cache directory path
id: pnpm-cache-dir-path
run: echo "dir=$(pnpm store path --silent)" >> $GITHUB_OUTPUT

- name: Restore pnpm cache
uses: actions/cache@v3
id: pnpm-cache
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
path: ${{ steps.pnpm-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-node-
${{ runner.os }}-pnpm-store-
- name: Use Node.js ${{ matrix.node_version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node_version }}

- name: Install npm project with a clean slate
run: npm ci --prefer-offline
- name: Install pnpm project with a clean slate
run: pnpm install --prefer-offline --frozen-lockfile

- name: Run tests
run: npm run test
run: pnpm test
env:
XDEPLOYER_TEST_ACCOUNT: ${{ secrets.XDEPLOYER_TEST_ACCOUNT }}
ETH_GOERLI_TESTNET_URL: ${{ secrets.ETH_GOERLI_TESTNET_URL }}
ETH_SEPOLIA_TESTNET_URL: ${{ secrets.ETH_SEPOLIA_TESTNET_URL }}
HARDHAT_VAR_XDEPLOYER_TEST_ACCOUNT: ${{ secrets.XDEPLOYER_TEST_ACCOUNT }}
HARDHAT_VAR_ETH_GOERLI_TESTNET_URL: ${{ secrets.ETH_GOERLI_TESTNET_URL }}
HARDHAT_VAR_ETH_SEPOLIA_TESTNET_URL: ${{ secrets.ETH_SEPOLIA_TESTNET_URL }}
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ node_modules
# Build directory
dist

# Hardhat configuration file
vars.json

# dotenv environment variable files
.env
.env.development.local
Expand All @@ -26,9 +29,12 @@ dist
.env.local

# Log files
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
.pnpm-debug.log*

# Yarn integrity file
.yarn-integrity
Expand Down
21 changes: 14 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -158,16 +158,23 @@ _Example:_

```ts
xdeploy: {
contract: "ERC20Mock",
constructorArgsPath: "./deploy-args.ts",
salt: "WAGMI",
signer: process.env.PRIVATE_KEY,
networks: ["hardhat", "goerli", "sepolia"],
rpcUrls: ["hardhat", process.env.ETH_GOERLI_TESTNET_URL, process.env.ETH_SEPOLIA_TESTNET_URL],
gasLimit: 1.2 * 10 ** 6,
contract: "ERC20Mock",
constructorArgsPath: "./deploy-args.ts",
salt: "WAGMI",
signer: vars.get("PRIVATE_KEY", ""),
networks: ["hardhat", "goerli", "sepolia"],
rpcUrls: [
"hardhat",
vars.get("ETH_GOERLI_TESTNET_URL", "https://rpc.ankr.com/eth_goerli"),
vars.get("ETH_SEPOLIA_TESTNET_URL", "https://rpc.sepolia.org"),
],
gasLimit: 1.2 * 10 ** 6,
},
```

> **Note**<br>
> We recommend using [Hardhat configuration variables](https://hardhat.org/hardhat-runner/docs/guides/configuration-variables) introduced in Hardhat version [2.19.0](https://github.com/NomicFoundation/hardhat/releases/tag/hardhat%402.19.0) to set the private key of your signer.
The current available networks are:

- **Local:**
Expand Down
Loading

0 comments on commit abc6b2f

Please sign in to comment.