Skip to content

Fix trimming of filenames#405

Merged
pvasek merged 2 commits intostyleguidist:masterfrom
ecraig12345:fix-trim-filename
Dec 11, 2021
Merged

Fix trimming of filenames#405
pvasek merged 2 commits intostyleguidist:masterfrom
ecraig12345:fix-trim-filename

Conversation

@ecraig12345
Copy link
Copy Markdown
Contributor

After #392, trimming filenames no longer works properly on types coming from node_modules in a monorepo, where commands may be run from a particular package but dependencies are installed at the repo root (see #404 for more details).

This PR restores the previous behavior of returning the path starting from the first common root folder between the filename and process.cwd(), in a way that should be reliable across platforms regardless of how paths are formatted.

Fixes #404

@pvasek
Copy link
Copy Markdown
Collaborator

pvasek commented Dec 11, 2021

Obviously, it didn't come to my mind that I could break something with my "fix" #392.

Thanks for your PR we have all these use cases covered now. It's surprising for me to see all that we need to handle and it's great to have it "documented" in this way.

@pvasek pvasek merged commit 8b25549 into styleguidist:master Dec 11, 2021
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.

trimFileName no longer works in a monorepo

2 participants