feat: added support for monorepo workspaces #233
+414
−25
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.
Added logic to detect when used within a monorepo context and act accordingly. This includes:
workspaceRootoption to avoid the lookup logicWorkspace root:prompt that only shows when it thinks you are running anywhere other than the workspace rootworkspaceskey with suggested packages it findpackage.jsonworkspaceskey if it wasn't already matchednpm iif necessary to ensure lock files are updated with the new workspace packageThis one is a tricky one from a semver perspective. I think it should be a minor, but since it looks up the filesystem tree it absolutely could be breaking if it used to be called in a monorepo context where this handling was done outside the package. This can be avoided by simply passing
--workspace-root=$(pwd)to tell it to look no further. Because of this, I am considering if that should be set by default despite not being super ergonomic. Then we can say "this will change in the next major to be on by default". Honestly not sure how to think about this, but I think erring on the side of caution is never bad so will consider this before landing. Feedback welcome.