Skip to content

Commit

Permalink
feat: Migrate to autogenerated OpenAPI client (#112)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
filiptrplan authored Oct 10, 2024
1 parent 975a339 commit b15dfec
Show file tree
Hide file tree
Showing 41 changed files with 6,659 additions and 836 deletions.
3 changes: 2 additions & 1 deletion .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@ pnpm-lock.yaml
package-lock.json
yarn.lock
CHANGELOG.md
.idea
.idea
src/lib/client/
2 changes: 1 addition & 1 deletion eslint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,6 @@ export default [
}
},
{
ignores: ['build/', '.svelte-kit/', 'dist/', 'src/lib/components/ui/', '.idea/']
ignores: ['build/', '.svelte-kit/', 'dist/', 'src/lib/components/ui/', '.idea/', 'src/client/']
}
];
11 changes: 11 additions & 0 deletions openapi-ts.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { defineConfig } from '@hey-api/openapi-ts';

export default defineConfig({
client: '@hey-api/client-fetch',
input: 'http://localhost:8080/openapi.json',
output: 'src/lib/client',
services: {
// This does not suppport tree-shaking and could lead to a larger bundle size
asClass: true
}
});
5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,11 @@
"check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch",
"test": "vitest",
"lint": "prettier --check . && eslint .",
"format": "prettier --write ."
"format": "prettier --write .",
"generate-client": "openapi-ts generate"
},
"devDependencies": {
"@hey-api/openapi-ts": "^0.53.6",
"@sveltejs/adapter-node": "^5.0.1",
"@sveltejs/kit": "^2.5.10",
"@sveltejs/vite-plugin-svelte": "^3.1.1",
Expand Down Expand Up @@ -46,6 +48,7 @@
},
"type": "module",
"dependencies": {
"@hey-api/client-fetch": "^0.4.0",
"better-sqlite3": "^11.1.2",
"bits-ui": "^0.21.10",
"clsx": "^2.1.1",
Expand Down
Loading

0 comments on commit b15dfec

Please sign in to comment.