Skip to content

Commit

Permalink
chore: switch to pnpm (trpc#2749)
Browse files Browse the repository at this point in the history
  • Loading branch information
sachinraja authored Sep 24, 2022
1 parent 54b1938 commit 18a2757
Show file tree
Hide file tree
Showing 79 changed files with 21,537 additions and 20,771 deletions.
5 changes: 0 additions & 5 deletions .changeset/yellow-waves-press.md

This file was deleted.

30 changes: 21 additions & 9 deletions .github/workflows/examples-old-nodes.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,26 +26,38 @@ jobs:
- 5432:5432
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2

- uses: pnpm/[email protected]

- uses: actions/setup-node@v3
with:
node-version: 16.x
cache: 'pnpm'

- name: Cache Playwright's binary
uses: actions/cache@v3
with:
key: ${{ runner.os }}-playwright-bin-v1
path: ${{ env.PLAYWRIGHT_BROWSERS_PATH }}

- run: node -v
- uses: bahmutov/npm-install@v1
- name: Install deps and build (with cache)
run: pnpm install

- name: Next.js cache
uses: actions/cache@v2
with:
path: ${{ github.workspace }}${{ matrix.dir }}/.next/cache
key: ${{ matrix.dir }}-${{ runner.os }}-${{ matrix.node-start }}-${{ hashFiles('**/yarn.lock') }}-nextjs
key: ${{ matrix.dir }}-${{ runner.os }}-${{ matrix.node-start }}-${{ hashFiles('**/pnpm-lock.yaml') }}-nextjs

- uses: actions/setup-node@v2
- uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-start }}

- run: node -v

- name: if exists, run yarn lint
run: cd examples/${{ matrix.dir }} && cat package.json | if grep --silent '"lint"'; then yarn lint; fi
- run: yarn --cwd examples/${{ matrix.dir }} build
- run: yarn --cwd examples/${{ matrix.dir }} test-start
- run: yarn --cwd examples/${{ matrix.dir }} test-dev
- name: if exists, run pnpm lint
run: cd examples/${{ matrix.dir }} && cat package.json | if grep --silent '"lint"'; then pnpm lint; fi
- run: pnpm --filter ./examples/${{ matrix.dir }} build
- run: pnpm --filter ./examples/${{ matrix.dir }} test-start
- run: pnpm --filter ./examples/${{ matrix.dir }} test-dev
44 changes: 32 additions & 12 deletions .github/workflows/examples.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,30 +50,50 @@ jobs:
- 5432:5432
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2

- uses: pnpm/[email protected]

- uses: actions/setup-node@v3
with:
node-version: 16.x
cache: 'pnpm'

- name: Cache Playwright's binary
uses: actions/cache@v3
with:
key: ${{ runner.os }}-playwright-bin-v1
path: ${{ env.PLAYWRIGHT_BROWSERS_PATH }}

- run: node -v
- uses: bahmutov/npm-install@v1
- name: Install deps and build (with cache)
run: pnpm install

- name: Cache Playwright's binary
uses: actions/cache@v3
with:
key: ${{ runner.os }}-playwright-bin-v1
path: ${{ env.PLAYWRIGHT_BROWSERS_PATH }}

- name: Install Playwright
run: pnpm playwright install

- name: Next.js cache
uses: actions/cache@v2
with:
path: ${{ github.workspace }}${{ matrix.dir }}/.next/cache
key: ${{ matrix.dir }}-${{ runner.os }}-${{ matrix.node-start }}-${{ hashFiles('**/yarn.lock') }}-nextjs
key: ${{ matrix.dir }}-${{ runner.os }}-${{ matrix.node-start }}-${{ hashFiles('**/pnpm-lock.yaml') }}-nextjs

- uses: actions/setup-node@v2
- uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-start }}

- run: node -v

- name: if exists, run yarn lint
run: cd examples/${{ matrix.dir }} && cat package.json | if grep --silent '"lint"'; then yarn lint; fi
- name: if exists, run yarn build
run: cd examples/${{ matrix.dir }} && cat package.json | if grep --silent '"build"'; then yarn build; fi
- name: if exists, run yarn test-start
run: cd examples/${{ matrix.dir }} && cat package.json | if grep --silent '"test-start"'; then yarn test-start; fi
- name: if exists, run yarn test-dev
run: cd examples/${{ matrix.dir }} && cat package.json | if grep --silent '"test-dev"'; then yarn test-dev; fi
- name: if exists, run lint
run: cd examples/${{ matrix.dir }} && cat package.json | if grep --silent '"lint"'; then pnpm lint; fi
- name: if exists, run build
run: cd examples/${{ matrix.dir }} && cat package.json | if grep --silent '"build"'; then pnpm build; fi
- name: if exists, run test-start
run: cd examples/${{ matrix.dir }} && cat package.json | if grep --silent '"test-start"'; then pnpm test-start; fi
- name: if exists, run test-dev
run: cd examples/${{ matrix.dir }} && cat package.json | if grep --silent '"test-dev"'; then pnpm test-dev; fi
21 changes: 16 additions & 5 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,31 @@ concurrency:
jobs:
lint:
runs-on: ubuntu-latest
env:
PLAYWRIGHT_BROWSERS_PATH: ${{ github.workspace }}/playwright

steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0

- uses: actions/setup-node@v1
- uses: pnpm/[email protected]

- uses: actions/setup-node@v3
with:
version: '16.x'
cache: 'pnpm'

- name: Cache Playwright's binary
uses: actions/cache@v3
with:
version: 16.x
key: ${{ runner.os }}-playwright-bin-v1
path: ${{ env.PLAYWRIGHT_BROWSERS_PATH }}

- name: Install deps and build (with cache)
uses: bahmutov/npm-install@v1
run: pnpm install

- name: Lint
run: yarn lint
run: pnpm lint

- run: yarn manypkg check
- run: pnpm manypkg check
18 changes: 15 additions & 3 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ jobs:
name: Build and test on Node ${{ matrix.node }} and ${{ matrix.os }}

runs-on: ${{ matrix.os }}
env:
PLAYWRIGHT_BROWSERS_PATH: ${{ github.workspace }}/playwright

strategy:
matrix:
node: ['16.x']
Expand All @@ -14,16 +17,25 @@ jobs:
- name: Checkout repo
uses: actions/checkout@v2

- uses: pnpm/[email protected]

- name: Use Node ${{ matrix.node }}
uses: actions/setup-node@v1
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node }}
cache: 'pnpm'

- name: Cache Playwright's binary
uses: actions/cache@v3
with:
key: ${{ runner.os }}-playwright-bin-v1
path: ${{ env.PLAYWRIGHT_BROWSERS_PATH }}

- name: Install deps and build (with cache)
uses: bahmutov/npm-install@v1
run: pnpm install

- name: Test
run: yarn test --ci --coverage --maxWorkers=2
run: pnpm test -- --ci --coverage --maxWorkers=2

- uses: codecov/codecov-action@v1
with:
Expand Down
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
*.log
.DS_Store
node_modules
dist
.next

node_modules
package-lock.json
yarn.lock

.yalc
yalc.lock
Expand All @@ -25,3 +25,5 @@ packages/*/*
!packages/*/test

examples/next-big-router/src/server/routers

playwright
3 changes: 3 additions & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
public-hoist-pattern[]=@types/*
public-hoist-pattern[]=playwright-core
side-effects-cache=false
9 changes: 9 additions & 0 deletions .prettierrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
module.exports = {
printWidth: 80,
trailingComma: 'all',
endOfLine: 'auto',
singleQuote: true,
importOrder: ['___', '__', '<THIRD_PARTY_MODULES>', '^[./]'],
importOrderSortSpecifiers: true,
plugins: [require.resolve('@trivago/prettier-plugin-sort-imports')],
};
18 changes: 10 additions & 8 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,12 @@ So excited to have you here! If you want **any** guidance whatsoever with contri

## Development workflow

We use [pnpm](https://pnpm.io) as our package manager, so make sure to [install](https://pnpm.io/installation) it first.

```bash
git clone [email protected]:trpc/trpc.git
cd trpc
yarn
pnpm install
```

### Get it running
Expand All @@ -16,39 +18,39 @@ yarn

```bash
# in project root directory
yarn dev
pnpm dev
```

This will start a watcher in parallel which builds all `packages/*` on any file change.

**Terminal 2:**

In another terminal, you can for instance navigate to `examples/next-prisma-starter` and run `yarn dev` & it will update whenever code is changed in the packages.
In another terminal, you can for instance navigate to `examples/next-prisma-starter` and run `pnpm dev` & it will update whenever code is changed in the packages.

### Testing

> Note: you will want to have `yarn dev` running in parallel in another terminal
> Note: you will want to have `pnpm dev` running in parallel in another terminal
```bash
# in project root directory
yarn test --watch
pnpm test --watch

# example if you want to test a specific test file:
yarn test --watch --testPathPattern react
pnpm test --watch --testPathPattern react
```

Testing is currently coalesced in [./packages/server/test](./packages/server/test); we import the different libs from here, this makes it easier for us to do integration testing + getting test coverage on the whole codebase.

### Linting

```bash
yarn lint-fix
pnpm lint-fix
```

### Documentation

```bash
cd www/ && yarn dev
cd www/ && pnpm dev
```

## Project overview
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,7 @@ Also, if your company using tRPC and want to support long-term maintenance of tR

<!-- markdownlint-restore -->
<!-- prettier-ignore-end -->

<!-- SPONSORS:LIST:END -->

## All contributors ✨
Expand Down
4 changes: 2 additions & 2 deletions codecov.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# configuration related to pull request comments
comment: no # do not comment PR with the result
comment: false # do not comment PR with the result

ignore:
- '**/deprecated/**'
Expand All @@ -13,4 +13,4 @@ coverage:
threshold: 1% # allow for 1% reduction of coverage without failing

# do not run coverage on patch nor changes
patch: false
patch: off
2 changes: 1 addition & 1 deletion examples/.interop/express-server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"dev:client": "nodemon -e ts -w . -x npm run start-client-dev",
"dev": "run-p dev:* --print-label",
"build": "tsc",
"start": "yarn dev",
"start": "pnpm dev",
"start-client-dev": "wait-on tcp:2021 && ts-node ./src/client",
"test-dev": "start-server-and-test 'ts-node src/server' 2021 'ts-node src/client'",
"test-start": "start-server-and-test 'node dist/server' 2021 'node dist/client'"
Expand Down
4 changes: 2 additions & 2 deletions examples/.interop/fastify-server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@
"build": "tsc",
"wait-server": "wait-on tcp:2022",
"dev:server": "nodemon --watch src/server src/server/index.ts",
"dev:client": "yarn wait-server && nodemon --watch src/client src/client/index.ts",
"dev:client": "pnpm wait-server && nodemon --watch src/client src/client/index.ts",
"dev": "run-p dev:* --print-label",
"start:server": "node dist/server/index.js",
"start:client": "yarn wait-server && node dist/client/index.js",
"start:client": "pnpm wait-server && node dist/client/index.js",
"start": "run-p start:* --print-label",
"test-dev": "start-server-and-test 'ts-node src/server' http-get://localhost:2022 'ts-node src/client'",
"test-start": "start-server-and-test 'node dist/server' http-get://localhost:2022 'node dist/client'"
Expand Down
8 changes: 4 additions & 4 deletions examples/.interop/lambda-api-gateway/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@
"typescript": "^4.8.3"
},
"scripts": {
"build": "yarn tsc",
"start-server": "npx serverless offline --httpPort 4050",
"start-client": "yarn ts-node src/client.ts",
"http-rest-client": "yarn ts-node src/payloadFormatVersionClient.ts"
"build": "tsc",
"start-server": "serverless offline --httpPort 4050",
"start-client": "ts-node src/client.ts",
"http-rest-client": "ts-node src/payloadFormatVersionClient.ts"
}
}
6 changes: 3 additions & 3 deletions examples/.interop/next-minimal-starter-migration/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@
"start": "next start"
},
"dependencies": {
"@tanstack/react-query": "^4.3.0",
"@tanstack/react-query": "^4.3.8",
"@trpc/client": "^10.0.0-proxy-beta.5",
"@trpc/next": "^10.0.0-proxy-beta.5",
"@trpc/react": "^10.0.0-proxy-beta.5",
"@trpc/server": "^10.0.0-proxy-beta.5",
"next": "^12.3.1",
"react": "^18.1.0",
"react-dom": "^18.1.0",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"zod": "^3.0.0"
},
"devDependencies": {
Expand Down
6 changes: 3 additions & 3 deletions examples/.interop/next-minimal-starter/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@
"start": "next start"
},
"dependencies": {
"@tanstack/react-query": "^4.3.0",
"@tanstack/react-query": "^4.3.8",
"@trpc/client": "^10.0.0-proxy-beta.5",
"@trpc/next": "^10.0.0-proxy-beta.5",
"@trpc/react": "^10.0.0-proxy-beta.5",
"@trpc/server": "^10.0.0-proxy-beta.5",
"next": "^12.3.1",
"react": "^18.1.0",
"react-dom": "^18.1.0",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"zod": "^3.0.0"
},
"devDependencies": {
Expand Down
Loading

0 comments on commit 18a2757

Please sign in to comment.