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

Switching to pnpm #2428

Draft
wants to merge 67 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 50 commits
Commits
Show all changes
67 commits
Select commit Hold shift + click to select a range
e5230ed
Migrating lock file and workspaces to PNPM 10.
RobinTail Feb 21, 2025
b488446
Using pnpm -F for workspaces.
RobinTail Feb 21, 2025
ef5381b
Installing linting dependencies to the root.
RobinTail Feb 21, 2025
d12037e
Enabling Corepack for CI.
RobinTail Feb 21, 2025
7e8e458
Using pnpm cache by setup node action.
RobinTail Feb 21, 2025
5786a8d
mv corepack before node setup.
RobinTail Feb 21, 2025
d11f606
temp: no cache.
RobinTail Feb 21, 2025
26825bb
Changing pm in CI.
RobinTail Feb 21, 2025
7ad3e72
Fixed dependencies for running tests.
RobinTail Feb 21, 2025
117b1fa
Address corepack integrity issue: rm sha.
RobinTail Feb 21, 2025
0342d83
Revert "Address corepack integrity issue: rm sha."
RobinTail Feb 21, 2025
da5104b
Temp: Disabling corepack integrity keys.
RobinTail Feb 21, 2025
259ec80
Fixing non-portable types for DTS build.
RobinTail Feb 21, 2025
5da7161
Fix postbuild ATTW.
RobinTail Feb 21, 2025
1a0b2d6
Replacing yarn in several commands.
RobinTail Feb 21, 2025
7bf9b29
Add cross workspace reference to example (fixes build).
RobinTail Feb 21, 2025
968e099
Add undici dev dep to example test.
RobinTail Feb 21, 2025
d0a8db5
Add cross ws ref to intergration tests.
RobinTail Feb 21, 2025
3e5b7af
Fix env for the test of issue 952.
RobinTail Feb 21, 2025
441fa39
Update validations.yml
RobinTail Feb 21, 2025
48472b9
Update validations.yml
RobinTail Feb 21, 2025
769132b
Update validations.yml
RobinTail Feb 21, 2025
7cf5697
Update validations.yml
RobinTail Feb 21, 2025
24f10cb
Using working dir approach due to pnpm bug.
RobinTail Feb 21, 2025
d2719b7
Add corepack to compat test.
RobinTail Feb 21, 2025
ae44d07
Fix corepack keys for compat test.
RobinTail Feb 21, 2025
58b83d9
Using parser dependency in compat test.
RobinTail Feb 21, 2025
5b8f536
And utils in compat test.
RobinTail Feb 21, 2025
0c386d1
Replacing last yarn commands with pnpm, incl. contributing guide.
RobinTail Feb 22, 2025
23e21b0
Hoist @typescript-eslint/* and @vitest/* publicly.
RobinTail Feb 22, 2025
a310ad4
Publicly hoisting @eslint/* and globals.
RobinTail Feb 22, 2025
bfbb46b
Correcting deps upgtade CI.
RobinTail Feb 22, 2025
a592eb2
Correcting publishing command in CI.
RobinTail Feb 22, 2025
e4f6781
REF: using lastest corepack instead of disabling key integrity check.
RobinTail Feb 22, 2025
b7db89a
Add corepack to the rest of the CI workflows.
RobinTail Feb 22, 2025
a848f46
Merge branch 'master' into try-pnpm-again
RobinTail Feb 22, 2025
b85fc9c
Trying pnpm/action-setup instead of corepack to enable cache in CI by…
RobinTail Feb 22, 2025
c034dfc
Replacing corepack in the rest of the CI workflows.
RobinTail Feb 22, 2025
a1eedab
Compat test can actually have yarn.
RobinTail Feb 22, 2025
992b22f
Merge branch 'master' into try-pnpm-again
RobinTail Feb 23, 2025
1dd70af
rm self ref in eslint config for allowed deps.
RobinTail Feb 23, 2025
f8ea6d3
Fix dependencies for headers tool.
RobinTail Feb 23, 2025
0cd3a09
Merge branch 'master' into try-pnpm-again
RobinTail Feb 23, 2025
2a6ea63
Merge branch 'master' into try-pnpm-again
RobinTail Feb 23, 2025
dfc8a97
Merge branch 'master' into try-pnpm-again
RobinTail Feb 24, 2025
d8aa58f
Merge branch 'master' into try-pnpm-again
RobinTail Feb 24, 2025
0dbf8fe
FIX: DTS build for server functions without type reassignment.
RobinTail Feb 24, 2025
048f6ef
Rev: type assertions in testing.
RobinTail Feb 24, 2025
47ff82b
Reducing diff for testing.
RobinTail Feb 24, 2025
01b02cc
Ref: moving qs fix into index entrypoint.
RobinTail Feb 24, 2025
b1cdbfc
rm dev dependencies in 952 test.
RobinTail Feb 24, 2025
aa6095b
Merge branch 'master' into try-pnpm-again
RobinTail Feb 24, 2025
c984fa7
Using exec workaround for versioning CI.
RobinTail Feb 24, 2025
94fac22
Fix version command in CI.
RobinTail Feb 24, 2025
f20cd39
Using working directory because postversion fires too early.
RobinTail Feb 24, 2025
a5a65b6
Having to use npm instead.
RobinTail Feb 24, 2025
3be2453
Trying bumpp.
RobinTail Feb 24, 2025
1794d24
Trying bumpp.
RobinTail Feb 24, 2025
843f123
chore: release v22.12.0-beta.1
github-actions[bot] Feb 24, 2025
2753089
Using npm for publishing.
RobinTail Feb 24, 2025
d9eb03d
Trying pnpm dlx for versioning.
RobinTail Feb 24, 2025
44093e9
Revert "Trying pnpm dlx for versioning."
RobinTail Feb 24, 2025
ec717c0
Merge branch 'master' into try-pnpm-again
RobinTail Feb 25, 2025
ba05a44
Merge branch 'master' into try-pnpm-again
RobinTail Feb 25, 2025
fc110a8
Fix express resolution to v5 when running pnpm upgrade.
RobinTail Feb 25, 2025
6248647
Include root workspace to the dependencies upgrading CI.
RobinTail Feb 25, 2025
e4f1840
Add deduplication command to the dependencies upgrading workflow.
RobinTail Feb 25, 2025
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
8 changes: 5 additions & 3 deletions .github/workflows/beta.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,13 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
- uses: actions/setup-node@v4
with:
node-version: 20
cache: pnpm
- uses: fregante/setup-git-user@v2
- run: |
yarn install
yarn install_hooks
- run: yarn workspace express-zod-api version --pre${{ inputs.kind }} --preid beta
pnpm install
pnpm install_hooks
- run: pnpm -F express-zod-api version --pre${{ inputs.kind }} --preid beta
10 changes: 5 additions & 5 deletions .github/workflows/dependencies.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,18 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v4

- uses: pnpm/action-setup@v4

- uses: actions/setup-node@v4
with:
node-version: 20
cache: pnpm

- name: Install dependencies
run: yarn install
run: pnpm install

- name: Upgrade dependencies
run: |
yarn workspace express-zod-api upgrade
git checkout -- express-zod-api/package.json
yarn install
run: pnpm -F express-zod-api upgrade

- name: Branch name
id: create-branch
Expand Down
6 changes: 4 additions & 2 deletions .github/workflows/headers.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,18 @@ jobs:
fetch-depth: 0 # to figure out last change to the json file

- uses: fregante/setup-git-user@v2
- uses: pnpm/action-setup@v4

- uses: actions/setup-node@v4
with:
node-version: 20
cache: pnpm

- name: Install dependencies
run: yarn install
run: pnpm install

- name: Check for new headers on IANA.ORG
run: yarn tsx tools/headers.ts
run: pnpm tsx tools/headers.ts

- name: Check for changes
id: git-state
Expand Down
8 changes: 5 additions & 3 deletions .github/workflows/minor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,13 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
- uses: actions/setup-node@v4
with:
node-version: 20
cache: pnpm
- uses: fregante/setup-git-user@v2
- run: |
yarn install
yarn install_hooks
- run: yarn workspace express-zod-api version --minor
pnpm install
pnpm install_hooks
- run: pnpm -F express-zod-api version --minor
29 changes: 10 additions & 19 deletions .github/workflows/node.js.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,29 +18,20 @@ jobs:
node-version: [20.9.0, 20.x, 22.0.0, 22.x]
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/
steps:
- name: Get yarn cache dir
id: yarnCache
run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT
- name: Checkout
uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
- name: Install Node.js ${{ matrix.node-version }}
id: setup-node
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
- name: Cache node modules
uses: actions/cache@v4
env:
cache-name: cache-yarn
with:
path: ${{ steps.yarnCache.outputs.dir }}
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ matrix.node-version }}-${{ hashFiles('**/yarn.lock') }}
cache: pnpm
- name: Install dependencies
run: yarn install
run: pnpm install
- name: Lint
run: yarn lint
run: pnpm lint
- name: Unit tests
run: yarn test
run: pnpm test
- name: Coveralls
uses: coverallsapp/github-action@v2
continue-on-error: true
Expand All @@ -49,15 +40,15 @@ jobs:
flag-name: run-${{ matrix.node-version }}
parallel: true
- name: Build
run: yarn build
run: pnpm build
- name: Example test
run: yarn test:example
run: pnpm test:example
- name: CJS test
run: yarn test:cjs
run: pnpm test:cjs
- name: ESM test
run: yarn test:esm
run: pnpm test:esm
- name: Issue 952 # see https://github.com/RobinTail/express-zod-api/issues/952
run: yarn test:952
run: pnpm test:952
report:
needs: build
runs-on: ubuntu-latest
Expand Down
6 changes: 4 additions & 2 deletions .github/workflows/npm-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,15 @@ jobs:
id-token: write
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
- uses: actions/setup-node@v4
with:
node-version: 20
cache: pnpm
registry-url: https://registry.npmjs.org/
- name: Install dependencies
run: yarn install
run: pnpm install
- name: Publish with ${{ inputs.tag }}
run: npm publish -w express-zod-api --provenance --tag ${{ inputs.tag }}
run: pnpm -F express-zod-api publish --provenance --tag ${{ inputs.tag }}
env:
NODE_AUTH_TOKEN: ${{secrets.NPM_KEY}}
8 changes: 5 additions & 3 deletions .github/workflows/patch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,13 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
- uses: actions/setup-node@v4
with:
node-version: 20
cache: pnpm
- uses: fregante/setup-git-user@v2
- run: |
yarn install
yarn install_hooks
- run: yarn workspace express-zod-api version --patch
pnpm install
pnpm install_hooks
- run: pnpm -F express-zod-api version --patch
16 changes: 10 additions & 6 deletions .github/workflows/validations.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,21 @@ jobs:
# uses: char0n/apidom-validate@v1
# with:
# definition-file: example/example.documentation.yaml
- uses: pnpm/action-setup@v4
- uses: actions/setup-node@v4
with:
node-version: 20
- run: yarn install
- run: yarn test:oas
- name: Build distribution
run: yarn workspace express-zod-api build
cache: pnpm
- name: Install dependencies
run: pnpm install
- run: pnpm test:oas
- name: Build tests
run: yarn postbuild # builds the tests
run: pnpm postbuild # builds the tests
- name: Build distribution
run: pnpm -F express-zod-api build
- name: Pack artifact
run: yarn workspace express-zod-api pack --filename ../compat-test/dist.tgz
working-directory: express-zod-api # https://github.com/pnpm/pnpm/issues/4351
run: pnpm pack --out ../compat-test/dist.tgz
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
Expand Down
2 changes: 0 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@ node_modules
dist
*.tgz
migration
yarn-error.log
.idea
.npmrc
coverage
*-test/quick-start.ts
issue952-test/*.d.ts
Expand Down
2 changes: 1 addition & 1 deletion .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1 +1 @@
yarn precommit
pnpm precommit
6 changes: 6 additions & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
public-hoist-pattern[]=@typescript-eslint/*
public-hoist-pattern[]=@vitest/*
public-hoist-pattern[]=@eslint/*
public-hoist-pattern[]=globals
public-hoist-pattern[]=@types/qs
public-hoist-pattern[]=@types/express-serve-static-core
8 changes: 4 additions & 4 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ Which is highly appreciated as well. Consider these steps:

- Fork the repo,
- Create a new branch in your fork of the repo (don't change `master`),
- Install the dependencies using `yarn`,
- Install the pre-commit hooks using `yarn install_hooks`,
- Install the dependencies using `pnpm i`,
- Install the pre-commit hooks using `pnpm install_hooks`,
- Make changes,
- Run the tests using `yarn test`,
- In case you wanna run tests from `example` and `*-test` workspaces, run `yarn build` first.
- Run the tests using `pnpm test`,
- In case you wanna run tests from `example` and `*-test` workspaces, run `pnpm build` first.
- Commit everything,
- Push your branch into your fork,
- Create a PR between the forks:
Expand Down
3 changes: 3 additions & 0 deletions cjs-test/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,8 @@
"version": "0.0.0",
"scripts": {
"test": "vitest run --globals"
},
"dependencies": {
"express-zod-api": "workspace:*"
}
}
3 changes: 3 additions & 0 deletions esm-test/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,8 @@
"type": "module",
"scripts": {
"test": "vitest run --globals"
},
"dependencies": {
"express-zod-api": "workspace:*"
}
}
6 changes: 4 additions & 2 deletions example/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,18 @@
"type": "module",
"scripts": {
"start": "tsx index.ts",
"build": "yarn build:docs && yarn build:client",
"build": "pnpm build:docs && pnpm build:client",
"build:docs": "tsx generate-documentation.ts",
"build:client": "tsx generate-client.ts",
"test": "vitest run --globals index.spec.ts",
"validate": "vitest run --globals validate.spec.ts"
},
"dependencies": {
"express-zod-api": "workspace:*",
"swagger-ui-express": "^5.0.0"
},
"devDependencies": {
"@types/swagger-ui-express": "^4.1.8"
"@types/swagger-ui-express": "^4.1.8",
"undici": "^6.19.8"
}
}
7 changes: 3 additions & 4 deletions express-zod-api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@
"funding": "https://github.com/sponsors/RobinTail",
"scripts": {
"build": "tsup",
"postbuild": "yarn pack --filename release.tgz && attw release.tgz && rm release.tgz",
"postbuild": "attw --pack",
"pretest": "tsc --noEmit",
"test": "vitest run --coverage",
"bench": "vitest bench --run ./bench",
"prepublishOnly": "eslint && yarn test && yarn build",
"prepublishOnly": "eslint && pnpm test && pnpm build",
"prepack": "cp ../*.md ../LICENSE ./",
"postversion": "git push && git push --tags"
},
Expand Down Expand Up @@ -135,6 +135,5 @@
"swagger-documentation",
"zod",
"validation"
],
"packageManager": "yarn@1.22.22+sha1.ac34549e6aa8e7ead463a7407e1c7390f61a6610"
]
}
1 change: 1 addition & 0 deletions express-zod-api/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ export type { LoggerOverrides } from "./logger-helpers";
export type { TagOverrides } from "./common-helpers";

// Issues 952, 1182, 1269: Insufficient exports for consumer's declaration
import type {} from "qs"; // fixes TS2742 for attachRouting
export type { Routing } from "./routing";
export type { FlatObject } from "./common-helpers";
export type { Method } from "./method";
Expand Down
9 changes: 9 additions & 0 deletions issue952-test/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,14 @@
"scripts": {
"test": "tsc -p tsconfig.json",
"posttest": "rm *.d.ts"
},
"dependencies": {
"express-zod-api": "workspace:*",
"express": "^5.0.1",
"express-fileupload": "^1.5.1"
},
"devDependencies": {
"@types/express": "^5.0.0",
"@types/express-fileupload": "^1.5.1"
}
}
35 changes: 14 additions & 21 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,36 +1,29 @@
{
"private": true,
"type": "module",
"workspaces": [
"express-zod-api",
"example",
"cjs-test",
"esm-test",
"issue952-test"
],
"scripts": {
"start": "yarn workspace example start",
"start": "pnpm -F example start",
"prebuild": "tsx tools/contributors.ts && tsx tools/license.ts",
"build": "yarn workspace express-zod-api build && yarn workspace example build",
"build": "pnpm -F express-zod-api build && pnpm -F example build",
"postbuild": "tsx tools/make-tests.ts",
"test": "yarn workspace express-zod-api test",
"test:example": "yarn workspace example test",
"test:oas": "yarn workspace example validate",
"test:cjs": "yarn workspace cjs-test test",
"test:esm": "yarn workspace esm-test test",
"test:952": "yarn workspace issue952-test test",
"bench": "yarn workspace express-zod-api bench",
"test": "pnpm -F express-zod-api test",
"test:example": "pnpm -F example test",
"test:oas": "pnpm -F example validate",
"test:cjs": "pnpm -F cjs-test test",
"test:esm": "pnpm -F esm-test test",
"test:952": "pnpm -F issue952-test test",
"bench": "pnpm -F express-zod-api bench",
"lint": "eslint && prettier *.md --check",
"mdfix": "prettier *.md --write",
"precommit": "yarn lint && yarn test && yarn build && git add *.md example/example.* LICENSE",
"precommit": "pnpm lint && pnpm test && pnpm build && git add *.md example/example.* LICENSE",
"install_hooks": "husky"
},
"devDependencies": {
"@tsconfig/node20": "^20.1.4",
"@types/compression": "^1.7.5",
"@types/http-errors": "^2.0.2",
"@types/express": "^5.0.0",
"@types/express-fileupload": "^1.5.0",
"@types/http-errors": "^2.0.2",
"@types/node": "^22.13.5",
"@typescript-eslint/rule-tester": "^8.24.1",
"@vitest/coverage-v8": "^3.0.6",
Expand All @@ -51,8 +44,8 @@
"zod": "^3.23.0"
},
"resolutions": {
"**/@scarf/scarf": "npm:empty-npm-package@1.0.0",
"**/esbuild": "~0.25.0"
"@scarf/scarf": "npm:empty-npm-package@1.0.0",
"esbuild": "~0.25.0"
},
"packageManager": "yarn@1.22.22+sha1.ac34549e6aa8e7ead463a7407e1c7390f61a6610"
"packageManager": "pnpm@10.4.1+sha512.c753b6c3ad7afa13af388fa6d808035a008e30ea9993f58c6663e2bc5ff21679aa834db094987129aa4d488b86df57f7b634981b2f827cdcacc698cc0cfb88af"
}
Loading