Skip to content

Commit ca53c21

Browse files
MaxBlack-devMax Black
andauthored
docs: add workspace usage examples (#8745)
## Summary This PR adds workspace usage examples to the `npm publish` documentation to address confusion about the proper syntax for publishing workspaces. ## Related issue Fixes #3543 ## What changed - Added an "Examples" section to `docs/lib/content/commands/npm-publish.md` - Included clear examples for: - Publishing the current directory - Publishing a specific workspace - Publishing multiple workspaces - Publishing all workspaces ## Why this change is needed Users were confused about the proper syntax for `npm publish --workspace`. The documentation had no examples demonstrating workspace usage, which made it difficult for users to understand how to use this feature. ## Type of change - [x] Documentation improvement - [ ] Bug fix - [ ] New feature ## Testing - [x] Documentation builds without errors - [x] Examples are syntactically correct and follow npm CLI conventions ## Checklist - [x] Examples added to documentation - [x] Commit message follows Conventional Commits format - [x] References issue #3543 in commit message Co-authored-by: Max Black <[email protected]>
1 parent e71ca0e commit ca53c21

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

docs/lib/content/commands/npm-publish.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,32 @@ description: Publish a package
1212

1313
Publishes a package to the registry so that it can be installed by name.
1414

15+
### Examples
16+
17+
Publish the package in the current directory:
18+
19+
```bash
20+
npm publish
21+
```
22+
23+
Publish a specific workspace:
24+
25+
```bash
26+
npm publish --workspace=<workspace-name>
27+
```
28+
29+
Publish multiple workspaces:
30+
31+
```bash
32+
npm publish --workspace=workspace-a --workspace=workspace-b
33+
```
34+
35+
Publish all workspaces:
36+
37+
```bash
38+
npm publish --workspaces
39+
```
40+
1541
By default npm will publish to the public registry.
1642
This can be overridden by specifying a different default registry or using a [`scope`](/using-npm/scope) in the name, combined with a scope-configured registry (see [`package.json`](/configuring-npm/package-json)).
1743

0 commit comments

Comments
 (0)