diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 85b90bca8c..e27b7da2fa 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -12,17 +12,17 @@ We use a [GitHub project](https://github.com/orgs/NomicFoundation/projects/4/vie ## Project structure -This repository is a monorepo handled with [Yarn v1](https://classic.yarnpkg.com/lang/en/) and [Yarn workspaces](https://classic.yarnpkg.com/en/docs/workspaces/). +This repository is a monorepo handled with [pnpm](https://pnpm.io/) and [pnpm workspaces](https://pnpm.io/workspaces). There's a folder for each subproject in `packages/`. All of them are plugins, except for `/packages/hardhat-core` which is the main project (i.e. the one that's published as [hardhat](https://npmjs.com/package/hardhat) in npm). ## Installing -To install the project's dependencies, run `yarn` in the root directory of the repository. +To install the project's dependencies, run `pnpm i` in the root directory of the repository. ## Building the projects -Plugins require hardhat to be built or tested. Our recommendation is to run `yarn watch` from the root folder. This will keep everything compiled, and these problems will be avoided. +Plugins require hardhat to be built or tested. Our recommendation is to run `pnpm watch` from the root folder. This will keep everything compiled, and these problems will be avoided. ## Testing @@ -30,11 +30,11 @@ All tests are written using [mocha](https://mochajs.org) and [chai](https://www. ### Per-package -You can run a package's tests by executing `yarn test` inside its folder. +You can run a package's tests by executing `pnpm test` inside its folder. ### Entire project -You can run all the tests at once by running `yarn test` from the root folder. +You can run all the tests at once by running `pnpm test` from the root folder. ## Code formatting @@ -42,7 +42,7 @@ We use [Prettier](https://prettier.io/) to format all the code without any speci We also have [eslint](https://eslint.org/) installed in all the projects. It checks that you have run Prettier and forbids some dangerous patterns. -The linter is always run in the CI, so make sure it passes before pushing code. You can use `yarn lint` and `yarn lint:fix` inside the packages' folders. +The linter is always run in the CI, so make sure it passes before pushing code. You can use `pnpm lint` and `pnpm lint:fix` inside the packages' folders. ## Branching @@ -95,23 +95,17 @@ This is a list of the modules that always get loaded during startup: ## Developing locally -All these tips assume you are running `yarn watch` from the root directory. +All these tips assume you are running `pnpm watch` from the root directory. ### Linking -You can [link](https://classic.yarnpkg.com/en/docs/cli/link/) any package to test it locally. While the rest of the commands we run use `yarn`, we recommend you use `npm` for linking, since `yarn link` won't create the `hardhat` executable. For example, if you are working on `hardhat`, you can follow these steps: +You can [link](https://docs.npmjs.com/cli/v9/commands/npm-link/) any package to test it locally. While the rest of the commands we run use `pnpm`, we recommend you use `npm` for linking. For example, if you are working on `hardhat`, you can follow these steps: 1. Go to `packages/hardhat-core` and run `npm link` 2. Go to some hardhat project and run `npm link hardhat` Now any change you make in the code will be reflected in that project. -If you prefer to use `yarn link`, you need to work around the lack of an executable in `node_modules/.bin/hardhat`. We recommend having an alias like this: - -```bash -alias lhh='node --preserve-symlinks $(node -e "console.log(require.resolve(\"hardhat/internal/cli/cli.js\"))")' -``` - ### Yalc If for any reason linking doesn't work for you, you can use [`yalc`](https://github.com/whitecolor/yalc): @@ -121,12 +115,12 @@ If for any reason linking doesn't work for you, you can use [`yalc`](https://git Unlike linking, if you make a change in the code, you'll need to repeat the process. -### yarn pack +### pnpm pack -An even more realistic way of using your local changes in a project is to use [`yarn pack`](https://classic.yarnpkg.com/en/docs/cli/pack/): +An even more realistic way of using your local changes in a project is to use [`pnpm pack`](https://pnpm.io/cli/pack): -1. Go to `packages/hardhat-core` and run `yarn pack`. This will create a `nomiclabs-hardhat-x.y.z.tgz` file in that directory. -2. Go to some hardhat project and run `yarn add /path/to/hardhat/packages/hardhat/nomiclabs-hardhat-x.y.z.tgz`. +1. Go to `packages/hardhat-core` and run `pnpm pack`. This will create a `nomiclabs-hardhat-x.y.z.tgz` file in that directory. +2. Go to some hardhat project and run `npm install /path/to/hardhat/packages/hardhat/nomiclabs-hardhat-x.y.z.tgz`. Unlike linking, if you make a change in the code, you'll need to repeat the process.