-
Notifications
You must be signed in to change notification settings - Fork 2k
docs: add workspace configuration example to package.json #10455
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
Conversation
This change updates the documentation to include the workspaces field in the package.json example, which is necessary for multi-package repositories using Turborepo. This makes the documentation more complete and helps prevent potential confusion for users setting up workspaces.
I'm open to making any additional adjustments that might be necessary. Thank you for considering this contribution to improve documentation consistency. |
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
@Feli-dev is attempting to deploy a commit to the Vercel Team on Vercel. A member of the Team first needs to authorize it. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch. This need is talked about elsewhere on the page, but an optional step wouldn't hurt.
Would it be possible that you could add another step to the flow instead of adding to this diff? Maybe titled "Set up package manager workspaces". And with a small explanation and then the diff.
As requested in PR feedback, this change adds a separate step for workspace configuration instead of modifying the existing diff.
Thank you for the feedback! I've implemented the changes as suggested by adding a new dedicated step titled "Set up package manager workspaces" between the current steps 4 and 5. The new step includes:
I've just pushed these changes to my branch. Please let me know if this addresses your suggestion or if you'd like to see any further adjustments. |
<Step> | ||
### Set up package manager workspaces | ||
|
||
For multi-package repositories, you'll need to configure your package manager to recognize your workspace structure. This is done by adding a `workspaces` field to your root `package.json`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's make "multi-package repositories" a link to https://vercel.com/docs/glossary#multi-package-workspace and have the copy be "multi-package workspaces".
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Additionally, let's remove this sentence, since pnpm is different.
For multi-package repositories, you'll need to configure your package manager to recognize your workspace structure. This is done by adding a `workspaces` field to your root `package.json`. | |
For multi-package repositories, you'll need to configure your package manager to recognize your workspace structure. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
✔️
```diff title="package.json" | ||
{ | ||
"packageManager": "npm@8.5.0", | ||
+ "workspaces": [ | ||
+ "apps/*", | ||
+ "packages/*" | ||
+ ] | ||
} | ||
``` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can delete this diff since we're showing these codeblocks in the anyway, and they'll be contextual to the user.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
✔️
} | ||
``` | ||
|
||
<Callout type="info"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is softens the rendered styles of the callout so it demands less attention. This is likely my personal preference, info
makes sense, too, but I'm sensing that we can turn down the intent for this particular piece of knowledge.
<Callout type="info"> | |
<Callout type="good-to-know"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
✔️
workspaces aren't needed. | ||
</Callout> | ||
|
||
Different package managers may have alternative ways to configure workspaces: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can remove this line. The tabs construct conveys this without needing to say it explicitly.
} | ||
``` | ||
|
||
<LinkToDocumentation href="https://bun.sh/docs/install/workspaces">npm workspace documentation</LinkToDocumentation> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
<LinkToDocumentation href="https://bun.sh/docs/install/workspaces">npm workspace documentation</LinkToDocumentation> | |
<LinkToDocumentation href="https://bun.sh/docs/install/workspaces">bun workspace documentation</LinkToDocumentation> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
✔️
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the updates! Definitely the right direction. Getting into the details of things now.
I suspect we might have one more review round after we see how these look, but we're certainly close.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great. Thanks!
Thank you for the guidance and review! |
Description
This PR updates the package.json configuration example in the documentation to include the
workspaces
field, which is necessary for multi-package repositories using Turborepo.Motivation
While following this documentation page, I noticed that the package.json example showed how to add the
packageManager
field, but omitted theworkspaces
field. Although this information is later explained at https://turborepo.com/docs/crafting-your-repository/structuring-a-repository#declaring-directories-for-packages, including it in this initial example would make the documentation more consistent and help prevent confusion for new users who are following the steps sequentially.Changes made
I've updated the diff example in the "Add a
packageManager
field to rootpackage.json
" section to show theworkspaces
field alongside thepackageManager
field, making the example complete and consistent with what's explained later in the documentation.