Skip to content

Commit

Permalink
chore: migrate to pnpm
Browse files Browse the repository at this point in the history
  • Loading branch information
guidanoli committed Mar 27, 2024
1 parent 4e7ed00 commit a4767f2
Show file tree
Hide file tree
Showing 15 changed files with 6,161 additions and 9,421 deletions.
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/update-dependencies.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,5 @@ Are there any clear downsides? (requires refactoring, bugs were introduced, etc)

- [ ] Update major versions in `packages.json`.
- [ ] If an update requires major work, create the corresponding issue.
- [ ] Update the dependencies in `yarn.lock`.
- [ ] Update the dependencies in `pnpm-lock.yaml`.
- [ ] Verify whether everything is working as expected.
9 changes: 2 additions & 7 deletions .github/workflows/check-code-format.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,7 @@ jobs:
steps:
- uses: actions/checkout@v4

- uses: actions/setup-node@v4
with:
node-version: 18

- name: Install dependencies
run: yarn install
- uses: ./.github/workflows/setup

- name: Check code format
run: yarn fmt:check
run: pnpm fmt:check
9 changes: 1 addition & 8 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,7 @@ jobs:
with:
submodules: recursive

- uses: actions/setup-node@v4
with:
node-version: 18

- uses: foundry-rs/foundry-toolchain@v1

- name: Install dependencies
run: yarn install
- uses: ./.github/workflows/setup

- name: Generate documentation
run: forge doc -b
Expand Down
18 changes: 3 additions & 15 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,20 +27,15 @@ jobs:
git config user.name rollups-contracts-bot
git config user.email [email protected]
- uses: actions/setup-node@v4
with:
node-version: 18

- name: Install Node dependencies
run: yarn install
- uses: ./.github/workflows/setup

- name: Create release PR or publish packages to npmjs.com
uses: changesets/action@f13b1baaa620fde937751f5d2c3572b9da32af23
id: changeset
with:
setupGitUser: false
commit: "chore: version packages"
publish: yarn changeset publish
publish: pnpm changeset publish
env:
GITHUB_TOKEN: ${{ secrets.BOT_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
Expand All @@ -59,18 +54,11 @@ jobs:
with:
submodules: recursive

- uses: actions/setup-node@v4
with:
node-version: 18

- uses: foundry-rs/foundry-toolchain@v1
- uses: ./.github/workflows/setup

- name: Install Python dependencies
run: pip install yq

- name: Install Node dependencies
run: yarn install

- name: Generate Rust bindings
run: |
forge bind \
Expand Down
22 changes: 22 additions & 0 deletions .github/workflows/setup/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Install dependencies

on:
workflow_call:

runs:
using: 'composite'
steps:
- uses: pnpm/action-setup@v3
with:
version: 8

- uses: actions/setup-node@v4
with:
node-version: 18
cache: 'pnpm'

- name: Install Node packages
shell: bash
run: pnpm i

- uses: foundry-rs/foundry-toolchain@v1
13 changes: 3 additions & 10 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,20 +20,13 @@ jobs:
with:
submodules: recursive

- uses: actions/setup-node@v4
with:
node-version: 18

- uses: foundry-rs/foundry-toolchain@v1

- name: Install dependencies
run: yarn install
- uses: ./.github/workflows/setup

- name: Generate proofs
run: yarn proofs:setup
run: pnpm proofs:setup

- name: Run tests
run: yarn test
run: pnpm test

- name: Upload signatures
run: forge selectors upload --all
9 changes: 0 additions & 9 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,3 @@
/node_modules
/out
/src/types

# Follows https://yarnpkg.com/getting-started/qa#which-files-should-be-gitignored and not using Zero-Installs feature
.pnp.*
.yarn/*
!.yarn/patches
!.yarn/plugins
!.yarn/releases
!.yarn/sdks
!.yarn/versions
893 changes: 0 additions & 893 deletions .yarn/releases/yarn-4.0.1.cjs

This file was deleted.

7 changes: 0 additions & 7 deletions .yarnrc.yml

This file was deleted.

16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ If you are interested in taking a look at the off-chain part, please, head over

## 🧩 Dependencies

- [Yarn](https://yarnpkg.com/getting-started/install)
- [pnpm](https://pnpm.io/installation)
- [Forge](https://book.getfoundry.sh/getting-started/installation)
- [Docker](https://docs.docker.com/get-docker/)

Expand All @@ -19,25 +19,25 @@ In order to properly initialize them, please, run the following command.
git submodule update --init --recursive
```

This repository uses [Yarn](https://yarnpkg.com/getting-started/install) to manage JavaScript dependencies.
This repository uses [pnpm](https://pnpm.io/installation) to manage JavaScript dependencies.
In order to install them, please, run the following command.

```sh
yarn install
pnpm i
```

## 🚀 Local deployment

If you want to run a [Hardhat](https://hardhat.org/) node and deploy the contracts, please run the following command.

```sh
yarn start
pnpm start
```

If, instead, you wish to deploy the contracts to an already running node (e.g. [Anvil](https://book.getfoundry.sh/anvil/)), you can do so by running the following command.

```sh
yarn deploy:development
pnpm deploy:development
```

If the node is not listening to `http://localhost:8545/`, please set the `RPC_URL` environment variable accordingly.
Expand All @@ -49,19 +49,19 @@ Assuming that [Docker Engine](https://docs.docker.com/get-docker/) is running on
This command will build the Cartesi Machine image necessary to build the proofs.

```sh
yarn proofs:setup
pnpm proofs:setup
```

Now, you may run the tests!

```sh
yarn test
pnpm test
```

From this point on, after any change in the source code, you can update the proofs before running the tests again with the following command.

```sh
yarn proofs:update
pnpm proofs:update
```

## 📚 Documentation
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
"proofs:update": "./test/foundry/dapp/helper/update-proofs.sh",
"proofs:setup": "./test/foundry/dapp/helper/update-proofs.sh --setup",
"proofs:clean": "rimraf ./test/foundry/dapp/helper/input/*.json ./test/foundry/dapp/helper/output/*.json",
"preinstall": "npx only-allow pnpm",
"prepack": "run-s build tsc:prod copy-dts",
"start": "hardhat node",
"test": "forge test -vvv",
Expand Down Expand Up @@ -79,6 +80,5 @@
],
"main": "./dist/src/types/index.js",
"types": "./dist/src/types/index.d.ts",
"license": "Apache-2.0",
"packageManager": "[email protected]"
"license": "Apache-2.0"
}
Loading

0 comments on commit a4767f2

Please sign in to comment.