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 12, 2023
1 parent 232b84a commit e7635ee
Show file tree
Hide file tree
Showing 10 changed files with 21,158 additions and 44,291 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
19 changes: 19 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,25 @@ lib
es
types

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

website/.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
12 changes: 9 additions & 3 deletions netlify.toml
Original file line number Diff line number Diff line change
@@ -1,15 +1,21 @@
[build]
base = "website"
publish = "website/build"
command = "cd ../docs && npm i && cd ../website && npm run build && cp _redirects ./build"
command = "cd ../docs && yarn && cd ../website && yarn build && cp _redirects ./build"
ignore = "git diff --quiet HEAD^ HEAD -- ../docs/ ."
environment = { NODE_VERSION = "16.14.0" }

[build.environment]
NODE_VERSION = "16.14.0"
NODE_OPTIONS = "--max_old_space_size=4096"
NETLIFY_USE_YARN = "true"
YARN_VERSION = "1.22.10"

[[plugins]]
package = "netlify-plugin-cache"
[plugins.inputs]
paths = [
"node_modules/.cache",
"website/node_modules/.cache"
"website/node_modules/.cache",
".yarn/.cache"
]

Loading

0 comments on commit e7635ee

Please sign in to comment.