Urigo / graphql-cli

📟 Command line tool for common GraphQL development workflows

Home Page:https://graphql-cli.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Project 'default' not found

sol-idsnake opened this issue · comments

Describe the bug
I followed the migration guide found in your repo here: Here and Here.
After that, my .graphqlrc.yml looks like this:

projects:
  app:
    schema: src/schema.graphql
  prisma:
    schema: /prisma.yml
    extensions:
      codegen:
        src/generated/prisma.graphql:
          - schema-ast

My prisma.yml:

endpoint: https://eu1.prisma.sh/Xxx/oldprisma/dev
datamodel: datamodel.prisma
# Ensures Prisma client is re-generated after a datamodel change.
hooks:
  post-deploy:
    - graphql codegen --project prisma # instead of graphql get-schema
    - prisma generate

My package.json script:
"gen": "graphql codegen --project prisma"

When I run npm run gen, I get × Project 'default' not found, and that's where it ends. I can't figure out how to fix it.

package.json:

"dependencies": {
		"@graphql-codegen/schema-ast": "^1.13.4",
		"@test-graphql-cli/codegen": "^4.0.1-beta.6",
		"graphql": "^14.5.8",
		"graphql-cli": "^4.0.1-beta.6",
		"graphql-yoga": "^1.18.3",
		"prisma": "^1.34.10",
		"prisma-binding": "^2.3.16"
	},

To Reproduce
Follow the above.

Expected behavior
Generate a prisma.graphql file.

Versions (please complete the following information):

  • OS: Windows 10

I'm having the exact same issue - although on mac os

Me too. I am trying to update old .graphqlrc.yml to new one. Has same problem,

Me too. You can get around it by specifying a default project. But then graphql codegen --project <project> always uses the default project.

Based on this thread from commander, it appears the parent command prevents the subcommand from sharing any common arguments, in this case project.

I got this working by adding cliFlags.project = cliFlags.parent.project to codegen/src/index.ts:

setCommandOptions(program.command('codegen') as any)
      .action(async (cliFlags: any) => {
         cliFlags.project = cliFlags.parent.project
         ....

Although this feels wrong and I'm not sure if this is best way to fix this problem.

#1128 will fix this problem

4.0.0 should fix it