timqian / gql-generator

Generate queries from graphql schema, used for writing api test.
MIT License
375 stars 93 forks source link

Error: Cannot delete files/folders outside the current working directory. Can be overriden with the `force` option. #66

Closed bastianhilton closed 2 years ago

bastianhilton commented 2 years ago

Can someone show me how to run the generator from another directory using the force option like the error says.

I have a package.json and created a .js file is attempting to run it like so:

"gql-generate": "node gql-generator.js" in my package.json

this is my file:

`const gqlg = require('gql-generator')

gqlg({ schemaFilePath: '../server/generated-schema.graphql', destDirPath: '/generated/'})`

bastianhilton commented 2 years ago

I found how to resolve this issue, in my package.json i just added the commands and it got passed the error:

under the scripts section, i added:

"gql-generate": "gqlg --schemaFilePath ./server/generated-schema.graphql --destDirPath ./graphql/generated",