Skip to content

Commit 5a11915

Browse files
authored
Convert package management to Yarn v2 (#1751)
1 parent c8ee01e commit 5a11915

13 files changed

+18311
-71590
lines changed

.github/workflows/test.yml

+20-23
Original file line numberDiff line numberDiff line change
@@ -2,39 +2,36 @@ name: Tests
22

33
on:
44
push:
5-
branches: [ master ]
5+
branches: [master, typescript-port]
66
pull_request:
7-
branches: [ master ]
7+
branches: [master, typescript-port]
88

99
jobs:
1010
build:
1111
name: Test Suite
1212
runs-on: ubuntu-latest
1313

1414
steps:
15+
- name: Set up Node
16+
uses: actions/setup-node@v1
17+
with:
18+
node-version: 14.x
1519

16-
- name: Set up Node
17-
uses: actions/setup-node@v1
18-
with:
19-
node-version: 14.x
20+
- name: Checkout code
21+
uses: actions/checkout@v2
2022

21-
- name: Checkout code
22-
uses: actions/checkout@v2
23+
- name: Cache dependencies
24+
- uses: actions/cache@v2
25+
with:
26+
path: .yarn/cache
27+
key: yarn-${{ hashFiles('yarn.lock') }}
28+
restore-keys: yarn-
2329

24-
- name: Cache dependencies
25-
uses: actions/cache@v2
26-
with:
27-
path: ~/.npm
28-
key: ${{ runner.OS }}-npm-${{ hashFiles('**/package-lock.json') }}
29-
restore-keys: |
30-
${{ runner.OS }}-npm-
31-
${{ runner.OS }}-
30+
- name: Install dependencies
31+
run: yarn install
3232

33-
- name: Install dependencies
34-
run: npm ci
33+
- name: Run test suite
34+
run: yarn test
3535

36-
- name: Run test suite
37-
run: npm test
38-
39-
- name: Collect coverage
40-
run: npm run coverage
36+
- name: Collect coverage
37+
run: yarn coverage

.gitignore

+15
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,21 @@ lib
44
coverage
55
es
66

7+
.cache
8+
.yarnrc
9+
.yarn/*
10+
!.yarn/patches
11+
!.yarn/releases
12+
!.yarn/plugins
13+
!.yarn/sdks
14+
!.yarn/versions
15+
.pnp.*
16+
*.tgz
17+
18+
.yalc
19+
yalc.lock
20+
yalc.sig
21+
722
lib/core/metadata.js
823
lib/core/MetadataBlog.js
924

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
module.exports = {
2+
name: `@yarnpkg/plugin-compat`,
3+
factory: (require) => {
4+
// we are not using PNP and want to use `typescript@next` in CI without hassle
5+
// dummy implementation to override the built-in version of this plugin
6+
// can be dropped once we switch to yarn 3
7+
return {}
8+
},
9+
}

.yarn/plugins/@yarnpkg/plugin-workspace-tools.cjs

+29
Large diffs are not rendered by default.

.yarn/releases/yarn-berry.cjs

+55
Large diffs are not rendered by default.

.yarnrc.yml

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
nodeLinker: node-modules
2+
3+
plugins:
4+
- path: .yarn/plugins/@yarnpkg/plugin-workspace-tools.cjs
5+
spec: '@yarnpkg/plugin-workspace-tools'
6+
- path: .yarn/plugins/@yarnpkg/plugin-compat.cjs
7+
spec: '@yarnpkg/plugin-compat'
8+
9+
yarnPath: .yarn/releases/yarn-berry.cjs

CONTRIBUTING.md

+28-13
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
# Contributing
2-
We are open to, and grateful for, any contributions made by the community. By contributing to React Redux, you agree to abide by the [code of conduct](https://github.com/reduxjs/react-redux/blob/master/CODE_OF_CONDUCT.md).
2+
3+
We are open to, and grateful for, any contributions made by the community. By contributing to React Redux, you agree to abide by the [code of conduct](https://github.com/reduxjs/react-redux/blob/master/CODE_OF_CONDUCT.md).
34

45
Please review the [Redux Style Guide](https://redux.js.org/style-guide/style-guide) in the Redux docs to keep track of our best practices.
56

67
## Reporting Issues and Asking Questions
8+
79
Before opening an issue, please search the [issue tracker](https://github.com/reduxjs/react-redux/issues) to make sure your issue hasn't already been reported.
810

911
Please ask any general and implementation specific questions on [Stack Overflow with a Redux tag](http://stackoverflow.com/questions/tagged/redux?sort=votes&pageSize=50) for support.
@@ -13,43 +15,56 @@ Please ask any general and implementation specific questions on [Stack Overflow
1315
Visit the [Issue tracker](https://github.com/reduxjs/react-redux/issues) to find a list of open issues that need attention.
1416

1517
Fork, then clone the repo:
18+
1619
```
1720
git clone https://github.com/your-username/react-redux.git
1821
```
1922

23+
This repository uses Yarn v2 to manage packages. You'll need to have Yarn v1.22 installed globally on your system first, as Yarn v2 depends on that being available first. Install dependencies with:
24+
25+
```
26+
yarn install
27+
```
28+
2029
### Building
2130

2231
Running the `build` task will create both a CommonJS module-per-module build and a UMD build.
32+
2333
```
24-
npm run build
34+
yarn build
2535
```
2636

2737
To create just a CommonJS module-per-module build:
38+
2839
```
29-
npm run build:lib
40+
yarn build:lib
3041
```
3142

3243
To create just a UMD build:
44+
3345
```
34-
npm run build:umd
35-
npm run build:umd:min
46+
yarn build:umd
47+
yarn build:umd:min
3648
```
3749

3850
### Testing and Linting
3951

4052
To run the tests:
53+
4154
```
42-
npm run test
55+
yarn test
4356
```
4457

4558
To continuously watch and run tests, run the following:
59+
4660
```
47-
npm test -- --watch
61+
yarn test --watch
4862
```
4963

5064
To perform linting with `eslint`, run the following:
65+
5166
```
52-
npm run lint
67+
yarn lint
5368
```
5469

5570
### New Features
@@ -58,11 +73,11 @@ Please open an issue with a proposal for a new feature or refactoring before sta
5873

5974
## Submitting Changes
6075

61-
* Open a new issue in the [Issue tracker](https://github.com/reduxjs/react-redux/issues).
62-
* Fork the repo.
63-
* Create a new feature branch based off the `master` branch.
64-
* Make sure all tests pass and there are no linting errors.
65-
* Submit a pull request, referencing any issues it addresses.
76+
- Open a new issue in the [Issue tracker](https://github.com/reduxjs/react-redux/issues).
77+
- Fork the repo.
78+
- Create a new feature branch based off the `master` branch.
79+
- Make sure all tests pass and there are no linting errors.
80+
- Submit a pull request, referencing any issues it addresses.
6681

6782
Please try to keep your pull request focused in scope and avoid including unrelated commits.
6883

README.md

+8-11
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,12 @@
1-
React Redux
2-
=========================
1+
# React Redux
32

43
Official React bindings for [Redux](https://github.com/reduxjs/redux).
54
Performant and flexible.
65

7-
[![build status](https://img.shields.io/travis/reduxjs/react-redux/master.svg?style=flat-square)](https://travis-ci.org/reduxjs/react-redux) [![npm version](https://img.shields.io/npm/v/react-redux.svg?style=flat-square)](https://www.npmjs.com/package/react-redux)
6+
![GitHub Workflow Status](https://img.shields.io/github/workflow/status/reduxjs/react-redux/CI?style=flat-square) [![npm version](https://img.shields.io/npm/v/react-redux.svg?style=flat-square)](https://www.npmjs.com/package/react-redux)
87
[![npm downloads](https://img.shields.io/npm/dm/react-redux.svg?style=flat-square)](https://www.npmjs.com/package/react-redux)
98
[![redux channel on discord](https://img.shields.io/badge/discord-redux@reactiflux-61DAFB.svg?style=flat-square)](http://www.reactiflux.com)
109

11-
1210
## Installation
1311

1412
### Using Create React App
@@ -35,18 +33,17 @@ yarn add react-redux
3533

3634
You'll also need to [install Redux](https://redux.js.org/introduction/installation) and [set up a Redux store](https://redux.js.org/recipes/configuring-your-store/) in your app.
3735

38-
This assumes that you’re using [npm](http://npmjs.com/) package manager
39-
with a module bundler like [Webpack](https://webpack.js.org/) or
40-
[Browserify](http://browserify.org/) to consume [CommonJS
36+
This assumes that you’re using [npm](http://npmjs.com/) package manager
37+
with a module bundler like [Webpack](https://webpack.js.org/) or
38+
[Browserify](http://browserify.org/) to consume [CommonJS
4139
modules](https://webpack.js.org/api/module-methods/#commonjs).
4240

43-
If you don’t yet use [npm](http://npmjs.com/) or a modern module bundler, and would rather prefer a single-file [UMD](https://github.com/umdjs/umd) build that makes `ReactRedux` available as a global object, you can grab a pre-built version from [cdnjs](https://cdnjs.com/libraries/react-redux). We *don’t* recommend this approach for any serious application, as most of the libraries complementary to Redux are only available on [npm](http://npmjs.com/).
41+
If you don’t yet use [npm](http://npmjs.com/) or a modern module bundler, and would rather prefer a single-file [UMD](https://github.com/umdjs/umd) build that makes `ReactRedux` available as a global object, you can grab a pre-built version from [cdnjs](https://cdnjs.com/libraries/react-redux). We _don’t_ recommend this approach for any serious application, as most of the libraries complementary to Redux are only available on [npm](http://npmjs.com/).
4442

4543
## React Native
4644

4745
As of React Native 0.18, React Redux 5.x should work with React Native. If you have any issues with React Redux 5.x on React Native, run `npm ls react` and make sure you don’t have a duplicate React installation in your `node_modules`. We recommend that you use `npm@3.x` which is better at avoiding these kinds of issues.
4846

49-
5047
## Documentation
5148

5249
The React Redux docs are now published at **https://react-redux.js.org** .
@@ -55,9 +52,9 @@ We're currently expanding and rewriting our docs content - check back soon for m
5552

5653
## How Does It Work?
5754

58-
We do a deep dive on how React Redux works in [this readthesource episode](https://www.youtube.com/watch?v=VJ38wSFbM3A).
55+
We do a deep dive on how React Redux works in [this readthesource episode](https://www.youtube.com/watch?v=VJ38wSFbM3A).
5956

60-
Also, the post [The History and Implementation of React-Redux](https://blog.isquaredsoftware.com/2018/11/react-redux-history-implementation/)
57+
Also, the post [The History and Implementation of React-Redux](https://blog.isquaredsoftware.com/2018/11/react-redux-history-implementation/)
6158
explains what it does, how it works, and how the API and implementation have evolved over time.
6259

6360
Enjoy!

netlify.toml

+9-2
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,22 @@
11
[build]
22
base = "website"
33
publish = "website/build"
4-
command = "npm run build && cp _redirects ./build"
4+
command = "yarn build && cp _redirects ./build"
55
ignore = "git diff --quiet HEAD^ HEAD -- ../docs/ ."
66

7+
[build.environment]
8+
NODE_VERSION = "14"
9+
NODE_OPTIONS = "--max_old_space_size=4096"
10+
NETLIFY_USE_YARN = "true"
11+
YARN_VERSION = "1.22.10"
12+
713

814
[[plugins]]
915
package = "netlify-plugin-cache"
1016
[plugins.inputs]
1117
paths = [
1218
"node_modules/.cache",
13-
"website/node_modules/.cache"
19+
"website/node_modules/.cache",
20+
".yarn/.cache"
1421
]
1522

0 commit comments

Comments
 (0)