Skip to content

Commit

Permalink
fix: generate client code for Pylon GraphQL API
Browse files Browse the repository at this point in the history
  • Loading branch information
schettn committed Jul 11, 2024
1 parent 28124b2 commit 0daade2
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions packages/pylon-cli/src/commands/develop.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ export default async (options: {port: string}) => {

const binPath = stdout.toString().trim()

const packageJson = await import(path.resolve(process.cwd(), 'package.json'))

let currentProc: Subprocess | null = null

let serve = async () => {
Expand All @@ -34,22 +36,20 @@ export default async (options: {port: string}) => {
NODE_ENV: 'development'
}
})
}

const packageJson = await import(path.resolve(process.cwd(), 'package.json'))
const clientPath = packageJson.pylon?.gqty

const clientPath = packageJson.pylon?.gqty
if (clientPath) {
const endpoint = `http://localhost:${options.port}/graphql`

if (clientPath) {
const endpoint = `http://localhost:${options.port}/graphql`
const schema = await fetchSchema(endpoint)

const schema = await fetchSchema(endpoint)

await generateClient(schema, {
endpoint,
destination: clientPath,
react: true
})
await generateClient(schema, {
endpoint,
destination: clientPath,
react: true
})
}
}

await build({
Expand Down

0 comments on commit 0daade2

Please sign in to comment.