Skip to content

Commit fff226b

Browse files
authored
Merge pull request #1137 from graphprotocol/tmigone/pnpm
2 parents d41eec3 + 30356b0 commit fff226b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+27802
-27331
lines changed

.github/actions/setup/action.yml

+6-3
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,17 @@ runs:
66
steps:
77
- name: Install Foundry
88
uses: foundry-rs/foundry-toolchain@v1
9-
- name: Enable corepack for modern yarn
9+
- name: Enable Corepack
1010
shell: bash
1111
run: corepack enable
1212
- name: Install Node.js
1313
uses: actions/setup-node@v4
1414
with:
1515
node-version: 18
16-
cache: 'yarn'
16+
cache: 'pnpm'
17+
- name: Set up pnpm via Corepack
18+
shell: bash
19+
run: corepack prepare [email protected] --activate
1720
- name: Install dependencies
1821
shell: bash
19-
run: yarn --immutable
22+
run: pnpm install --frozen-lockfile

.github/workflows/build.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,4 @@ jobs:
2222
- name: Set up environment
2323
uses: ./.github/actions/setup
2424
- name: Build
25-
run: yarn build || yarn build
25+
run: pnpm build || pnpm build

.github/workflows/ci-contracts.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,11 @@ jobs:
2727
- name: Build
2828
run: |
2929
pushd packages/contracts
30-
yarn build || yarn build
30+
pnpm build || pnpm build
3131
- name: Run tests
3232
run: |
3333
pushd packages/contracts
34-
yarn test:coverage
34+
pnpm test:coverage
3535
- name: Upload coverage report
3636
uses: codecov/codecov-action@v3
3737
with:

.github/workflows/ci-data-edge.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,6 @@ jobs:
2525
- name: Build
2626
run: |
2727
pushd packages/data-edge
28-
yarn build
28+
pnpm build
2929
- name: Run tests
30-
run: yarn test
30+
run: pnpm test

.github/workflows/ci-horizon.yml

+5-5
Original file line numberDiff line numberDiff line change
@@ -27,24 +27,24 @@ jobs:
2727
- name: Build contracts
2828
run: |
2929
pushd packages/contracts
30-
yarn build
30+
pnpm build
3131
popd
3232
- name: Build horizon
3333
run: |
3434
pushd packages/horizon
35-
yarn build
35+
pnpm build
3636
popd
3737
- name: Build subgraph service
3838
run: |
3939
pushd packages/subgraph-service
40-
yarn build
40+
pnpm build
4141
popd
4242
- name: Build hardhat-graph-protocol
4343
run: |
4444
pushd packages/hardhat-graph-protocol
45-
yarn build
45+
pnpm build
4646
popd
4747
- name: Run tests
4848
run: |
4949
pushd packages/horizon
50-
yarn test
50+
pnpm test

.github/workflows/ci-subgraph-service.yml

+5-5
Original file line numberDiff line numberDiff line change
@@ -27,24 +27,24 @@ jobs:
2727
- name: Build contracts
2828
run: |
2929
pushd packages/contracts
30-
yarn build
30+
pnpm build
3131
popd
3232
- name: Build horizon
3333
run: |
3434
pushd packages/horizon
35-
yarn build
35+
pnpm build
3636
popd
3737
- name: Build subgraph service
3838
run: |
3939
pushd packages/subgraph-service
40-
yarn build
40+
pnpm build
4141
popd
4242
- name: Build hardhat-graph-protocol
4343
run: |
4444
pushd packages/hardhat-graph-protocol
45-
yarn build
45+
pnpm build
4646
popd
4747
- name: Run tests
4848
run: |
4949
pushd packages/subgraph-service
50-
yarn test
50+
pnpm test

.github/workflows/ci-token-dist.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ jobs:
2828
- name: Build
2929
run: |
3030
pushd packages/token-distribution
31-
yarn build
31+
pnpm build
3232
- name: Run tests
3333
run: |
3434
pushd packages/token-distribution
35-
yarn test
35+
pnpm test

.github/workflows/publish.yml

+5-5
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ on:
88
required: true
99
type: choice
1010
options:
11-
- contracts
12-
- sdk
11+
- contracts
12+
- sdk
1313
tag:
1414
description: 'Tag to publish'
1515
required: true
@@ -27,10 +27,10 @@ jobs:
2727
submodules: recursive
2828
- name: Set up environment
2929
uses: ./.github/actions/setup
30+
- name: Set npm token for publishing
31+
run: pnpm config set //registry.npmjs.org/:_authToken ${{ secrets.GRAPHPROTOCOL_NPM_TOKEN }}
3032
- name: Publish 🚀
3133
shell: bash
3234
run: |
3335
pushd packages/${{ inputs.package }}
34-
yarn npm publish --tag ${{ inputs.tag }} --access public
35-
env:
36-
YARN_NPM_AUTH_TOKEN: ${{ secrets.GRAPHPROTOCOL_NPM_TOKEN }}
36+
pnpm publish --tag ${{ inputs.tag }} --access public --no-git-checks

.github/workflows/verifydeployed.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ jobs:
3333
- name: Build
3434
run: |
3535
pushd packages/contracts
36-
yarn build || yarn build
36+
pnpm build || pnpm build
3737
3838
- name: Save build artifacts
3939
uses: actions/upload-artifact@v3
@@ -55,14 +55,14 @@ jobs:
5555
- name: Build
5656
run: |
5757
pushd packages/contracts
58-
yarn build || yarn build
58+
pnpm build || pnpm build
5959
- name: Get build artifacts
6060
uses: actions/download-artifact@v3
6161
with:
6262
name: contract-artifacts
6363

6464
- name: Verify contracts on Defender
65-
run: cd packages/contracts && yarn hardhat --network ${{ inputs.network }} verify-defender ${{ inputs.contracts }}
65+
run: cd packages/contracts && pnpm hardhat --network ${{ inputs.network }} verify-defender ${{ inputs.contracts }}
6666
env:
6767
DEFENDER_API_KEY: "${{ secrets.DEFENDER_API_KEY }}"
6868
DEFENDER_API_SECRET: "${{ secrets.DEFENDER_API_SECRET }}"

.yarnrc.yml

-2
This file was deleted.

README.md

+8-12
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929

3030
## Packages
3131

32-
This repository is a Yarn workspaces monorepo containing the following packages:
32+
This repository is a pnpm workspaces monorepo containing the following packages:
3333

3434
| Package | Latest version | Description |
3535
| --- | --- | --- |
@@ -46,26 +46,22 @@ This repository is a Yarn workspaces monorepo containing the following packages:
4646
## Development
4747

4848
### Setup
49-
To set up this project you'll need [git](https://git-scm.com) and [yarn](https://yarnpkg.com/) installed. Note that Yarn v4 is required to install the dependencies and build the project.
49+
To set up this project you'll need [git](https://git-scm.com) and [pnpm](https://pnpm.io/) installed.
5050

5151
From your command line:
5252

5353
```bash
54-
# Enable Yarn v4
55-
corepack enable
56-
yarn set version stable
57-
5854
# Clone this repository
5955
$ git clone https://github.com/graphprotocol/contracts
6056

6157
# Go into the repository
6258
$ cd contracts
6359

6460
# Install dependencies
65-
$ yarn
61+
$ pnpm install
6662

6763
# Build projects
68-
$ yarn build
64+
$ pnpm build
6965
```
7066

7167
### Versioning and publishing packages
@@ -77,7 +73,7 @@ We use [changesets](https://github.com/changesets/changesets) to manage package
7773
A changeset is a file that describes the changes that have been made to the packages in the repository. To create a changeset, run the following command from the root of the repository:
7874

7975
```bash
80-
$ yarn changeset
76+
$ pnpm changeset
8177
```
8278

8379
Changeset files are stored in the `.changeset` directory until they are packaged into a release. You can commit these files and even merge them into your main branch without publishing a release.
@@ -87,7 +83,7 @@ Changeset files are stored in the `.changeset` directory until they are packaged
8783
When you are ready to create a new package release, run the following command to package all changesets, this will also bump package versions and dependencies:
8884

8985
```bash
90-
$ yarn changeset version
86+
$ pnpm changeset version
9187
```
9288

9389
### Step 3: Tagging the release
@@ -97,7 +93,7 @@ __Note__: this step is meant to be run on the main branch.
9793
After creating a package release, you will need to tag the release commit with the version number. To do this, run the following command from the root of the repository:
9894

9995
```bash
100-
$ yarn changeset tag
96+
$ pnpm changeset tag
10197
$ git push --follow-tags
10298
```
10399

@@ -109,7 +105,7 @@ Packages are published and distributed via NPM. To publish a package, run the fo
109105

110106
```bash
111107
# Publish the package
112-
$ yarn npm publish --access public --tag <tag>
108+
$ pnpm npm publish --access public --tag <tag>
113109
```
114110

115111
Alternatively, there is a GitHub action that can be manually triggered to publish a package.

package.json

+4-18
Original file line numberDiff line numberDiff line change
@@ -5,26 +5,12 @@
55
"license": "GPL-2.0-or-later",
66
"repository": "[email protected]:graphprotocol/contracts.git",
77
"author": "The Graph team",
8-
"packageManager": "[email protected]",
9-
"workspaces": [
10-
"packages/contracts",
11-
"packages/data-edge",
12-
"packages/eslint-graph-config",
13-
"packages/hardhat-graph-protocol",
14-
"packages/horizon",
15-
"packages/sdk",
16-
"packages/solhint-graph-config",
17-
"packages/solhint-plugin-graph",
18-
"packages/subgraph-service",
19-
"packages/token-distribution"
20-
],
8+
"packageManager": "[email protected]+sha1.648f6014eb363abb36618f2ba59282a9eeb3e879",
219
"scripts": {
2210
"postinstall": "husky install",
23-
"clean": "yarn workspaces foreach --all --parallel --verbose run clean",
24-
"clean:all": "yarn clean && rm -rf node_modules packages/*/node_modules",
25-
"build": "chmod +x ./scripts/build && ./scripts/build",
26-
"lint": "yarn workspaces foreach --all --parallel --verbose run lint",
27-
"test": "yarn workspaces foreach --all --parallel --verbose --interlaced run test"
11+
"clean": "pnpm -r --parallel --reporter=append-only run clean",
12+
"clean:all": "pnpm clean && rm -rf node_modules packages/*/node_modules",
13+
"build": "chmod +x ./scripts/build && ./scripts/build"
2814
},
2915
"devDependencies": {
3016
"@changesets/cli": "^2.27.1",

packages/contracts/DEPLOYMENT.md

+8-8
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ cli/cli.ts --help
1111
For convenience, the script can also be used as a hardhat command with `hardhat migrate` and it can be also run with:
1212

1313
```
14-
yarn deploy
14+
pnpm deploy
1515
```
1616

1717
The **migrate** command will:
@@ -25,22 +25,22 @@ The **migrate** command will:
2525
The script accepts multiple parameters that allow to override default values, print the available options with:
2626

2727
```
28-
yarn deploy -- --help
28+
pnpm deploy -- --help
2929
```
3030

31-
NOTE: Please run `yarn build` at least once before running migrate as this command relies on artifacts produced in the compilation process.
31+
NOTE: Please run `pnpm build` at least once before running migrate as this command relies on artifacts produced in the compilation process.
3232

3333
### Networks
3434

35-
By default, `yarn deploy` will deploy the contracts to a localhost instance of a development network.
35+
By default, `pnpm deploy` will deploy the contracts to a localhost instance of a development network.
3636

3737
To deploy to a different network execute:
3838

3939
```
40-
yarn deploy -- --network {networkName}
40+
pnpm deploy -- --network {networkName}
4141
4242
# Example
43-
yarn deploy -- --network goerli
43+
pnpm deploy -- --network goerli
4444
```
4545

4646
The network must be configured in the `hardhat.config.ts` as explained in https://hardhat.org/config.
@@ -54,7 +54,7 @@ A configuration file called `graph.<networkName>.yml` located in the `config` fo
5454
You can use a different set of configuration options by specifying the file location in the command line:
5555

5656
```
57-
yarn deploy -- --graph-config another-graph.mainnet.yml
57+
pnpm deploy -- --graph-config another-graph.mainnet.yml
5858
```
5959

6060
Rules:
@@ -100,7 +100,7 @@ Some contracts require the address from previously deployed contracts. For that
100100
### Deploying a new testnet
101101

102102
1. Make sure contracts are up to date as you please.
103-
2. `yarn deploy-goerli` to deploy to Goerli. This will create new contracts with new addresses in `addresses.json`.
103+
2. `pnpm deploy-goerli` to deploy to Goerli. This will create new contracts with new addresses in `addresses.json`.
104104
3. Update the `package.json` and `package-lock.json` files with the new package version and publish a new npm package with `npm publish`. You can dry-run the files to be uploaded by running `npm publish --dry-run`.
105105
4. Merge this update into master, branch off and save for whatever version of the testnet is going on, and then tag this on the github repo, pointing to your branch (ex. at `testnet-phase-1` branch). This way we can always get the contract code for testnet, while continuing to do work on mainnet.
106106
5. Pull the updated package into the subgraph, and other apps that depend on the package.json.

packages/contracts/README.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ The contracts are upgradable, following the [Open Zeppelin Proxy Upgrade Pattern
5656
The [NPM package](https://www.npmjs.com/package/@graphprotocol/contracts) contains contract interfaces and addresses for the testnet and mainnet. It also contains [typechain](https://github.com/ethereum-ts/TypeChain) generated objects to easily interact with the contracts. This allows for anyone to install the package in their repository and interact with the protocol. It is updated and released whenever a change to the contracts occurs.
5757

5858
```
59-
yarn add @graphprotocol/contracts
59+
pnpm add @graphprotocol/contracts
6060
```
6161

6262
# Contract Addresses
@@ -68,8 +68,8 @@ The testnet runs on Goerli, while mainnet is on Ethereum Mainnet. The addresses
6868
To setup the contracts locally, checkout the `dev` branch, then run:
6969

7070
```bash
71-
yarn
72-
yarn build
71+
pnpm
72+
pnpm build
7373
```
7474

7575
# Testing

packages/contracts/TESTING.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ Testing is done with the following stack:
88

99
## Unit testing
1010

11-
To test all the smart contracts, use `yarn test`.
11+
To test all the smart contracts, use `pnpm test`.
1212
To test a single file run: `npx hardhat test test/<FILE_NAME>.ts`
1313

1414
## E2E Testing
@@ -37,7 +37,7 @@ There are several types of e2e tests which can be run separately:
3737
It can be useful to run E2E tests against a fresh protocol deployment on L1, this can be done with the following:
3838

3939
```bash
40-
L1_NETWORK=localhost yarn test:e2e
40+
L1_NETWORK=localhost pnpm test:e2e
4141
```
4242

4343
The command will:
@@ -51,7 +51,7 @@ The command will:
5151
If you want to test the protocol on an L1/L2 setup, you can run:
5252

5353
```bash
54-
L1_NETWORK=localnitrol1 L2_NETWORK=localnitrol2 yarn test:e2e
54+
L1_NETWORK=localnitrol1 L2_NETWORK=localnitrol2 pnpm test:e2e
5555
```
5656

5757
In this case the command will:

0 commit comments

Comments
 (0)