Fix backend build and add graphql codegen watch to web:dev

This commit is contained in:
Hammad Jutt
2020-08-17 14:56:50 -06:00
parent ca4fd2e697
commit 6ee27a3695
6 changed files with 16 additions and 7 deletions

View File

@@ -8,8 +8,7 @@
"scripts": {
"get-schema": "env-cmd -f ../../.env -x get-graphql-schema -h x-hasura-admin-secret=\\$HASURA_GRAPHQL_ADMIN_SECRET http://localhost:8080/v1/graphql > schema.graphql",
"update-schema": "yarn get-schema && yarn generate",
"generate": "graphql-codegen --config=graphql-codegen-gql.yaml && graphql-codegen --config=graphql-codegen-typescript.yaml",
"prepare": "yarn generate"
"generate": "graphql-codegen --config=graphql-codegen-gql.yaml && graphql-codegen --config=graphql-codegen-typescript.yaml"
},
"dependencies": {
"graphql-tag": "^2.10.4"

View File

@@ -10,7 +10,6 @@
"build": "tsc -b",
"dev": "yarn build --watch",
"typecheck": "yarn build",
"prepare": "yarn build",
"precommit": "yarn lint-staged"
},
"dependencies": {

View File

@@ -0,0 +1,10 @@
{
"overrides": [
{
"files": ["./graphql/*.ts"],
"rules": {
"@typescript-eslint/explicit-module-boundary-types": "off"
}
}
]
}

View File

@@ -3,7 +3,7 @@
"version": "0.1.0",
"private": true,
"scripts": {
"dev": "next",
"dev": "concurrently \"next\" \"yarn generate --watch\"",
"build": "next build && next export",
"start": "next start",
"typecheck": "tsc",

View File

@@ -37,7 +37,9 @@ const PlayerPage: React.FC<Props> = ({ player }) => {
export default PlayerPage;
export const getStaticPaths: GetStaticPaths = async () => {
type QueryParams = { username: string };
export const getStaticPaths: GetStaticPaths<QueryParams> = async () => {
const players = await getPlayers();
return {
@@ -49,7 +51,7 @@ export const getStaticPaths: GetStaticPaths = async () => {
};
export const getStaticProps = async (
context: GetStaticPropsContext<{ username: string }>,
context: GetStaticPropsContext<QueryParams>,
) => {
const username = context.params?.username;
const player = await getPlayer(username);

View File

@@ -1 +0,0 @@
export type Pokemon = { name: string; image: string };