Skip to content

Commit e364320

Browse files
authored
chore: Modernize stack (#276)
* chore: Modernize stack Big refactor to cleanup everything: * Migrate to pnpm with corepack * Migrate to vitest * Bump all dependencies * Add `pnpm check` to check lint, prettier and typecheck * Apply prettier to the entire codebase * Update example with latest version (and using pnpm workspace) * Undo trailing space rule from prettier
1 parent e60ee78 commit e364320

File tree

80 files changed

+189350
-82322
lines changed

Some content is hidden

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

80 files changed

+189350
-82322
lines changed

.all-contributorsrc

Lines changed: 12 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,7 @@
33
"projectOwner": "fabien0102",
44
"repoType": "github",
55
"repoHost": "https://github.com",
6-
"files": [
7-
"README.md"
8-
],
6+
"files": ["README.md"],
97
"imageSize": 100,
108
"commit": false,
119
"commitConvention": "none",
@@ -29,108 +27,77 @@
2927
"name": "mpotomin",
3028
"avatar_url": "https://avatars.githubusercontent.com/u/639406?v=4",
3129
"profile": "https://github.com/mpotomin",
32-
"contributions": [
33-
"code",
34-
"ideas",
35-
"review"
36-
]
30+
"contributions": ["code", "ideas", "review"]
3731
},
3832
{
3933
"login": "micha-f",
4034
"name": "Michael Franzkowiak",
4135
"avatar_url": "https://avatars.githubusercontent.com/u/200647?v=4",
4236
"profile": "https://github.com/micha-f",
43-
"contributions": [
44-
"doc"
45-
]
37+
"contributions": ["doc"]
4638
},
4739
{
4840
"login": "SferaDev",
4941
"name": "Alexis Rico",
5042
"avatar_url": "https://avatars.githubusercontent.com/u/2181866?v=4",
5143
"profile": "https://github.com/SferaDev",
52-
"contributions": [
53-
"code",
54-
"ideas"
55-
]
44+
"contributions": ["code", "ideas"]
5645
},
5746
{
5847
"login": "needim",
5948
"name": "Nedim Arabacı",
6049
"avatar_url": "https://avatars.githubusercontent.com/u/271912?v=4",
6150
"profile": "https://ned.im/",
62-
"contributions": [
63-
"question",
64-
"code",
65-
"ideas"
66-
]
51+
"contributions": ["question", "code", "ideas"]
6752
},
6853
{
6954
"login": "antoniel",
7055
"name": "Antoniel Magalhães",
7156
"avatar_url": "https://avatars.githubusercontent.com/u/17225358?v=4",
7257
"profile": "https://github.com/antoniel",
73-
"contributions": [
74-
"example",
75-
"bug"
76-
]
58+
"contributions": ["example", "bug"]
7759
},
7860
{
7961
"login": "DreierF",
8062
"name": "Florian Dreier",
8163
"avatar_url": "https://avatars.githubusercontent.com/u/5631865?v=4",
8264
"profile": "https://github.com/DreierF",
83-
"contributions": [
84-
"code"
85-
]
65+
"contributions": ["code"]
8666
},
8767
{
8868
"login": "el-j",
8969
"name": "Fabian Althaus",
9070
"avatar_url": "https://avatars.githubusercontent.com/u/2795534?v=4",
9171
"profile": "http://fabianalthaus.de",
92-
"contributions": [
93-
"code"
94-
]
72+
"contributions": ["code"]
9573
},
9674
{
9775
"login": "ci-vamp",
9876
"name": "ci-vamp",
9977
"avatar_url": "https://avatars.githubusercontent.com/u/116516277?v=4",
10078
"profile": "https://github.com/ci-vamp",
101-
"contributions": [
102-
"bug",
103-
"code"
104-
]
79+
"contributions": ["bug", "code"]
10580
},
10681
{
10782
"login": "alan-oliv",
10883
"name": "Alan Oliveira",
10984
"avatar_url": "https://avatars.githubusercontent.com/u/4368481?v=4",
11085
"profile": "https://twitter.com/oalanoliv",
111-
"contributions": [
112-
"code"
113-
]
86+
"contributions": ["code"]
11487
},
11588
{
11689
"login": "Cellule",
11790
"name": "Michael \"Mike\" Ferris",
11891
"avatar_url": "https://avatars.githubusercontent.com/u/4157103?v=4",
11992
"profile": "https://github.com/Cellule",
120-
"contributions": [
121-
"code"
122-
]
93+
"contributions": ["code"]
12394
},
12495
{
12596
"login": "rajzik",
12697
"name": "Jan Šilhan",
12798
"avatar_url": "https://avatars.githubusercontent.com/u/10364836?v=4",
12899
"profile": "https://github.com/rajzik",
129-
"contributions": [
130-
"bug",
131-
"code",
132-
"doc"
133-
]
100+
"contributions": ["bug", "code", "doc"]
134101
}
135102
],
136103
"contributorsPerLine": 7

.eslintrc.js

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

.github/workflows/release-please.yaml

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,19 +20,22 @@ jobs:
2020

2121
# The logic below handles the npm publication:
2222
- name: Checkout Repository
23-
if: ${{ steps.release.outputs.releases_created }}
2423
uses: actions/checkout@v4
24+
if: ${{ steps.release.outputs.releases_created }}
25+
- name: Install pnpm
26+
uses: pnpm/action-setup@v4
27+
if: ${{ steps.release.outputs.releases_created }}
2528
- name: Setup Node
2629
uses: actions/setup-node@v4
2730
if: ${{ steps.release.outputs.releases_created }}
2831
with:
29-
node-version: latest
32+
node-version: 20
3033
registry-url: "https://registry.npmjs.org"
3134
- name: Build Packages
3235
if: ${{ steps.release.outputs.releases_created }}
3336
run: |
34-
npm ci
35-
npm run build:all
37+
pnpm install
38+
pnpm build
3639
3740
# Release Please has already incremented versions and published tags, so we just
3841
# need to publish all unpublished versions to NPM here

.github/workflows/tests.yaml

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,18 @@ jobs:
1414
test:
1515
runs-on: ubuntu-latest
1616
steps:
17-
- uses: actions/checkout@v4
18-
- uses: actions/setup-node@v4
17+
- name: Checkout branch
18+
uses: actions/checkout@v4
19+
- name: Install pnpm
20+
uses: pnpm/action-setup@v4
21+
- name: Use Node.js 20
22+
uses: actions/setup-node@v4
1923
with:
20-
node-version: latest
21-
- run: npm ci
22-
- run: npm test
24+
node-version: 20
25+
cache: "pnpm"
26+
- name: Install dependencies
27+
run: pnpm install
28+
- name: Check types, linting and code style
29+
run: pnpm check
30+
- name: Run tests
31+
run: pnpm test

.prettierignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
pnpm-lock.yaml

.prettierrc.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"trailingComma": "es5"
3+
}

README.md

Lines changed: 54 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
```bash
3636
npx @openapi-codegen/cli init
3737
```
38-
38+
3939
<img style="max-width: 400px" src="https://user-images.githubusercontent.com/271912/194000679-5a4501b8-5fc0-430c-9217-028bf91a5dcd.gif">
4040

4141
If you wish to change any of the selections made, you can do so in the generated `openapi-codegen.config.ts` file later..
@@ -45,6 +45,7 @@
4545
```bash
4646
npx openapi-codegen gen {namespace}
4747
```
48+
4849
After the code generation is done, you will notice the following files:
4950

5051
- `{namespace}Fetcher.ts` - defines a function that will make requests to your API.
@@ -72,9 +73,9 @@
7273

7374
- Install the library
7475

75-
```bash
76-
npm i @tanstack/react-query
77-
```
76+
```bash
77+
npm i @tanstack/react-query
78+
```
7879

7980
- Wire up the `QueryClient` as described [here](https://tanstack.com/query/v4/docs/adapters/react-query).
8081

@@ -211,67 +212,67 @@ the `@openapi-codegen/cli` supports these generator plugins:
211212
212213
#### **generateSchemaTypes** (frontend/backend)
213214
214-
generate all schema types for your specification:
215-
216-
```ts
217-
const { schemasFiles } = await generateSchemaTypes(context, {
218-
/* config */
219-
});
220-
```
221-
215+
generate all schema types for your specification:
216+
217+
```ts
218+
const { schemasFiles } = await generateSchemaTypes(context, {
219+
/* config */
220+
});
221+
```
222+
222223
output: `{namespace}Schemas.ts`
223224
224225
#### **generateFetchers** (frontend)
225226
226-
generate all fetchers with types for your specification _needs schemafiles_
227-
228-
```ts
229-
await generateFetchers(context, {
230-
/* config */
231-
schemasFiles,
232-
});
233-
```
234-
227+
generate all fetchers with types for your specification _needs schemafiles_
228+
229+
```ts
230+
await generateFetchers(context, {
231+
/* config */
232+
schemasFiles,
233+
});
234+
```
235+
235236
output: `{namespace}Fetchers.ts`
236237
237238
#### **generateReactQueryComponents** (frontend)
238239
239-
generate all React Query Components for useQuery() and useMutation()
240-
241-
```ts
242-
await generateReactQueryComponents(context, {
243-
/* config*/
244-
schemasFiles,
245-
});
246-
```
247-
248-
output: `{namespace}Components.ts`
249-
240+
generate all React Query Components for useQuery() and useMutation()
241+
242+
```ts
243+
await generateReactQueryComponents(context, {
244+
/* config*/
245+
schemasFiles,
246+
});
247+
```
248+
249+
output: `{namespace}Components.ts`
250+
250251
#### **generateReactQueryFunctions** (frontend)
251252
252-
generate all React Query Functions used for e.g. React-Router 6.6.0+ loader functions
253-
254-
```ts
255-
await generateReactQueryFunctions(context, {
256-
filenamePrefix,
257-
schemasFiles,
258-
});
259-
```
260-
261-
output: `{namespace}Functions.ts`
253+
generate all React Query Functions used for e.g. React-Router 6.6.0+ loader functions
262254
263-
example usage in react-route-loader:
264-
265-
```ts
266-
export const routeLoader = (queryClient: QueryClient) =>
267-
async ({ params }: MyParams) =>
268-
await queryClient.fetchQuery(...getYourQueryNameQuery({}), {
269-
/*options*/
270-
})
271-
```
272-
273-
_more infos: https://reactrouter.com/en/main/guides/data-libs_
255+
```ts
256+
await generateReactQueryFunctions(context, {
257+
filenamePrefix,
258+
schemasFiles,
259+
});
260+
```
261+
262+
output: `{namespace}Functions.ts`
263+
264+
example usage in react-route-loader:
265+
266+
```ts
267+
export const routeLoader =
268+
(queryClient: QueryClient) =>
269+
async ({ params }: MyParams) =>
270+
await queryClient.fetchQuery(...getYourQueryNameQuery({}), {
271+
/*options*/
272+
});
273+
```
274274
275+
_more infos: https://reactrouter.com/en/main/guides/data-libs_
275276
276277
You can import any generator into the `to` section, those can be the ones provided by this project or your own custom ones. You have full control of what you are generating!
277278

0 commit comments

Comments
 (0)