@planningcenter/tapestry-migration-cli 2.5.0-rc.4 → 2.5.0-rc.5
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.
- package/README.md +105 -34
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -2,37 +2,118 @@
|
|
|
2
2
|
|
|
3
3
|
A CLI tool to migrate Tapestry React components to Planning Center's Tapestry format.
|
|
4
4
|
|
|
5
|
-
## Installation
|
|
6
|
-
|
|
7
|
-
```bash
|
|
8
|
-
yarn add --dev @planningcenter/tapestry-migration-cli
|
|
9
|
-
```
|
|
10
|
-
|
|
11
5
|
## Usage
|
|
12
6
|
|
|
13
7
|
### Recommended Migration Order
|
|
14
8
|
|
|
15
9
|
For optimal results, migrate components in this order:
|
|
16
10
|
|
|
17
|
-
1. **Button components first**: `npx @planningcenter/tapestry-migration-cli run button -p ./src/components`
|
|
11
|
+
1. **Button components first**: `npx @planningcenter/tapestry-migration-cli run button -p ./src/components --js-theme ./theme.js`
|
|
18
12
|
2. **Link components second**: `npx @planningcenter/tapestry-migration-cli run link -p ./src/components`
|
|
19
13
|
|
|
20
14
|
This order ensures that Button components with navigation props are properly handled before Link components are migrated.
|
|
21
15
|
|
|
16
|
+
### Recommended Process
|
|
17
|
+
|
|
18
|
+
Consider these steps to safely migrate your components:
|
|
19
|
+
|
|
20
|
+
1. **Prepare your workspace** (recommended)
|
|
21
|
+
- Commit your current changes or create a new branch
|
|
22
|
+
- This allows you to easily review or revert changes if needed
|
|
23
|
+
|
|
24
|
+
2. **Create a theme file** (important for button migrations)
|
|
25
|
+
- Create a CommonJS file called `theme.js` at the root of your project
|
|
26
|
+
- Populate the file with your project's custom theme values using one of these methods:
|
|
27
|
+
- **Option 1**: Copy/paste your project's custom theme values directly into the file (computed values should be ignored or set)
|
|
28
|
+
- **Option 2**: Use `console.log()` to output the raw theme values in your application, then copy/paste the output from the browser console
|
|
29
|
+
- See the [How It Works > Theme File](#theme-file) section to learn more about the purpose of this file
|
|
30
|
+
- Example structure:
|
|
31
|
+
```javascript
|
|
32
|
+
// theme.js
|
|
33
|
+
exports.theme = {
|
|
34
|
+
button: {
|
|
35
|
+
themes: {
|
|
36
|
+
primary: {
|
|
37
|
+
outline: {
|
|
38
|
+
color: 'var(--t-text-color-default-primary)',
|
|
39
|
+
hover: {
|
|
40
|
+
backgroundColor:
|
|
41
|
+
'var(--t-fill-color-button-neutral-outline-dim-hover)',
|
|
42
|
+
},
|
|
43
|
+
stroke: 'var(--t-border-color-button-neutral)',
|
|
44
|
+
},
|
|
45
|
+
...
|
|
46
|
+
},
|
|
47
|
+
...
|
|
48
|
+
}
|
|
49
|
+
...
|
|
50
|
+
}
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
3. **Consider your scope**
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
# Run the migration on a directory (button migrations require --js-theme)
|
|
57
|
+
npx @planningcenter/tapestry-migration-cli run button -p ./src/javascript/components --js-theme ./theme.js
|
|
58
|
+
|
|
59
|
+
# Or run the migration on a specific feature
|
|
60
|
+
npx @planningcenter/tapestry-migration-cli run button -p ./src/features/checkout --js-theme ./theme.js
|
|
61
|
+
|
|
62
|
+
# Or run migration on a specific page, view, or single file
|
|
63
|
+
npx @planningcenter/tapestry-migration-cli run button -p ./src/components/ButtonExample.tsx --js-theme ./theme.js
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
- Start with a manageable scope to understand the migration changes
|
|
67
|
+
- For button migrations, include `--js-theme ./theme.js` to reference the theme file created in step 2
|
|
68
|
+
- Use `--report-path` to generate a migration report for review (will default to MIGRATION_REPORT.md if not specified)
|
|
69
|
+
|
|
70
|
+
4. **Review the migration report and changed files**
|
|
71
|
+
- Check the generated migration report (default: `MIGRATION_REPORT.md`)
|
|
72
|
+
- Review the actual file changes using `git diff` or your editor
|
|
73
|
+
- Understand what transformations were applied
|
|
74
|
+
- Use `--verbose` to see `CHANGED` comments in your code indicating what was automatically migrated
|
|
75
|
+
- **Alternative approach**: Run with `--verbose` and `--report-path` to generate a detailed migration report, save the report for planning purposes, then revert the changes (`git stash` or your editor's revert feature). You can re-run the migration later when ready to proceed:
|
|
76
|
+
```bash
|
|
77
|
+
npx @planningcenter/tapestry-migration-cli run button -p ./src/components --js-theme ./theme.js --verbose --report-path ./migration-plan.md
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
5. **Discard or revert changes if needed**
|
|
81
|
+
- If you're not ready to keep the changes, revert to discard the changes
|
|
82
|
+
- You can always re-run the migration later when ready
|
|
83
|
+
|
|
84
|
+
6. **Review TODO comments**
|
|
85
|
+
- Search for `TODO: tapestry-migration ([scope])` comments in your codebase
|
|
86
|
+
|
|
87
|
+
```bash
|
|
88
|
+
# Example
|
|
89
|
+
TODO: tapestry-migration (href)
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
- These indicate props that need manual migration
|
|
93
|
+
- Each TODO includes guidance on how to handle the unsupported prop
|
|
94
|
+
|
|
95
|
+
7. **Test your application**
|
|
96
|
+
- Run your test suite
|
|
97
|
+
- Manually verify migrated components work as expected
|
|
98
|
+
- Pay special attention to any components with TODO comments
|
|
99
|
+
|
|
100
|
+
8. **Commit your changes**
|
|
101
|
+
- Commit the automated migrations
|
|
102
|
+
- Handle unsupported props in separate commits if needed
|
|
103
|
+
- Once comfortable, migrate larger scopes incrementally
|
|
104
|
+
|
|
22
105
|
### Basic Commands
|
|
23
106
|
|
|
24
107
|
```bash
|
|
25
108
|
# Apply the migration changes (default behavior)
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
# Preview changes without writing (dry run)
|
|
29
|
-
npx @planningcenter/tapestry-migration-cli run button -p ./src/components --dry-run
|
|
109
|
+
# Button migrations require --js-theme flag
|
|
110
|
+
npx @planningcenter/tapestry-migration-cli run button -p ./src/components --js-theme ./theme.js
|
|
30
111
|
|
|
31
112
|
# Run with verbose output
|
|
32
|
-
npx @planningcenter/tapestry-migration-cli run button -p ./src/components --verbose
|
|
113
|
+
npx @planningcenter/tapestry-migration-cli run button -p ./src/components --js-theme ./theme.js --verbose
|
|
33
114
|
|
|
34
115
|
# Generate a migration report
|
|
35
|
-
npx @planningcenter/tapestry-migration-cli run button -p ./src/components --report-path ./migration-report.md
|
|
116
|
+
npx @planningcenter/tapestry-migration-cli run button -p ./src/components --js-theme ./theme.js --report-path ./migration-report.md
|
|
36
117
|
```
|
|
37
118
|
|
|
38
119
|
## Available Components
|
|
@@ -47,7 +128,7 @@ npx @planningcenter/tapestry-migration-cli run button -p ./src/components --repo
|
|
|
47
128
|
## Optional Arguments
|
|
48
129
|
|
|
49
130
|
- `-d, --dry-run` - Preview changes without writing to files (default: writes changes)
|
|
50
|
-
- `-v, --verbose` - Show detailed output
|
|
131
|
+
- `-v, --verbose` - Show detailed output including automated changes
|
|
51
132
|
- `-j, --js-theme <path>` - Path to JavaScript theme file
|
|
52
133
|
- `-r, --report-path <path>` - Path for migration report (default: MIGRATION_REPORT.md)
|
|
53
134
|
|
|
@@ -59,6 +140,16 @@ The migration tool automatically transforms your components to match Planning Ce
|
|
|
59
140
|
- Updating import statements and component references
|
|
60
141
|
- Adjusting prop names and values to match current API
|
|
61
142
|
|
|
143
|
+
### Theme File
|
|
144
|
+
|
|
145
|
+
The `theme.js` file (provided via `--js-theme`) is used to retrieve theme values during migration. These theme values are used to transform theme-based values into valid style props. When the migration tool encounters theme values in your components, it references this file to:
|
|
146
|
+
|
|
147
|
+
- Look up theme tokens and design values
|
|
148
|
+
- Convert theme-based styling to appropriate style prop values
|
|
149
|
+
- Ensure migrated components maintain visual consistency with your project's design system
|
|
150
|
+
|
|
151
|
+
The theme file should contain your project's complete theme structure, including all design tokens, colors, spacing, typography, and component-specific theme values that are used in your Tapestry React components.
|
|
152
|
+
|
|
62
153
|
### Unsupported Props
|
|
63
154
|
|
|
64
155
|
For properties that cannot be automatically migrated, the tool will:
|
|
@@ -84,23 +175,3 @@ The comment includes guidance on how to handle the unsupported prop. Common reco
|
|
|
84
175
|
- Using CSS classes for styling instead of props
|
|
85
176
|
- Moving state-based styles (hover, focus, active) to CSS selectors
|
|
86
177
|
- Applying responsive styles through CSS media queries
|
|
87
|
-
|
|
88
|
-
## Alternative: Local Installation
|
|
89
|
-
|
|
90
|
-
If you prefer to install it locally and use a shorter command:
|
|
91
|
-
|
|
92
|
-
```bash
|
|
93
|
-
# Install locally
|
|
94
|
-
yarn add --dev @planningcenter/tapestry-migration-cli
|
|
95
|
-
|
|
96
|
-
# Add to package.json scripts
|
|
97
|
-
{
|
|
98
|
-
"scripts": {
|
|
99
|
-
"migrate": "tapestry-migration-cli"
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
# Then run (following recommended order)
|
|
104
|
-
yarn migrate run button -p app/javascript/components
|
|
105
|
-
yarn migrate run link -p app/javascript/components
|
|
106
|
-
```
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@planningcenter/tapestry-migration-cli",
|
|
3
|
-
"version": "2.5.0-rc.
|
|
3
|
+
"version": "2.5.0-rc.5",
|
|
4
4
|
"description": "CLI tool for Tapestry migrations",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -51,5 +51,5 @@
|
|
|
51
51
|
"publishConfig": {
|
|
52
52
|
"access": "public"
|
|
53
53
|
},
|
|
54
|
-
"gitHead": "
|
|
54
|
+
"gitHead": "7510de206443c259c4c885252e6ff59f15bf8668"
|
|
55
55
|
}
|