Skip to content

Commit 067f677

Browse files
committed
Replace NPM commands and lockfiles with Yarn
1 parent 232b84a commit 067f677

12 files changed

+23722
-48113
lines changed

.github/workflows/test.yaml

+84-33
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,86 @@
1-
name: Tests
2-
3-
on:
4-
push:
5-
branches: [master]
6-
pull_request:
7-
branches: [master]
1+
name: CI
2+
on: [push, pull_request]
83

94
jobs:
5+
changes:
6+
name: Check for changes
7+
runs-on: ubuntu-latest
8+
outputs:
9+
toolkit: ${{ steps.filter.outputs.toolkit }}
10+
steps:
11+
- uses: actions/checkout@v2
12+
- uses: dorny/paths-filter@v2
13+
id: filter
14+
with:
15+
filters: |
16+
src:
17+
- 'src/**'
18+
1019
build:
11-
name: Test Suite
20+
needs: changes
21+
#if: ${{ needs.changes.outputs.src == 'true' }}
22+
23+
name: Lint, Test, Build & Pack on Node ${{ matrix.node }}
24+
1225
runs-on: ubuntu-latest
26+
strategy:
27+
matrix:
28+
node: ['16.x']
1329

1430
steps:
15-
- name: Checkout code
16-
uses: actions/checkout@v3
31+
- name: Checkout repo
32+
uses: actions/checkout@v2
1733

18-
- name: Set up Node
19-
uses: actions/setup-node@v3
34+
- name: Use node ${{ matrix.node }}
35+
uses: actions/setup-node@v2
2036
with:
21-
node-version: 16.x
22-
cache: 'npm'
37+
node-version: ${{ matrix.node }}
38+
cache: 'yarn'
2339

24-
- name: Install dependencies
25-
run: npm ci
40+
- name: Install deps
41+
run: yarn install
2642

27-
- name: Check types
28-
run: npm run check-types
43+
- name: Pack
44+
run: yarn pack
2945

30-
- name: Check formatting
31-
run: npm run format:check
46+
- uses: actions/upload-artifact@v2
47+
with:
48+
name: package
49+
path: ./package.tgz
3250

33-
- name: Lint code
34-
run: npm run lint
51+
test-dist:
52+
name: Test against dist
53+
needs: [build]
54+
runs-on: ubuntu-latest
55+
strategy:
56+
fail-fast: false
57+
matrix:
58+
node: ['16.x']
59+
steps:
60+
- name: Checkout repo
61+
uses: actions/checkout@v2
62+
63+
- name: Use node ${{ matrix.node }}
64+
uses: actions/setup-node@v2
65+
with:
66+
node-version: ${{ matrix.node }}
67+
cache: 'yarn'
68+
69+
- name: Install deps
70+
run: yarn install
71+
72+
- uses: actions/download-artifact@v2
73+
with:
74+
name: package
75+
path: .
3576

36-
- name: Run test suite
37-
run: npm test
77+
- run: ls -lah
3878

39-
- name: Check build
40-
run: npm run build
79+
- name: Install build artifact
80+
run: yarn add ./package.tgz
81+
82+
- name: Run tests, against dist
83+
run: yarn test
4184

4285
test-types:
4386
name: Test Types with TypeScript ${{ matrix.ts }}
@@ -57,16 +100,24 @@ jobs:
57100
uses: actions/setup-node@v2
58101
with:
59102
node-version: ${{ matrix.node }}
60-
cache: 'npm'
103+
cache: 'yarn'
61104

62-
- name: Install dependencies
63-
run: npm ci
105+
- name: Install deps
106+
run: yarn install
64107

65108
- name: Install TypeScript ${{ matrix.ts }}
66-
run: npm i --save-dev typescript@${{ matrix.ts }}
109+
run: yarn add typescript@${{ matrix.ts }}
110+
111+
- uses: actions/download-artifact@v2
112+
with:
113+
name: package
114+
path: .
115+
116+
- name: Install build artifact
117+
run: yarn add ./package.tgz
67118

68119
- name: Test types
69120
run: |
70-
npm run tsc -- --version
71-
npm run check-types
72-
npm run test:types
121+
yarn tsc --version
122+
yarn check-types
123+
yarn test:types

.gitignore

+20
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,26 @@ lib
77
es
88
types
99

10+
# Yarn
11+
.cache
12+
.yarnrc
13+
.yarn/cache/
14+
.yarn/*
15+
!.yarn/patches
16+
!.yarn/releases
17+
!.yarn/plugins
18+
!.yarn/sdks
19+
!.yarn/versions
20+
.pnp.*
21+
*.tgz
22+
23+
website/.yarn/
24+
docs/.yarn/
25+
26+
# yalc
27+
.yalc
28+
yalc.lock
29+
1030
website/translated_docs
1131
website/build/
1232
website/node_modules

CONTRIBUTING.md

+7-5
Original file line numberDiff line numberDiff line change
@@ -40,32 +40,34 @@ git clone https://github.com/your-username/redux.git
4040

4141
### Building
4242

43+
This repo uses Yarn 3 for all package management. Please ensure that Yarn 1.x is installed globally on your system, so that Yarn 3 will run properly inside this repo.
44+
4345
#### Building Redux
4446

4547
Running the `build` task will create a CommonJS module-per-module build, a ES Modules build and a UMD build.
4648

4749
```sh
48-
npm run build
50+
yarn build
4951
```
5052

5153
### Testing and Linting
5254

5355
To only run linting:
5456

5557
```sh
56-
npm run lint
58+
yarn lint
5759
```
5860

5961
To only run tests:
6062

6163
```sh
62-
npm run test
64+
yarn test
6365
```
6466

6567
To continuously watch and run tests, run the following:
6668

6769
```sh
68-
npm run test:watch
70+
yarn test:watch
6971
```
7072

7173
### Docs
@@ -83,7 +85,7 @@ When adding a new example, please adhere to the style and format of the existing
8385
To test the official Redux examples, run the following:
8486

8587
```sh
86-
npm run examples:test
88+
yarn examples:test
8789
```
8890

8991
Not all examples have tests. If you see an example project without tests, you are very welcome to add them in a way consistent with the examples that have tests.

0 commit comments

Comments
 (0)