Add environment variable NX_TASK_TARGET_PROJECT_ROOT
#31781
kitsunekyo
started this conversation in
Feature Requests
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
For a lot of config files (playwright, jest, ...) the value of the
{projectRoot}
token would be extremely helpful to have at runtime. NX already provides the environment variableNX_TASK_TARGET_PROJECT
, which will return the name of the project, so providingNX_TASK_TARGET_PROJECT_ROOT
would be a perfect addition to that.Usecase:
To set the output file for some of my reporters my playwright preset needs to be aware of the project root of the task being run. I can use
@nx/devkit
sworkspaceRoot
export but thats about it. To get the{projectRoot}
I have to do a manual file lookup to find the nearestpackage.json
orproject.json
, which I then use asprojectRoot
value within myplaywright-preset.js
file.Having an environment variable with the value of the project root of the task being run would make this a million times simpler.
Beta Was this translation helpful? Give feedback.
All reactions