@planningcenter/tapestry-migration-cli 2.4.0-rc.13 → 2.4.0-rc.15
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 +100 -6
- package/package.json +2 -2
- package/src/index.ts +18 -7
package/README.md
CHANGED
|
@@ -1,12 +1,106 @@
|
|
|
1
1
|
# tapestry-migration-cli
|
|
2
2
|
|
|
3
|
-
A
|
|
3
|
+
A CLI tool to migrate Tapestry React components to Planning Center's Tapestry format.
|
|
4
4
|
|
|
5
|
-
##
|
|
5
|
+
## Installation
|
|
6
6
|
|
|
7
7
|
```bash
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
8
|
+
yarn add --dev @planningcenter/tapestry-migration-cli
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Usage
|
|
12
|
+
|
|
13
|
+
### Recommended Migration Order
|
|
14
|
+
|
|
15
|
+
For optimal results, migrate components in this order:
|
|
16
|
+
|
|
17
|
+
1. **Button components first**: `npx @planningcenter/tapestry-migration-cli run button -p ./src/components --fix`
|
|
18
|
+
2. **Link components second**: `npx @planningcenter/tapestry-migration-cli run link -p ./src/components --fix`
|
|
19
|
+
|
|
20
|
+
This order ensures that Button components with navigation props are properly handled before Link components are migrated.
|
|
21
|
+
|
|
22
|
+
### Basic Commands
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
# Run a dry-run migration (preview changes)
|
|
26
|
+
npx @planningcenter/tapestry-migration-cli run button -p ./src/components
|
|
27
|
+
|
|
28
|
+
# Apply the migration changes
|
|
29
|
+
npx @planningcenter/tapestry-migration-cli run button -p ./src/components --fix
|
|
30
|
+
|
|
31
|
+
# Run with verbose output
|
|
32
|
+
npx @planningcenter/tapestry-migration-cli run button -p ./src/components --fix --verbose
|
|
33
|
+
|
|
34
|
+
# Generate a migration report
|
|
35
|
+
npx @planningcenter/tapestry-migration-cli run button -p ./src/components --fix --report-path ./migration-report.md
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
## Available Components
|
|
39
|
+
|
|
40
|
+
- `button` - Migrate Button components
|
|
41
|
+
- `link` - Migrate Link components
|
|
42
|
+
|
|
43
|
+
## Required Arguments
|
|
44
|
+
|
|
45
|
+
- `-p, --path <path>` - **REQUIRED**: Path to the folder or file to migrate
|
|
46
|
+
|
|
47
|
+
## Optional Arguments
|
|
48
|
+
|
|
49
|
+
- `-f, --fix` - Write changes to files (without this flag, it's a dry run)
|
|
50
|
+
- `-v, --verbose` - Show detailed output
|
|
51
|
+
- `-j, --js-theme <path>` - Path to JavaScript theme file
|
|
52
|
+
- `-r, --report-path <path>` - Path for migration report (default: MIGRATION_REPORT.md)
|
|
53
|
+
|
|
54
|
+
## How It Works
|
|
55
|
+
|
|
56
|
+
The migration tool automatically transforms your components to match Planning Center's current Tapestry specifications. Most property and usage changes are handled automatically, including:
|
|
57
|
+
|
|
58
|
+
- Converting deprecated props to their modern equivalents
|
|
59
|
+
- Updating import statements and component references
|
|
60
|
+
- Adjusting prop names and values to match current API
|
|
61
|
+
|
|
62
|
+
### Unsupported Props
|
|
63
|
+
|
|
64
|
+
For properties that cannot be automatically migrated, the tool will:
|
|
65
|
+
|
|
66
|
+
1. **Keep the prop as-is** - The prop remains in your code but will not work with the new Tapestry component
|
|
67
|
+
2. **Add a TODO comment** - Flagging the prop for manual migration
|
|
68
|
+
|
|
69
|
+
Example of an unsupported prop comment:
|
|
70
|
+
|
|
71
|
+
```tsx
|
|
72
|
+
<Button
|
|
73
|
+
/* TODO: tapestry-migration (propName): 'mediaQueries' is not supported, please migrate as needed.
|
|
74
|
+
* It is recommended to use CSS media queries in a class that you apply to the component.
|
|
75
|
+
*/
|
|
76
|
+
mediaQueries={{ mobile: { fontSize: 14 } }}
|
|
77
|
+
>
|
|
78
|
+
Click me
|
|
79
|
+
</Button>
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
The comment includes guidance on how to handle the unsupported prop. Common recommendations include:
|
|
83
|
+
|
|
84
|
+
- Using CSS classes for styling instead of props
|
|
85
|
+
- Moving state-based styles (hover, focus, active) to CSS selectors
|
|
86
|
+
- 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 --fix
|
|
105
|
+
yarn migrate run link -p app/javascript/components --fix
|
|
12
106
|
```
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@planningcenter/tapestry-migration-cli",
|
|
3
|
-
"version": "2.4.0-rc.
|
|
3
|
+
"version": "2.4.0-rc.15",
|
|
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": "075251730bff10ccb077d64601c754d19726cd2e"
|
|
55
55
|
}
|
package/src/index.ts
CHANGED
|
@@ -15,9 +15,15 @@ const COMPONENTS = ["button", "link"]
|
|
|
15
15
|
program
|
|
16
16
|
.command("run")
|
|
17
17
|
.description("Run a migration of a component from Tapestry React to Tapestry")
|
|
18
|
-
.argument(
|
|
19
|
-
|
|
20
|
-
|
|
18
|
+
.argument(
|
|
19
|
+
"<component-name>",
|
|
20
|
+
"The name of the component to migrate (button, link)"
|
|
21
|
+
)
|
|
22
|
+
.requiredOption(
|
|
23
|
+
"-p, --path <path>",
|
|
24
|
+
"REQUIRED: The path to the folder/file to migrate"
|
|
25
|
+
)
|
|
26
|
+
.option("-f, --fix", "Write the changes to files (default: dry run)")
|
|
21
27
|
.option("-v, --verbose", "Verbose output")
|
|
22
28
|
.option(
|
|
23
29
|
"-j, --js-theme <path>",
|
|
@@ -29,16 +35,21 @@ program
|
|
|
29
35
|
"MIGRATION_REPORT.md"
|
|
30
36
|
)
|
|
31
37
|
.action((componentName, options) => {
|
|
32
|
-
console.log("Hello from Tapestry Migration CLI! 🎨")
|
|
33
|
-
console.log(`Component: ${componentName}`)
|
|
34
38
|
const key = componentName.toLowerCase()
|
|
35
39
|
|
|
36
40
|
if (COMPONENTS.includes(key)) {
|
|
41
|
+
console.log(`🎨 Migrating ${componentName} components...`)
|
|
42
|
+
console.log(`📁 Target: ${options.path}`)
|
|
43
|
+
console.log(
|
|
44
|
+
`🔧 Mode: ${options.fix ? "Apply changes" : "Dry run (preview only)"}`
|
|
45
|
+
)
|
|
37
46
|
runTransforms(key, options)
|
|
38
47
|
} else {
|
|
39
|
-
console.
|
|
40
|
-
|
|
48
|
+
console.error(`❌ Invalid component: "${componentName}"`)
|
|
49
|
+
console.error(
|
|
50
|
+
`✅ Available components: ${COMPONENTS.map((c) => c.charAt(0).toUpperCase() + c.slice(1)).join(", ")}`
|
|
41
51
|
)
|
|
52
|
+
process.exit(1)
|
|
42
53
|
}
|
|
43
54
|
})
|
|
44
55
|
|