Intended outcome:
Should download the schema file, then put it in the OUTPUT argument, even if the folder specified doesn't exist.
Actual outcome:
My cli command:
apollo client:download-schema ./src/__generated__/schema.json fails when __generated__ folder doesn't exist.
How to reproduce the issue:
pass a filepath with a folder that doesn't exist as the OUTPUT .
I can trace that back the writeFileSync call in download-schema.ts as the culprit, where writeFileSync will throw if a folder doesn't exist.
This stackoverflow article points to two solutions - one using mkdirp and one using fs-extra, or this answer without additional packages. I would like to contribute a fix to this (if you'll have one) and was wondering if there was a preference on how to solve it? Or maybe this is desired behaviour?
I believe this is important because we store generated artifacts in a __generated__ folder, which we do not want to check into github.
Any help appreciated!
Versions
apollo/2.22.0 darwin-x64 node-v13.6.0
Possibly related
Intended outcome:
Should download the schema file, then put it in the OUTPUT argument, even if the folder specified doesn't exist.
Actual outcome:
My cli command:
apollo client:download-schema ./src/__generated__/schema.jsonfails when__generated__folder doesn't exist.How to reproduce the issue:
pass a filepath with a folder that doesn't exist as the OUTPUT .
I can trace that back the
writeFileSynccall indownload-schema.tsas the culprit, wherewriteFileSyncwill throw if a folder doesn't exist.This stackoverflow article points to two solutions - one using
mkdirpand one usingfs-extra, or this answer without additional packages. I would like to contribute a fix to this (if you'll have one) and was wondering if there was a preference on how to solve it? Or maybe this is desired behaviour?I believe this is important because we store generated artifacts in a
__generated__folder, which we do not want to check into github.Any help appreciated!
Versions
apollo/2.22.0 darwin-x64 node-v13.6.0Possibly related