@planningcenter/tapestry-migration-cli 3.4.1 → 3.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (43) hide show
  1. package/README.md +59 -0
  2. package/dist/tapestry-react-shim.cjs +5 -1
  3. package/package.json +3 -3
  4. package/src/availableComponents.ts +14 -0
  5. package/src/components/button/transforms/tooltipToWrapper.test.ts +50 -3
  6. package/src/components/button/transforms/tooltipToWrapper.ts +18 -0
  7. package/src/components/dropdown/index.test.ts +67 -0
  8. package/src/components/dropdown/index.ts +4 -0
  9. package/src/components/dropdown/transforms/placementIdToMenu.test.ts +6 -1
  10. package/src/components/dropdown/transforms/placementIdToMenu.ts +1 -1
  11. package/src/components/dropdown/transforms/variantToKind.test.ts +292 -0
  12. package/src/components/dropdown/transforms/variantToKind.ts +138 -0
  13. package/src/components/dropdown/transforms/wrapIconTrigger.test.ts +336 -0
  14. package/src/components/dropdown/transforms/wrapIconTrigger.ts +233 -0
  15. package/src/components/flex/index.test.ts +140 -0
  16. package/src/components/flex/index.ts +40 -0
  17. package/src/components/flex/transforms/alignmentToAlign.test.ts +185 -0
  18. package/src/components/flex/transforms/alignmentToAlign.ts +73 -0
  19. package/src/components/flex/transforms/axisToDirection.test.ts +140 -0
  20. package/src/components/flex/transforms/axisToDirection.ts +51 -0
  21. package/src/components/flex/transforms/distributionToJustify.test.ts +214 -0
  22. package/src/components/flex/transforms/distributionToJustify.ts +76 -0
  23. package/src/components/flex/transforms/innerRefToRef.test.ts +100 -0
  24. package/src/components/flex/transforms/innerRefToRef.ts +14 -0
  25. package/src/components/flex/transforms/moveFlexImport.test.ts +202 -0
  26. package/src/components/flex/transforms/moveFlexImport.ts +14 -0
  27. package/src/components/flex/transforms/setDefaultAxis.test.ts +114 -0
  28. package/src/components/flex/transforms/setDefaultAxis.ts +29 -0
  29. package/src/components/flex/transforms/spacingToGap.test.ts +176 -0
  30. package/src/components/flex/transforms/spacingToGap.ts +49 -0
  31. package/src/components/select/index.ts +2 -0
  32. package/src/components/select/transforms/onChangeSignature.test.ts +224 -0
  33. package/src/components/select/transforms/onChangeSignature.ts +172 -0
  34. package/src/components/shared/actions/resolveConstantAttributeValue.test.ts +122 -0
  35. package/src/components/shared/actions/resolveConstantAttributeValue.ts +31 -0
  36. package/src/components/toggle-switch/index.ts +2 -0
  37. package/src/components/toggle-switch/transforms/onClickToOnChange.test.ts +210 -0
  38. package/src/components/toggle-switch/transforms/onClickToOnChange.ts +71 -0
  39. package/src/index.test.ts +79 -0
  40. package/src/index.ts +34 -18
  41. package/src/migrationList.ts +22 -0
  42. package/src/utils/componentLabel.test.ts +61 -0
  43. package/src/utils/componentLabel.ts +15 -0
package/README.md CHANGED
@@ -18,11 +18,13 @@ This order ensures that Button components with navigation props are properly han
18
18
  Consider these steps to safely migrate your components:
19
19
 
20
20
  1. **Prepare your workspace** (recommended)
21
+
21
22
  - Commit your current changes or create a new branch
22
23
  - This allows you to easily review or revert changes if needed
23
24
  - Run your JS/TS code formatter (like Prettier) and commit any formatting changes if needed
24
25
 
25
26
  2. **Create a theme file** (important for button migrations)
27
+
26
28
  - Create a CommonJS file called `theme.js` at the root of your project
27
29
  - Populate the file with your project's custom theme values using one of these methods:
28
30
  - **Option 1**: Copy/paste your project's custom theme values directly into the file (computed values should be ignored or set)
@@ -69,6 +71,7 @@ Consider these steps to safely migrate your components:
69
71
  - Use `--report-path` to generate a migration report for review (will default to MIGRATION_REPORT.md if not specified)
70
72
 
71
73
  4. **Review the migration report and changed files**
74
+
72
75
  - Check the generated migration report (default: `MIGRATION_REPORT.md`)
73
76
  - Review the actual file changes using `git diff` or your editor
74
77
  - Understand what transformations were applied
@@ -79,10 +82,12 @@ Consider these steps to safely migrate your components:
79
82
  ```
80
83
 
81
84
  5. **Discard or revert changes if needed**
85
+
82
86
  - If you're not ready to keep the changes, revert to discard the changes
83
87
  - You can always re-run the migration later when ready
84
88
 
85
89
  6. **Review TODO comments**
90
+
86
91
  - Search for `TODO: tapestry-migration ([scope])` comments in your codebase
87
92
 
88
93
  ```bash
@@ -94,11 +99,13 @@ Consider these steps to safely migrate your components:
94
99
  - Each TODO includes guidance on how to handle the unsupported prop
95
100
 
96
101
  7. **Test your application**
102
+
97
103
  - Run your test suite
98
104
  - Manually verify migrated components work as expected
99
105
  - Pay special attention to any components with TODO comments
100
106
 
101
107
  8. **Format your code**
108
+
102
109
  - Run your JS/TS code formatter (like Prettier) to ensure consistent code formatting
103
110
 
104
111
  9. **Commit your changes**
@@ -120,14 +127,66 @@ npx @planningcenter/tapestry-migration-cli run button -p ./src/components --js-t
120
127
  npx @planningcenter/tapestry-migration-cli run button -p ./src/components --js-theme ./theme.js --report-path ./migration-report.md
121
128
  ```
122
129
 
130
+ ### Listing available migrations
131
+
132
+ Use `list --json` to discover available migrations programmatically:
133
+
134
+ ```bash
135
+ npx @planningcenter/tapestry-migration-cli list --json
136
+ ```
137
+
138
+ **Stable JSON contract (stdout, exit 0):**
139
+
140
+ ```json
141
+ {
142
+ "schemaVersion": 1,
143
+ "migrations": [
144
+ { "id": "button", "label": "Button" },
145
+ { "id": "checkbox", "label": "Checkbox" }
146
+ ]
147
+ }
148
+ ```
149
+
150
+ Contract guarantees:
151
+
152
+ - Exit code `0` and **JSON only** on stdout — no progress text or emoji.
153
+ - `schemaVersion` is the integer `1`. Future breaking changes increment this version.
154
+ - Each `id` is the exact value accepted by `run <component-name>`.
155
+ - Each `label` is nonempty display text (Spaced Title Case).
156
+ - `id`s are unique; ordering is the CLI's recommended display order.
157
+ - No `--path` required; no filesystem writes.
158
+ - Diagnostics go to **stderr** with a **nonzero** exit code.
159
+
160
+ Human-readable listing (non-contractual):
161
+
162
+ ```bash
163
+ npx @planningcenter/tapestry-migration-cli list
164
+ ```
165
+
123
166
  ## Available Components
124
167
 
125
168
  - `button` - Migrate Button components
126
169
  - `checkbox` - Migrate Checkbox components
170
+ - `date-picker` - Migrate DatePicker components
171
+ - `dropdown` - Migrate Dropdown components
172
+ - `input` - Migrate Input components
127
173
  - `link` - Migrate Link components
128
174
  - `radio` - Migrate Radio components
175
+ - `select` - Migrate Select components
176
+ - `text-area` - Migrate TextArea components
177
+ - `time-field` - Migrate TimeField components
129
178
  - `toggle-switch` - Migrate ToggleSwitch components
130
179
 
180
+ ## Preflight Assessment
181
+
182
+ Before running per-component migrations, use the `preflight` command to assess migration readiness across your `@planningcenter/tapestry-react` usage:
183
+
184
+ ```bash
185
+ npx @planningcenter/tapestry-migration-cli preflight -p ./src/components --dry-run --report-path ./migration-plan.md
186
+ ```
187
+
188
+ Preflight surfaces shorthand style props and unsupported `as` prop usage so you can plan the work. It is intended for assessment — running it with changes applied converts shorthand style props to inline `style={{}}` objects, which is rarely the desired end state. Use the per-component `run` migrations for the actual conversion.
189
+
131
190
  ## Required Arguments
132
191
 
133
192
  - `-p, --path <path>` - **REQUIRED**: Path to the folder or file to migrate