Skip to content

Commit b15dfec

Browse files
author
Filip Trplan
authored
feat: Migrate to autogenerated OpenAPI client (#112)
* feat: add openapi client generation * feat: add openapi generated API * feat: migrate library to backend api * feat: migrate single item page * feat: migrate season page * chore: add auto-generated client to the ignore for linting * refactor: format and lint * feat: add backend proxy * feat: add status code forwarding to the proxy * refactor: lint * feat: migrate summary page * refactor: add type to summary page loader * feat: migrate settings to api * feat: add settings type schema * feat: migrate onboarding to new client * feat: migrate item request to new client * feat: remove the old api routes * refactor: lint * refactor: move client into lib * fix: update path for generating the client * fix: fix imports on hooks
1 parent 975a339 commit b15dfec

Some content is hidden

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

41 files changed

+6659
-836
lines changed

.prettierignore

+2-1
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,5 @@ pnpm-lock.yaml
33
package-lock.json
44
yarn.lock
55
CHANGELOG.md
6-
.idea
6+
.idea
7+
src/lib/client/

eslint.config.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,6 @@ export default [
4848
}
4949
},
5050
{
51-
ignores: ['build/', '.svelte-kit/', 'dist/', 'src/lib/components/ui/', '.idea/']
51+
ignores: ['build/', '.svelte-kit/', 'dist/', 'src/lib/components/ui/', '.idea/', 'src/client/']
5252
}
5353
];

openapi-ts.config.ts

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import { defineConfig } from '@hey-api/openapi-ts';
2+
3+
export default defineConfig({
4+
client: '@hey-api/client-fetch',
5+
input: 'http://localhost:8080/openapi.json',
6+
output: 'src/lib/client',
7+
services: {
8+
// This does not suppport tree-shaking and could lead to a larger bundle size
9+
asClass: true
10+
}
11+
});

package.json

+4-1
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,11 @@
1010
"check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch",
1111
"test": "vitest",
1212
"lint": "prettier --check . && eslint .",
13-
"format": "prettier --write ."
13+
"format": "prettier --write .",
14+
"generate-client": "openapi-ts generate"
1415
},
1516
"devDependencies": {
17+
"@hey-api/openapi-ts": "^0.53.6",
1618
"@sveltejs/adapter-node": "^5.0.1",
1719
"@sveltejs/kit": "^2.5.10",
1820
"@sveltejs/vite-plugin-svelte": "^3.1.1",
@@ -46,6 +48,7 @@
4648
},
4749
"type": "module",
4850
"dependencies": {
51+
"@hey-api/client-fetch": "^0.4.0",
4952
"better-sqlite3": "^11.1.2",
5053
"bits-ui": "^0.21.10",
5154
"clsx": "^2.1.1",

0 commit comments

Comments
 (0)