-
-
Notifications
You must be signed in to change notification settings - Fork 34
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
Add cwd
option to fix loader + jestTransformer when using moved cache + config options
#626
base: main
Are you sure you want to change the base?
Conversation
Partially addresses piglovesyou#605 Sets a new cwd context in cases where the config file does not reside in the jest root directory. This is necessary because the config file can then give the cache location, but it will be relative to its own location (not that of the jest config)
Looks good, thank you @comp615! I'm ready to merge and publish once you fix the build failure, seemingly of a simple prettier error. Thanks! |
Thanks, will update, would also like to take a look at the test and see if I can add a case |
All set now I think, wrote a new test! |
@piglovesyou wanted to flag this has been fixed and added another small PR for some security fixes. Thanks! We're enjoying it so far. |
NOTE: This same technique might need to be applied in more places like https://github.com/piglovesyou/graphql-let/blob/main/src/loader.ts, we continue to encounter this issue in various ways |
@piglovesyou Wanted to check in and see if you were still around! I've opened a few more PRs and would love to get them in (along with some of the dependabot stuff). If you are swamped, I'd also be happy to take a go at doing some maintainer work here and on NPM if you're willing. Happy to setup time to talk more if that's useful. |
cwd
option to fix loader + jestTransformer when using moved cache + config options
Have updated this with a more complete solution. |
- [FAQ](#faq) | ||
- [Contribution](#contribution) | ||
- [License](#license) | ||
- [Why this exists](#why-this-exists) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Most of this file is Prettier formatting this
@piglovesyou saw you were doing some maintenance last week. Any chance of getting this one in? This is the most critical change in my mind of the ones open. We're currently running on a fork based off this branch in order to allow us to run a monorepo environment. |
Addresses #605
Adds a new cwd option to the config and pipes it through path resolutions. There's a number of folder and base folders potentially involved in the process of running graphql-let: process dir, config dir, and other dirs.
In cases where the config file does not reside in the jest root directory. This is necessary because the config file can then give the cache location, and it will be resolved relative to its own location (not that of the jest config). Additionally, documents CANNOT reside outside the root directory. Since we store them in the cache dir as a literal directory, relative paths escaping that store the cache files in non-sensical places, additionally, this would imply we could have folder conflicts. This change helps resolve that ambiguity.
Put differently, now by default all paths will resolve relative to the config dir itself. But if you have the config dir in a sub-directory, this allows you to "reset" the base resolution directory opening up a wider variety of configuration options regardless of where you run jest from, store your config, etc.
Changes:
cwd
option