feat: support running commands from subdirectories in monorepo#15
Merged
feat: support running commands from subdirectories in monorepo#15
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
raon0211
reviewed
Jan 26, 2026
| } | ||
|
|
||
| private getRepoRootPath(): string { | ||
| const root = findUp("yarn.lock", this.cwd); |
raon0211
reviewed
Jan 26, 2026
| } | ||
|
|
||
| return findUp(name, path.dirname(absoluteCwd)); | ||
| } No newline at end of file |
There was a problem hiding this comment.
Missing EOL here. Might be worth checking our formatter settings.
Collaborator
Author
There was a problem hiding this comment.
This repository doesn't have a formatter (prettier or biome) configured.
I'll create a separate PR to apply formatting across the codebase.
raon0211
approved these changes
Jan 26, 2026
raon0211
left a comment
There was a problem hiding this comment.
LGTM except for two minor comments. Feel free to merge if you don't think they're relevant.
319c833 to
2d9df7e
Compare
8443491 to
a4871cf
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Add support for running CLI commands from subdirectories in a monorepo by resolving
process.cwd()behavior differences across package managers.Problem
When running
docflowcommands from a subdirectory (e.g.,packages/web), path calculations failed becauseprocess.cwd()behaves differently across package managers:process.cwd()INIT_CWDThis inconsistency caused incorrect relative path calculations for workspace packages.
Solution
getWorkingDirectory()Returns
INIT_CWD ?? process.cwd()to get consistent invocation directory across all package managers.Package manager
path.relative(cwd, pkgPath)from absolutepathfieldyarn.locklocation, then calculate relative pathsCommand updates
Replace
process.cwd()withgetWorkingDirectory()in commands.Result
Users can now run
docflow build,docflow check, anddocflow generatefrom any subdirectory in a monorepo, regardless of which package manager they use.