|
1
|
# When to Document a Change |
|
2
|
|
|
3
|
Use this reference when reviewing a code diff to decide whether documentation updates are needed, and if so, which projects to update. |
|
4
|
|
|
5
|
## Golden Rule: Document All User-Facing Features |
|
6
|
|
|
7
|
**If a user-facing feature exists in the code but is missing from the docs, document it — regardless of whether the current diff added it or just changed it.** |
|
8
|
|
|
9
|
When reviewing a diff, always check whether the affected feature (CLI option, workflow, service method, config key, admin screen, UI component) is documented. If it is not, add the documentation as part of this update. The fact that a feature was previously undocumented is not a reason to skip it — it is a reason to add it now. |
|
10
|
|
|
11
|
This applies especially to: |
|
12
|
- CLI options present in the source that are missing from the reference table in docs |
|
13
|
- Workflow steps or service methods referenced in code but not described on any doc page |
|
14
|
- Config options accepted by `medusa-config` but absent from the configurations docs |
|
15
|
- Admin UI screens or flows that exist but have no user-guide page |
|
16
|
|
|
17
|
--- |
|
18
|
|
|
19
|
## Decision Tree |
|
20
|
|
|
21
|
### Always document |
|
22
|
|
|
23
|
- A new exported `interface`, `type`, `class`, or `function` is added to a module's public API |
|
24
|
- An existing exported type/interface/class signature changes (new fields, changed field types, renamed parameters) |
|
25
|
- A new module service method is added (document in `resources` under the module's overview page) |
|
26
|
- A new workflow or step is added to `core-flows` (document in `resources`, consider `book` if it relates to a core concept) |
|
27
|
- A workflow or step's input/output type changes (update usage examples in `resources` and `book` if referenced there) |
|
28
|
- A new configuration option is added to `medusa-config` (document in `book` under `configurations/`) |
|
29
|
- A new `packages/admin/dashboard` route is added that creates new UI screens visible to admin users (document in `user-guide`) |
|
30
|
|
|
31
|
### Document in `book` AND `resources` |
|
32
|
|
|
33
|
- Module API changes that affect how developers use it in workflows or services |
|
34
|
- Framework changes that affect how modules, workflows, or loaders are written |
|
35
|
- Changes to `core-flows` workflow/step names or signatures used in tutorials |
|
36
|
|
|
37
|
### Document in `book` AND `resources` (admin-related) |
|
38
|
|
|
39
|
- Changes to `packages/admin/admin-shared/src/extensions/widgets/` — widget zone constants |
|
40
|
- Changes to `packages/admin/admin-shared/src/extensions/routes/` — UI route definitions |
|
41
|
- Any new admin extension point (widget zones, UI routes, field types) that developers use to extend the admin |
|
42
|
|
|
43
|
> **Why:** The `book` has chapters on customizing the admin (adding widgets, creating UI routes), and `resources` has how-to guides for the same. If the extension API changes, both need updating. |
|
44
|
|
|
45
|
### Document in `user-guide` only |
|
46
|
|
|
47
|
- New screens, tabs, or sections added to the Medusa admin dashboard |
|
48
|
- Changes to existing admin UI that affect how a non-technical user completes a task |
|
49
|
- New buttons, modals, or workflows in the admin that change the user experience |
|
50
|
|
|
51
|
### Document in `ui` only (or skip) |
|
52
|
|
|
53
|
- A new UI component is added to `packages/design-system/ui` — add a page in `www/apps/ui/app/components/` |
|
54
|
- A UI component's public props/API changes — update `www/apps/ui/app/components/<Component>/` and check if any examples in `www/apps/ui/specs/examples/` break |
|
55
|
- A UI component is removed or renamed — update all references in `ui` docs |
|
56
|
|
|
57
|
### Document in `book` AND `resources` (design-system) |
|
58
|
|
|
59
|
- A component that is referenced in `book` or `resources` tutorials changes its name or key props |
|
60
|
- Check: search for the component name in `www/apps/book/app/` and `www/apps/resources/app/` to confirm it's referenced before updating |
|
61
|
|
|
62
|
### Skip entirely |
|
63
|
|
|
64
|
- Internal refactor with no change to public API (same exports, same behavior) |
|
65
|
- Bug fix that restores intended behavior with no API change |
|
66
|
- Performance or infrastructure changes with no user-visible effect |
|
67
|
- Adding/changing tests, fixtures, or migration files |
|
68
|
- Changes only to `devDependencies`, tooling config, or CI scripts |
|
69
|
- Private helper functions (`private` class methods, unexported functions) |
|
70
|
- Type-only changes that don't affect usage (e.g. renaming an internal generic parameter) |
|
71
|
|
|
72
|
### CLI tool changes (`packages/cli/**`) |
|
73
|
|
|
74
|
CLI packages have dedicated documentation pages in `resources` and are also referenced across other guides. |
|
75
|
|
|
76
|
**`packages/cli/create-medusa-app`** — the `create-medusa-app` CLI tool: |
|
77
|
- Changes to flags, options, or the default project structure → update `www/apps/resources/app/create-medusa-app/` and any page across `book` or `resources` that shows a `create-medusa-app` command |
|
78
|
- New flags should be added to the reference page; changed defaults should update all usage examples that show the old default |
|
79
|
|
|
80
|
**`packages/cli/medusa-cli`** (the `medusa` CLI) — commands like `medusa start`, `medusa db:migrate`, `medusa plugin:develop`, etc.: |
|
81
|
- New subcommands or new flags on existing commands → update `www/apps/resources/app/medusa-cli/` |
|
82
|
- Changed command signatures → search across `book` and `resources` for usages of that command and update them |
|
83
|
- Removed or renamed commands → find all occurrences across the doc projects and update |
|
84
|
|
|
85
|
To find usages of a CLI command in the docs, search across the writable directories: |
|
86
|
```bash |
|
87
|
grep -r "create-medusa-app" www/apps/book/app www/apps/resources/app |
|
88
|
grep -r "medusa db:migrate" www/apps/book/app www/apps/resources/app |
|
89
|
``` |
|
90
|
|
|
91
|
### Other package changes |
|
92
|
|
|
93
|
For packages that don't fall into the categories above (shown under "Other Changed Packages" in the prompt): |
|
94
|
- If the package exposes a public API used in tutorials or guides, check whether any doc page references it and update accordingly |
|
95
|
- If it's a purely internal package with no user-facing surface, skip |
|
96
|
|
|
97
|
## Which project to update per package kind |
|
98
|
|
|
99
|
| Package kind | Default projects | Condition for extras | |
|
100
|
|---|---|---| |
|
101
|
| `module` | `book`, `resources` | Always both | |
|
102
|
| `core-flow` | `book`, `resources` | Always both | |
|
103
|
| `framework` | `book`, `resources` | Always both | |
|
104
|
| `admin` | `user-guide` | Add `book` + `resources` if widget zones or extension API changed | |
|
105
|
| `design-system` | `ui` | Add `book` + `resources` if a component referenced in those docs changed | |
|
106
|
| `cli` | `resources` | Also update `book` if the command appears in book tutorials | |
|
107
|
| `other` | (advisory) | Decide based on whether the change has a user-facing doc surface | |
|
108
|
|
|
109
|
## Scope of changes |
|
110
|
|
|
111
|
When you do decide to document: |
|
112
|
|
|
113
|
- **Update existing pages** before creating new ones — check if there's already a page for the module/feature |
|
114
|
- **Update examples** to reflect new API signatures |
|
115
|
- **Add a new section** only if a genuinely new concept was introduced |
|
116
|
- **Create a new page** only if a completely new feature with no existing page was added |
|
117
|
- Keep changes targeted — don't rewrite working content, only fix what's affected by the diff |