fix(pgpm): fix --dir flag handling for workspace prompt and module placement #672
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
Fixes two issues with
pgpm init --dir <variant>:Workspace prompt for non-pgpm templates: When running
pgpm init --dir pnpmoutside a workspace, the command would throwNOT_IN_WORKSPACEwithout offering to create a workspace. Now it prompts the user to create a workspace (same as pgpm templates do) when--diris specified.Module placement in packages/ folder: Modules with
requiresWorkspace: 'pnpm'(or lerna/npm) were being placed in the current directory instead ofpackages/when at workspace root. Added a new code path for non-pgpm workspaces that mirrors the pgpm workspace behavior.Review & Testing Checklist for Human
ctx.diris specified (workspaceType === 'pgpm' || ctx.dir). Confirm this is the intended behavior and doesn't cause unwanted prompts.pgpm init --dir pnpmoutside a workspace: Should now prompt to create a workspace instead of throwing an errorpgpm init module --dir pnpmfrom workspace root and verify module is created inpackages/<name>not./<name>packages/<name>(current directory behavior)Notes
Requested by @pyramation
Link to Devin run: https://app.devin.ai/sessions/86fc90000ad24b2cacf3b750dc077be3