Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GraphQL and codegen integration in watch mode not work #2100

Closed
awxalbert opened this issue Sep 28, 2022 · 3 comments
Closed

GraphQL and codegen integration in watch mode not work #2100

awxalbert opened this issue Sep 28, 2022 · 3 comments

Comments

@awxalbert
Copy link

What version of Turborepo are you using?

1.5.4

What package manager are you using / does the bug impact?

Yarn v1

What operating system are you using?

Mac

Describe the Bug

Currently I'm using Turborepo to develop a GraphQL based app while I meet some problems when achieving the following three goals

Here's my turbo.json file

{
  "$schema": "https://turborepo.org/schema.json",
  "pipeline": {
    "dev": {
      "dependsOn": ["generate:watch"],
      "cache": false
    },
    "generate:watch": {
      "cache": false
    },
    "generate": {
      "cache": false
    }
  }
}

Here's my server's package.json file

{
  "name": "server",
  "version": "0.0.0",
  "main": "index.js",
  "license": "MIT",
  "engines": {
    "node": ">=14"
  },
  "scripts": {
    "dev": "nodemon --watch src --ext ts,json -r dotenv/config -r tsconfig-paths/register src/index.ts",
    "generate": "graphql-codegen",
    "generate:watch": "yarn generate --watch"
  },
  "dependencies": {
    "apollo-server": "^3.10.2",
    "graphql": "^16.5.0"
  },
  "devDependencies": {
    "@graphql-codegen/add": "^3.2.0",
    "@graphql-codegen/cli": "^2.9.1",
    "@graphql-codegen/typescript": "^2.7.2",
    "@graphql-codegen/typescript-resolvers": "^2.7.2",
    "@types/node": "^14.18.0",
    "dotenv": "^16.0.1",
    "nodemon": "^2.0.19",
    "rimraf": "^3.0.2",
    "tsc-alias": "^1.7.0",
    "ts-node": "^10.9.1",
    "tsconfig-paths": "^4.1.0",
    "typescript": "^4.7.4"
  }
}

Since the generate job should run before the dev job, so I use dependsOn. When I run turbo run dev --parallel, the generate job just work as expected, while the dev job doesn't run at all, the first job somehow blocks the second job, have no idea what's wrong.

Expected Behavior

The dev job can also run, or Turborepo can have watch mode as mentioned in the issue.

To Reproduce

Git clone this demo, install dependencies and run yarn dev

@chris-olszewski
Copy link
Member

Hello! Technically this is expected behavior since you defined dev to depend on generate:watch so dev won't get run until the generate:watch process exits.

I'm closing this as I believe the request will be covered by the closing of #986. Feel free to reopen if you feel this issue requires a different solution.

@awxalbert
Copy link
Author

@chris-olszewski thanks for the quick response, is there a concrete schedule or plan of the watch mode? I'm pretty sure a lot of users are expecting this feature.

@chris-olszewski
Copy link
Member

We don't have a concrete schedule, but we have just started to sketch out how this could work. We'll communicate more on the original issue or an RFC once we have a concrete proposal.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants