Skip to content

Commit

Permalink
Migrate from Yarn v1 to Yarn v3
Browse files Browse the repository at this point in the history
The package manager used has been upgraded from Yarn v1 to Yarn v3. All
of the steps in the migration guide [1] have been followed. Effectively
everything should work the same way it did before.

Closes #847

[1]: https://yarnpkg.com/getting-started/migration
  • Loading branch information
Gudahtt committed Jun 6, 2022
1 parent 90f2090 commit 4598935
Show file tree
Hide file tree
Showing 9 changed files with 12,643 additions and 8,618 deletions.
5 changes: 5 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
* text=auto

yarn.lock linguist-generated=false

# yarn v3
# See: https://yarnpkg.com/getting-started/qa#which-files-should-be-gitignored
/.yarn/releases/** binary
/.yarn/plugins/** binary
4 changes: 2 additions & 2 deletions .github/workflows/build-lint-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
with:
node-version: ${{ matrix.node-version }}
- name: Get Yarn cache directory
run: echo "::set-output name=YARN_CACHE_DIR::$(yarn cache dir)"
run: echo "::set-output name=YARN_CACHE_DIR::$(yarn config get cacheFolder)"
id: yarn-cache-dir
- name: Get Yarn version
run: echo "::set-output name=YARN_VERSION::$(yarn --version)"
Expand All @@ -30,7 +30,7 @@ jobs:
with:
path: ${{ steps.yarn-cache-dir.outputs.YARN_CACHE_DIR }}
key: yarn-cache-${{ runner.os }}-${{ steps.yarn-version.outputs.YARN_VERSION }}-${{ hashFiles('yarn.lock') }}
- run: yarn --frozen-lockfile
- run: yarn --immutable
- run: yarn allow-scripts
- run: yarn build
- run: yarn lint
Expand Down
12 changes: 10 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
# node
npm-debug.log
yarn-error.log
npm-debug.log
yarn-error.log
node_modules
package-lock.json

Expand All @@ -16,3 +14,13 @@ package-lock.json
coverage
dist
docs

# yarn v3 (w/o zero-install)
# See: https://yarnpkg.com/getting-started/qa#which-files-should-be-gitignored
.pnp.*
.yarn/*
!.yarn/patches
!.yarn/plugins
!.yarn/releases
!.yarn/sdks
!.yarn/versions
786 changes: 786 additions & 0 deletions .yarn/releases/yarn-3.2.1.cjs

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion .yarnrc

This file was deleted.

9 changes: 9 additions & 0 deletions .yarnrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# We use allow-scripts to manually enable scripts and then run them
enableScripts: false

# This ensures Yarn still uses a `node_modules` directory, which is required
# right now for TypeScript to find @types/* packages
nodeLinker: node-modules

# The current version of Yarn we're using
yarnPath: .yarn/releases/yarn-3.2.1.cjs
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ console.log(datamodel.flatState); // {infura: {...}, contractExchangeRates: [...

- Install [Node.js](https://nodejs.org) version 12
- If you are using [nvm](https://github.com/creationix/nvm#installation) (recommended) running `nvm use` will automatically choose the right node version for you.
- Install [Yarn v1](https://yarnpkg.com/en/docs/install)
- Install [Yarn v3](https://yarnpkg.com/getting-started/install)
- Run `yarn setup` to install dependencies and run any requried post-install scripts
- **Warning:** Do not use the `yarn` / `yarn install` command directly. Use `yarn setup` instead. The normal install command will skip required post-install scripts, leaving your development environment in an invalid state.

Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"lint:eslint": "eslint . --cache --ext js,ts",
"lint:fix": "yarn lint:eslint --fix && yarn lint:misc --write",
"lint:misc": "prettier '**/*.json' '**/*.md' '!CHANGELOG.md' '**/*.yml' --ignore-path .gitignore",
"prepublishOnly": "yarn build",
"prepack": "yarn build",
"setup": "yarn install && yarn allow-scripts",
"test": "jest",
"test:watch": "jest --watch"
Expand Down Expand Up @@ -110,6 +110,7 @@
"typedoc-plugin-missing-exports": "^0.22.6",
"typescript": "~4.6.3"
},
"packageManager": "[email protected]",
"engines": {
"node": ">=12.0.0"
},
Expand Down
Loading

0 comments on commit 4598935

Please sign in to comment.