Skip to content

Commit d791fc5

Browse files
authored
Migrate to pnpm (#10818)
* Switch packageManager * Update lock and workspace files * Update root files * Migrate workflows to PNPM * Update examples and docs * Link exmaples codegen CLI to workspace version * Re-import yarn.lock * Remove explicit types default in validateTs function * Fix packageManager in CI * Correctly overrides typescript-eslint packages * Add dotenv package specifically for dev runs * Downgrade pnpm to work with node 20 (minimum support version) * Fix ci issues * Install root devDeps for dev-test * Fix installation in CI with frozen lockfile * Fix package issues for CI * Put FIXMEs to pass tests * Sync versions and fix cjs esm issues * Put pack dedupe lockfile * Fix lint * Fix website script, revert to TS 5.9.3 to match typescript-json-schema requirements * ESM-first * Prepare Cypress * More ESM-first * Prepare Cypress 2
1 parent bdf49dd commit d791fc5

104 files changed

Lines changed: 25766 additions & 16112 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/ISSUE_TEMPLATE/bug_report.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ body:
8080
After reading the [Contributor Workflow](https://github.com/the-guild-org/Stack/blob/master/CONTRIBUTING.md#a-typical-contributor-workflow), Check out and update the current state of this issue:
8181
8282
- [ ] 1. The issue provides a [minimal reproduction](https://stackoverflow.com/help/minimal-reproducible-example) available on [GitHub](https://github.com/dotansimha/graphql-code-generator-issue-sandbox-template), [Stackblitz](https://stackblitz.com/github/dotansimha/graphql-code-generator-issue-sandbox-template) or [CodeSandbox](https://codesandbox.io/s/github/dotansimha/graphql-code-generator-issue-sandbox-template).
83-
- _Make sure to fork this template and run `yarn generate` in the terminal._
83+
- _Make sure to fork this template and run `pnpm generate` in the terminal._
8484
- _Please make sure the Codegen and plugins version under `package.json` matches yours._
8585
- [ ] 2. A failing test has been provided
8686
- [ ] 3. A local solution has been provided

.github/workflows/main.yml

Lines changed: 33 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@ jobs:
2222
name: Linting Check
2323
uses: the-guild-org/shared-config/.github/workflows/lint.yml@f4eea983237a44bb0ca19c3348dacbfdfcdbec23 # main
2424
with:
25-
script: yarn ci:lint
25+
script: pnpm ci:lint
26+
packageManager: pnpm
2627
secrets:
2728
githubToken: ${{ secrets.GITHUB_TOKEN }}
2829
prettier-check:
@@ -33,8 +34,10 @@ jobs:
3334
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
3435
- name: Setup env
3536
uses: the-guild-org/shared-config/setup@f4eea983237a44bb0ca19c3348dacbfdfcdbec23 # main
37+
with:
38+
packageManager: pnpm
3639
- name: Prettier Check
37-
run: yarn prettier:check
40+
run: pnpm prettier:check
3841
dev-tests-old:
3942
name: Validating dev-tests
4043
runs-on: ubuntu-latest
@@ -48,13 +51,15 @@ jobs:
4851
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
4952
- name: Setup env
5053
uses: the-guild-org/shared-config/setup@f4eea983237a44bb0ca19c3348dacbfdfcdbec23 # main
54+
with:
55+
packageManager: pnpm
5156
- name: Build
52-
run: yarn build
57+
run: pnpm build
5358
env:
5459
CI: true
5560
- name: Test dev-tests ${{matrix.method}}
5661
run: |
57-
yarn run generate:examples:${{matrix.method}}
62+
pnpm run generate:examples:${{matrix.method}}
5863
git diff --exit-code -- dev-test/
5964
dev-tests:
6065
name: Examples - Normal
@@ -64,20 +69,28 @@ jobs:
6469
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
6570
- name: Setup env
6671
uses: the-guild-org/shared-config/setup@f4eea983237a44bb0ca19c3348dacbfdfcdbec23 # main
72+
with:
73+
packageManager: pnpm
74+
- name: Prepare Cypress
75+
run: |
76+
pnpm store prune
77+
pnpm config set side-effects-cache false --location project
78+
pnpm rm -rf node_modules
79+
pnpm i
6780
- name: Build
68-
run: yarn build
81+
run: pnpm build
6982
env:
7083
CI: true
7184
- name: Generate and Diff Codegen Artifacts
7285
run: |
73-
EXAMPLE_TYPE=normal yarn examples:codegen
86+
EXAMPLE_TYPE=normal pnpm examples:codegen
7487
git diff --exit-code -- examples/
7588
- name: Build Examples
7689
run: |
77-
EXAMPLE_TYPE=normal yarn examples:build
90+
EXAMPLE_TYPE=normal pnpm examples:build
7891
- name: End2End Test Examples
7992
run: |
80-
EXAMPLE_TYPE=normal yarn examples:test:end2end
93+
EXAMPLE_TYPE=normal pnpm examples:test:end2end
8194
8295
# TODO: Remove all SWC test setup and references as that has been moved to https://github.com/swc-project/plugins/tree/main/contrib/graphql-codegen-client-preset
8396
# dev-tests-swc:
@@ -120,12 +133,14 @@ jobs:
120133
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
121134
- name: Setup env
122135
uses: the-guild-org/shared-config/setup@f4eea983237a44bb0ca19c3348dacbfdfcdbec23 # main
136+
with:
137+
packageManager: pnpm
123138
- name: Build
124-
run: yarn build
139+
run: pnpm build
125140
env:
126141
CI: true
127142
- name: Test ESM & CJS integrity
128-
run: yarn bob check
143+
run: pnpm bob check
129144
test:
130145
name:
131146
Unit Test on Node ${{matrix.node_version}} (${{matrix.os}}) and GraphQL
@@ -151,15 +166,16 @@ jobs:
151166
uses: the-guild-org/shared-config/setup@f4eea983237a44bb0ca19c3348dacbfdfcdbec23 # main
152167
with:
153168
nodeVersion: ${{matrix.node_version}}
169+
packageManager: pnpm
154170
- name: Use GraphQL v${{matrix.graphql_version}}
155171
run: node ./scripts/match-graphql.js ${{matrix.graphql_version}}
156172
- name: Install Dependencies
157-
run: yarn
173+
run: pnpm i --no-frozen-lockfile
158174
- name: Build
159-
run: yarn build
175+
run: pnpm build
160176
- name: Test
161177
# FIXME: Do not test `watcher.run.spec.ts` here because it is currently not working for Node22+ in Ubuntu
162-
run: yarn test --exclude="**/tests/watcher.run.spec.ts"
178+
run: pnpm test --exclude="**/tests/watcher.run.spec.ts"
163179
env:
164180
CI: true
165181

@@ -188,15 +204,16 @@ jobs:
188204
uses: the-guild-org/shared-config/setup@f4eea983237a44bb0ca19c3348dacbfdfcdbec23 # main
189205
with:
190206
nodeVersion: ${{matrix.node_version}}
207+
packageManager: pnpm
191208
- name: Use GraphQL v${{matrix.graphql_version}}
192209
run: node ./scripts/match-graphql.js ${{matrix.graphql_version}}
193210
- name: Install Dependencies
194-
run: yarn
211+
run: pnpm i --no-frozen-lockfile
195212
- name: Build
196-
run: yarn build
213+
run: pnpm build
197214
- name: Test
198215
# FIXME: Merge `watcher.run.spec.ts` test to the above when it works for Node22+ in Ubuntu
199-
run: yarn test packages/graphql-codegen-cli/tests/watcher.run.spec.ts
216+
run: pnpm test packages/graphql-codegen-cli/tests/watcher.run.spec.ts
200217
env:
201218
CI: true
202219

.github/workflows/pr.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ jobs:
2626
with:
2727
npmTag: alpha
2828
buildScript: build
29+
packageManager: pnpm
2930
secrets:
3031
githubToken: ${{ secrets.GITHUB_TOKEN }}
3132
npmToken: ${{ secrets.NPM_TOKEN }}
@@ -37,6 +38,7 @@ jobs:
3738
npmTag: rc
3839
restoreDeletedChangesets: true
3940
buildScript: build
41+
packageManager: pnpm
4042
secrets:
4143
githubToken: ${{ secrets.GITHUB_TOKEN }}
4244
npmToken: ${{ secrets.NPM_TOKEN }}

.github/workflows/release.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,5 @@ jobs:
1414
with:
1515
releaseScript: release
1616
secrets:
17-
# githubToken: ${{ secrets.GUILD_BOT_TOKEN }}
1817
githubToken: ${{ secrets.GITHUB_TOKEN }}
1918
npmToken: ${{ secrets.NPM_TOKEN }}

.github/workflows/website-integrity.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,14 @@ jobs:
2020

2121
- name: Setup env
2222
uses: the-guild-org/shared-config/setup@f4eea983237a44bb0ca19c3348dacbfdfcdbec23 # main
23+
with:
24+
packageManager: pnpm
2325

2426
- name: Build Packages
25-
run: yarn build
27+
run: pnpm build
2628

2729
- name: Build Website
28-
run: yarn workspace website run build
30+
run: pnpm --filter=website run build
2931

3032
- name: Compare
3133
run: git diff origin/${{ github.base_ref }}.. -- website/route-lockfile.txt

.github/workflows/website.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ jobs:
2626

2727
- uses: the-guild-org/shared-config/setup@f4eea983237a44bb0ca19c3348dacbfdfcdbec23 # main
2828
name: setup env
29+
with:
30+
packageManager: pnpm
2931

3032
- uses: the-guild-org/shared-config/website-cf@f4eea983237a44bb0ca19c3348dacbfdfcdbec23 # main
3133
name: build and deploy website
@@ -41,5 +43,5 @@ jobs:
4143
projectName: graphql-code-generator
4244
prId: ${{ github.event.pull_request.number }}
4345
websiteDirectory: ./
44-
buildScript: yarn build && cd website && yarn build
46+
buildScript: pnpm build && cd website && pnpm build
4547
artifactDir: website/out

.gitignore

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
.idea/
22
.npmrc
3-
.yarnclean
43
.DS_Store
54
coverage
65
*.log
@@ -12,7 +11,6 @@ dist/
1211
out.txt
1312
.cache
1413
tsconfig.tsbuildinfo
15-
.yarn/
1614
recompile.sh
1715

1816
.next/

.husky/pre-commit

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
yarn lint-staged
1+
pnpm lint-staged

.prettierignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ build/
88
CHANGELOG.md
99
.husky/_/
1010
.changeset/*.md
11+
pnpm-lock.yaml
1112

1213
# temporarily ignore follow files because prettier-ignore comments don't work in mdx2
1314
# see https://github.com/prettier/prettier/pull/12208

.yarnrc

Lines changed: 0 additions & 2 deletions
This file was deleted.

0 commit comments

Comments
 (0)