Skip to content

Commit

Permalink
chore: switch to pnpm and turborepo (#1983)
Browse files Browse the repository at this point in the history
  • Loading branch information
promer94 committed May 20, 2022
1 parent dc1beb1 commit bb7cc1f
Show file tree
Hide file tree
Showing 32 changed files with 7,446 additions and 7,116 deletions.
8 changes: 4 additions & 4 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,23 +27,23 @@ To run SWR locally, you can start it with any example in `examples` folder. You
First of all, build SWR assets

```sh
yarn watch
pnpm watch
```

Install dependency of the target example, for instance `examples/basic`:


```sh
# by default it will run next dev for the example
yarn next dev examples/basic
pnpm next dev examples/basic
```

All examples are built with Next.js, so Next.js commands are all supported:

```sh
# if you want to build and start
yarn next build examples/basic
yarn next start examples/basic
pnpm next build examples/basic
pnpm next start examples/basic
```
## Update Documentation

Expand Down
40 changes: 30 additions & 10 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,38 @@ on:
jobs:
test:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3

- name: Use Node.js
uses: actions/setup-node@v2
uses: actions/setup-node@v3
with:
node-version: 16

- uses: pnpm/action-setup@v2.0.1
name: Install pnpm
id: pnpm-install
with:
node-version: '14'
cache: 'yarn'
- run: yarn install
- run: yarn types:check
- run: yarn lint
- run: yarn build
- run: yarn test
version: 7
run_install: false

- name: Get pnpm store directory
id: pnpm-cache
run: |
echo "::set-output name=pnpm_cache_dir::$(pnpm store path)"
- uses: actions/cache@v3
name: Setup pnpm cache
with:
path: ${{ steps.pnpm-cache.outputs.pnpm_cache_dir }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- run: pnpm install
- run: pnpm types:check
- run: pnpm lint
- run: pnpm build
- run: pnpm test
env:
CI: true
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,6 @@ dist
examples/**/yarn.lock
package-lock.json
tsconfig.tsbuildinfo
coverage
coverage
*/**/.turbo
.turbo
7 changes: 7 additions & 0 deletions _internal/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,13 @@
"module": "./dist/index.esm.js",
"types": "./dist/_internal",
"exports": "./dist/index.mjs",
"private": true,
"scripts": {
"watch": "bunchee index.ts --no-sourcemap -w",
"build": "bunchee index.ts --no-sourcemap",
"types:check": "tsc --noEmit",
"clean": "rimraf dist"
},
"peerDependencies": {
"react": "*"
}
Expand Down
7 changes: 7 additions & 0 deletions core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,13 @@
"module": "./dist/index.esm.js",
"types": "./dist/index.d.ts",
"exports": "./dist/index.mjs",
"private": true,
"scripts": {
"watch": "bunchee index.ts --no-sourcemap -w",
"build": "bunchee index.ts --no-sourcemap",
"types:check": "tsc --noEmit",
"clean": "rimraf dist"
},
"peerDependencies": {
"swr": "*",
"react": "*",
Expand Down
4 changes: 2 additions & 2 deletions examples/api-hooks/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
"license": "MIT",
"dependencies": {
"next": "latest",
"react": "17.0.2",
"react-dom": "17.0.2",
"react": "18.1.0",
"react-dom": "18.1.0",
"swr": "latest"
},
"scripts": {
Expand Down
4 changes: 2 additions & 2 deletions examples/autocomplete-suggestions/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
"dependencies": {
"@reach/combobox": "0.16.1",
"next": "latest",
"react": "17.0.2",
"react-dom": "17.0.2",
"react": "18.1.0",
"react-dom": "18.1.0",
"swr": "latest"
},
"scripts": {
Expand Down
4 changes: 2 additions & 2 deletions examples/axios-typescript/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
"dependencies": {
"axios": "0.23.0",
"next": "latest",
"react": "17.0.2",
"react-dom": "17.0.2",
"react": "18.1.0",
"react-dom": "18.1.0",
"swr": "latest"
},
"scripts": {
Expand Down
6 changes: 3 additions & 3 deletions examples/axios/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
"main": "index.js",
"license": "MIT",
"dependencies": {
"axios": "0.21.1",
"axios": "0.27.2",
"next": "latest",
"react": "17.0.2",
"react-dom": "17.0.2",
"react": "18.1.0",
"react-dom": "18.1.0",
"swr": "latest"
},
"scripts": {
Expand Down
4 changes: 2 additions & 2 deletions examples/basic-typescript/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
"license": "MIT",
"dependencies": {
"next": "latest",
"react": "17.0.2",
"react-dom": "17.0.2",
"react": "18.1.0",
"react-dom": "18.1.0",
"swr": "latest"
},
"scripts": {
Expand Down
4 changes: 2 additions & 2 deletions examples/basic/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
"license": "MIT",
"dependencies": {
"next": "latest",
"react": "17.0.2",
"react-dom": "17.0.2",
"react": "18.1.0",
"react-dom": "18.1.0",
"swr": "latest"
},
"scripts": {
Expand Down
4 changes: 2 additions & 2 deletions examples/focus-revalidate/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
"license": "MIT",
"dependencies": {
"next": "latest",
"react": "17.0.2",
"react-dom": "17.0.2",
"react": "18.1.0",
"react-dom": "18.1.0",
"swr": "latest"
},
"scripts": {
Expand Down
4 changes: 2 additions & 2 deletions examples/global-fetcher/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
"license": "MIT",
"dependencies": {
"next": "latest",
"react": "17.0.2",
"react-dom": "17.0.2",
"react": "18.1.0",
"react-dom": "18.1.0",
"swr": "latest"
},
"scripts": {
Expand Down
4 changes: 2 additions & 2 deletions examples/infinite-scroll/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
"license": "MIT",
"dependencies": {
"next": "latest",
"react": "17.0.2",
"react-dom": "17.0.2",
"react": "18.1.0",
"react-dom": "18.1.0",
"swr": "latest"
},
"scripts": {
Expand Down
4 changes: 2 additions & 2 deletions examples/infinite/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
"license": "MIT",
"dependencies": {
"next": "latest",
"react": "17.0.2",
"react-dom": "17.0.2",
"react": "18.1.0",
"react-dom": "18.1.0",
"swr": "latest"
},
"scripts": {
Expand Down
4 changes: 2 additions & 2 deletions examples/local-state-sharing/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
"main": "index.js",
"license": "MIT",
"dependencies": {
"react": "17.0.2",
"react-dom": "17.0.2",
"react": "18.1.0",
"react-dom": "18.1.0",
"next": "latest",
"swr": "latest"
},
Expand Down
4 changes: 2 additions & 2 deletions examples/optimistic-ui-immer/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
"dependencies": {
"immer": "9.0.5",
"next": "latest",
"react": "17.0.2",
"react-dom": "17.0.2",
"react": "18.1.0",
"react-dom": "18.1.0",
"swr": "latest"
},
"scripts": {
Expand Down
4 changes: 2 additions & 2 deletions examples/optimistic-ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
"license": "MIT",
"dependencies": {
"next": "latest",
"react": "17.0.2",
"react-dom": "17.0.2",
"react": "18.1.0",
"react-dom": "18.1.0",
"swr": "latest"
},
"scripts": {
Expand Down
4 changes: 2 additions & 2 deletions examples/prefetch-preload/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
"license": "MIT",
"dependencies": {
"next": "latest",
"react": "17.0.2",
"react-dom": "17.0.2",
"react": "18.1.0",
"react-dom": "18.1.0",
"swr": "latest"
},
"scripts": {
Expand Down
4 changes: 2 additions & 2 deletions examples/refetch-interval/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
"license": "MIT",
"dependencies": {
"next": "latest",
"react": "17.0.2",
"react-dom": "17.0.2",
"react": "18.1.0",
"react-dom": "18.1.0",
"swr": "latest"
},
"scripts": {
Expand Down
4 changes: 2 additions & 2 deletions examples/server-render/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
"license": "MIT",
"dependencies": {
"next": "latest",
"react": "17.0.2",
"react-dom": "17.0.2",
"react": "18.1.0",
"react-dom": "18.1.0",
"swr": "latest"
},
"scripts": {
Expand Down
4 changes: 2 additions & 2 deletions examples/storage-tab-sync/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
"license": "MIT",
"dependencies": {
"next": "latest",
"react": "17.0.2",
"react-dom": "17.0.2",
"react": "18.1.0",
"react-dom": "18.1.0",
"swr": "latest"
},
"scripts": {
Expand Down
4 changes: 2 additions & 2 deletions examples/suspense/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
"license": "MIT",
"dependencies": {
"next": "latest",
"react": "17.0.2",
"react-dom": "17.0.2",
"react": "18.1.0",
"react-dom": "18.1.0",
"swr": "latest"
},
"scripts": {
Expand Down
7 changes: 7 additions & 0 deletions immutable/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,13 @@
"module": "./dist/index.esm.js",
"types": "./dist/immutable",
"exports": "./dist/index.mjs",
"private": true,
"scripts": {
"watch": "bunchee index.ts --no-sourcemap -w",
"build": "bunchee index.ts --no-sourcemap",
"types:check": "tsc --noEmit",
"clean": "rimraf dist"
},
"peerDependencies": {
"swr": "*",
"react": "*"
Expand Down
7 changes: 7 additions & 0 deletions infinite/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,13 @@
"module": "./dist/index.esm.js",
"types": "./dist/infinite",
"exports": "./dist/index.mjs",
"private": true,
"scripts": {
"watch": "bunchee index.ts --no-sourcemap -w",
"build": "bunchee index.ts --no-sourcemap",
"types:check": "tsc --noEmit",
"clean": "rimraf dist"
},
"peerDependencies": {
"swr": "*",
"react": "*",
Expand Down
7 changes: 7 additions & 0 deletions mutation/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,13 @@
"module": "./dist/index.esm.js",
"types": "./dist/mutation",
"exports": "./dist/index.mjs",
"private": true,
"scripts": {
"watch": "bunchee index.ts --no-sourcemap -w",
"build": "bunchee index.ts --no-sourcemap",
"types:check": "tsc --noEmit",
"clean": "rimraf dist"
},
"peerDependencies": {
"swr": "*",
"react": "*"
Expand Down

0 comments on commit bb7cc1f

Please sign in to comment.