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

Convert repo to use Yarn 3 for package management #4485

Merged
merged 2 commits into from
Feb 13, 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
117 changes: 84 additions & 33 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
@@ -1,43 +1,86 @@
name: Tests

on:
push:
branches: [master]
pull_request:
branches: [master]
name: CI
on: [push, pull_request]

jobs:
changes:
name: Check for changes
runs-on: ubuntu-latest
outputs:
toolkit: ${{ steps.filter.outputs.toolkit }}
steps:
- uses: actions/checkout@v2
- uses: dorny/paths-filter@v2
id: filter
with:
filters: |
src:
- 'src/**'

build:
name: Test Suite
needs: changes
#if: ${{ needs.changes.outputs.src == 'true' }}

name: Lint, Test, Build & Pack on Node ${{ matrix.node }}

runs-on: ubuntu-latest
strategy:
matrix:
node: ['16.x']

steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Checkout repo
uses: actions/checkout@v2

- name: Set up Node
uses: actions/setup-node@v3
- name: Use node ${{ matrix.node }}
uses: actions/setup-node@v2
with:
node-version: 16.x
cache: 'npm'
node-version: ${{ matrix.node }}
cache: 'yarn'

- name: Install dependencies
run: npm ci
- name: Install deps
run: yarn install

- name: Check types
run: npm run check-types
- name: Pack
run: yarn pack

- name: Check formatting
run: npm run format:check
- uses: actions/upload-artifact@v2
with:
name: package
path: ./package.tgz

- name: Lint code
run: npm run lint
test-dist:
name: Test against dist
needs: [build]
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
node: ['16.x']
steps:
- name: Checkout repo
uses: actions/checkout@v2

- name: Use node ${{ matrix.node }}
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node }}
cache: 'yarn'

- name: Install deps
run: yarn install

- uses: actions/download-artifact@v2
with:
name: package
path: .

- name: Run test suite
run: npm test
- run: ls -lah

- name: Check build
run: npm run build
- name: Install build artifact
run: yarn add ./package.tgz

- name: Run tests, against dist
run: yarn test

test-types:
name: Test Types with TypeScript ${{ matrix.ts }}
Expand All @@ -57,16 +100,24 @@ jobs:
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node }}
cache: 'npm'
cache: 'yarn'

- name: Install dependencies
run: npm ci
- name: Install deps
run: yarn install

- name: Install TypeScript ${{ matrix.ts }}
run: npm i --save-dev typescript@${{ matrix.ts }}
run: yarn add typescript@${{ matrix.ts }}

- uses: actions/download-artifact@v2
with:
name: package
path: .

- name: Install build artifact
run: yarn add ./package.tgz

- name: Test types
run: |
npm run tsc -- --version
npm run check-types
npm run test:types
yarn tsc --version
yarn check-types
yarn test:types
20 changes: 20 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,26 @@ lib
es
types

# Yarn
.cache
.yarnrc
.yarn/cache/
.yarn/*
!.yarn/patches
!.yarn/releases
!.yarn/plugins
!.yarn/sdks
!.yarn/versions
.pnp.*
*.tgz

website/.yarn/
docs/.yarn/

# yalc
.yalc
yalc.lock

website/translated_docs
website/build/
website/node_modules
Expand Down
873 changes: 873 additions & 0 deletions .yarn/releases/yarn-3.4.1.cjs

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions .yarnrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
nodeLinker: node-modules

yarnPath: .yarn/releases/yarn-3.4.1.cjs
12 changes: 7 additions & 5 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,32 +40,34 @@ git clone /~https://github.com/your-username/redux.git

### Building

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.

#### Building Redux

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

```sh
npm run build
yarn build
```

### Testing and Linting

To only run linting:

```sh
npm run lint
yarn lint
```

To only run tests:

```sh
npm run test
yarn test
```

To continuously watch and run tests, run the following:

```sh
npm run test:watch
yarn test:watch
```

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

```sh
npm run examples:test
yarn examples:test
```

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.
Expand Down
Loading