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

make tool kit config loading agnostic of CWD #709

Open
wants to merge 13 commits into
base: main
Choose a base branch
from

Conversation

apaleslimghost
Copy link
Member

@apaleslimghost apaleslimghost commented Nov 8, 2024

Tool Kit currently implicitly uses process.cwd() in a lot of places in its config loading and tasks. this makes monorepo support more difficult, as we'll want to be loading configs and running tasks in directories that are not the current shell working directory (i.e. within monorepo workspace packages). while the monorepo plugin could do some process.chdir() shenanigans, i'd like to avoid that as keeping the state consistent and concurrency-safe will be very very difficult.

this PR refactors Tool Kit internals to specify exactly where to load configs from, and keep track of that using the config.root property. this property was previously set to the directory of the cli package for reasons i don't understand, and was never actually being used, so it's safe to repurpose for this.

it also passes through the cwd in the newish TaskRunContext argument for Task.run so tasks can use that to be aware of which directory to run in, and (hopefully) as much as possible uses that cwd in our existing tasks. while i'm at it it adds the current command to TaskRunContext for use by the monorepo plugin.

this PR was split from #630 so they can both be reviewed more easily.

@apaleslimghost apaleslimghost changed the title WIP: make tool kit config loading agnostic of CWD make tool kit config loading agnostic of CWD Nov 11, 2024
@apaleslimghost apaleslimghost marked this pull request as ready for review November 12, 2024 08:52
@apaleslimghost apaleslimghost requested a review from a team as a code owner November 12, 2024 08:52
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

Successfully merging this pull request may close these issues.

1 participant