Skip to content

Commit

Permalink
Replace NPM commands and lockfiles with Yarn
Browse files Browse the repository at this point in the history
  • Loading branch information
markerikson committed Feb 13, 2023
1 parent 232b84a commit cefab33
Show file tree
Hide file tree
Showing 12 changed files with 23,723 additions and 48,114 deletions.
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
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

0 comments on commit cefab33

Please sign in to comment.