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

BEWARE - this tool is dangerous. It will delete your files without the possibility of recovery #79

Open
mborkland opened this issue May 14, 2024 · 0 comments

Comments

@mborkland
Copy link

mborkland commented May 14, 2024

Wow, I never expected a GraphQL query generator to recursively delete a whole directory of files, but it did.

Steps to reproduce:

  1. Execute this command with a valid path to the schema: gqlg --schemaFilePath /path/to/schema --destDirPath .
  2. Get an error like this:
/Users/user/.nvm/versions/node/v14.20.1/lib/node_modules/gql-generator/index.js:210
      if (err.code !== 'EEXIST') throw err;
                                 ^

Error: ENOENT: no such file or directory, mkdir 'queries'
    at Object.mkdirSync (fs.js:1014:3)
    at generateFile (/Users/user/.nvm/versions/node/v14.20.1/lib/node_modules/gql-generator/index.js:208:10)
    at main (/Users/user/.nvm/versions/node/v14.20.1/lib/node_modules/gql-generator/index.js:252:5)
    at Object.<anonymous> (/Users/user/.nvm/versions/node/v14.20.1/lib/node_modules/gql-generator/index.js:283:3)
    at Module._compile (internal/modules/cjs/loader.js:1085:14)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1114:10)
    at Module.load (internal/modules/cjs/loader.js:950:32)
    at Function.Module._load (internal/modules/cjs/loader.js:790:12)
    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:75:12)
    at internal/main/run_main_module.js:17:47 {
  errno: -2,
  syscall: 'mkdir',
  code: 'ENOENT',
  path: 'queries'
}
  1. Execute ls -l and your current directory will be empty, including the schema that you gave as an input!

I would like an explanation for why this happened. Thankfully, most of my work is in git, but I did have to redo a couple hours worth of updates I had made. It seems the tool does not support using the current directory as the destination directory, which is perplexing to me as a user. Please fix this bug or at least include a very strong warning in the README.

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

1 participant