Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: migrate from yarn to pnpm #6120

Merged
merged 2 commits into from
Jun 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
217 changes: 139 additions & 78 deletions .circleci/config.yml

Large diffs are not rendered by default.

21 changes: 5 additions & 16 deletions .github/workflows/publish-canary.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,39 +35,28 @@ jobs:
uses: actions/setup-node@master
with:
node-version: 16.x

- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"

- uses: actions/cache@v2
id: yarn-cache
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
cache: pnpm

- name: Install Dependencies
run: yarn --frozen-lockfile
run: pnpm --frozen-lockfile

- name: Install Foundry
uses: foundry-rs/foundry-toolchain@v1
with:
version: nightly

- name: Build
run: yarn build
run: pnpm build

- name: Setup Canary Snapshot
run: yarn changeset version --snapshot
run: pnpm changeset version --snapshot

- name: Publish To NPM
uses: changesets/action@v1
id: changesets
with:
createGithubReleases: false
publish: yarn changeset publish --tag canary
publish: pnpm changeset publish --tag canary
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
Expand Down
17 changes: 3 additions & 14 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,21 +33,10 @@ jobs:
uses: actions/setup-node@master
with:
node-version: 16.x

- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"

- uses: actions/cache@v2
id: yarn-cache
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
cache: pnpm

- name: Install Dependencies
run: yarn --frozen-lockfile
run: pnpm install --frozen-lockfile

- name: Install Foundry
uses: foundry-rs/foundry-toolchain@v1
Expand All @@ -62,7 +51,7 @@ jobs:
id: changesets
with:
createGithubReleases: false
publish: yarn release
publish: pnpm release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
Expand Down
3 changes: 2 additions & 1 deletion .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

yarn nx affected --target=pre-commit
pnpm nx affected --target=pre-commit

5 changes: 5 additions & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# run prefoo scripts
# npm and yarn support this as a default pnpm defaults to false
enable-pre-post-scripts=true
lockfile=true
prefer-workspace-packages=true
1 change: 1 addition & 0 deletions .prettierrc.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
module.exports = {
$schema: 'http://json.schemastore.org/prettierrc',
plugins: ['prettier-plugin-solidity'],
trailingComma: 'es5',
tabWidth: 2,
semi: false,
Expand Down
22 changes: 11 additions & 11 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ You *must* include a `changeset` file in your PR when making a change that would
Adding a `changeset` file is easy:

1. Navigate to the root of the monorepo.
2. Run `yarn changeset`. You'll be prompted to select packages to include in the changeset. Use the arrow keys to move the cursor up and down, hit the `spacebar` to select a package, and hit `enter` to confirm your selection. Select *all* packages that require a new release as a result of your PR.
2. Run `pnpm changeset`. You'll be prompted to select packages to include in the changeset. Use the arrow keys to move the cursor up and down, hit the `spacebar` to select a package, and hit `enter` to confirm your selection. Select *all* packages that require a new release as a result of your PR.
3. Once you hit `enter` you'll be prompted to decide whether your selected packages need a `major`, `minor`, or `patch` release. We follow the [Semantic Versioning](https://semver.org/) scheme. Please avoid using `major` releases for any packages that are still in version `0.y.z`.
4. Commit your changeset and push it into your PR. The changeset bot will notice your changeset file and leave a little comment to this effect on GitHub.
5. Voilà, c'est fini!
Expand All @@ -63,7 +63,7 @@ You'll need the following:
* [Git](https://git-scm.com/downloads)
* [NodeJS](https://nodejs.org/en/download/)
* [Node Version Manager](https://github.com/nvm-sh/nvm)
* [Yarn](https://classic.yarnpkg.com/en/docs/install)
* [pnpm](https://pnpm.io/installation)
* [Docker](https://docs.docker.com/get-docker/)
* [Docker Compose](https://docs.docker.com/compose/install/)
* [Go](https://go.dev/dl/)
Expand All @@ -86,10 +86,10 @@ Install node v16.16.0 with [nvm](https://github.com/nvm-sh/nvm)
nvm use
```

### Install node modules with Yarn
### Install node modules with pnpm

```bash
yarn install
pnpm i
```

### Building the TypeScript packages
Expand All @@ -101,8 +101,8 @@ and compile the smart contracts. Install foundry [here](https://getfoundry.sh/).
To build all of the [TypeScript packages](./packages), run:

```bash
yarn clean
yarn build
pnpm clean
pnpm build
```

Packages compiled when on one branch may not be compatible with packages on a different branch.
Expand Down Expand Up @@ -136,8 +136,8 @@ Finally, **if you're running into weird problems and nothing seems to be working

```bash
cd optimism
yarn clean
yarn build
pnpm clean
pnpm build
cd ops
docker-compose down -v
docker-compose build
Expand All @@ -162,14 +162,14 @@ Before running tests: **follow the above instructions to get everything built.**
Run unit tests for all packages in parallel via:

```bash
yarn test
pnpm test
```

To run unit tests for a specific package:

```bash
cd packages/package-to-test
yarn test
pnpm test
```

#### Running contract static analysis
Expand All @@ -181,5 +181,5 @@ To run `slither` locally, do:
```bash
cd packages/contracts
pip3 install slither-analyzer
yarn test:slither
pnpm test:slither
```
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ build-ts: submodules
if [ -n "$$NVM_DIR" ]; then \
. $$NVM_DIR/nvm.sh && nvm use; \
fi
yarn install
yarn build
pnpm install
pnpm build
.PHONY: build-ts

submodules:
Expand Down Expand Up @@ -102,7 +102,7 @@ test-unit:
make -C ./op-proposer test
make -C ./op-batcher test
make -C ./op-e2e test
yarn test
pnpm test
.PHONY: test-unit

test-integration:
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ See table in the **Active Branches** section above to find the right branch to t
We use [changesets](https://github.com/changesets/changesets) to mark packages for new releases.
When merging commits to the `develop` branch you MUST include a changeset file if your change would require that a new version of a package be released.

To add a changeset, run the command `yarn changeset` in the root of this monorepo.
To add a changeset, run the command `pnpm changeset` in the root of this monorepo.
You will be presented with a small prompt to select the packages to be released, the scope of the release (major, minor, or patch), and the reason for the release.
Comments within changeset files will be automatically included in the changelog of the package.

Expand Down
6 changes: 3 additions & 3 deletions lerna.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"npmClient": "yarn",
"npmClient": "pnpm",
"useWorkspaces": true,
"version": "independent",
"packages": [
"packages/*"
],
"version": "independent"
]
}
4 changes: 2 additions & 2 deletions op-bindings/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ version:

compile:
cd $(contracts-dir) && \
yarn build
pnpm build

bindings: compile bindings-build

Expand All @@ -28,7 +28,7 @@ mkdir:

clean-contracts:
cd $(contracts-dir) && \
yarn clean
pnpm clean

clean:
rm -rf $(pkg)
Expand Down
2 changes: 1 addition & 1 deletion op-bindings/bindings/faultdisputegame_more.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion op-bindings/bindings/l2outputoracle_more.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading