nicolasdao / schemaglue

Naturally breaks down your monolithic graphql schema into bits and pieces and then glue them back together.
BSD 3-Clause "New" or "Revised" License
116 stars 13 forks source link

Allow only importing files with certain name #3

Closed lucapasquale closed 6 years ago

lucapasquale commented 6 years ago

My project have a structure like this:

- src/
   |__ graphql/
          |__ product/
          |       |__ schema.js
          |       |__ resolver.js
          |       |__ spec.js
          |
          |__ variant/
                  |__ schema.js
                  |__ resolver.js
                  |__ spec.js

with spec.js being the type tests. Since schemaglue always imports all .jsfiles, it is importing the tests as well, which causes them to be ran when I start the project. Maybe allowing something like this on appconfig.json would resolve

{
  "graphql": {
    "schema": "src/graphql,
    "resolver": "src/graphq"
  },
  "files": {
    "schema": "schema.js",
    "resolver": "resolver.js"
  }
}
nicolasdao commented 6 years ago

Hi @lucapasquale ,

Thanks a lot for that suggestion. That made a lot of sense. I've just added support for ignoring certain files. Instead of using your suggestion, I used a more standard approach using globbing (I've described that into the README.md).

Update your code using the latest version in npm (1.5.1). Then, based on your example above, update your appconfig.json as follow:

{
    "graphql": {
        "schema": "src/graphql",
        "ignore": "**/spec.js"
    }
}

Let me know if that fixes your issue.

Cheers,

Nic

lucapasquale commented 6 years ago

Thanks, it worked perfectly!