@planningcenter/tapestry-migration-cli 2.4.0-rc.9 → 2.4.1-rc.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.
- package/README.md +100 -6
- package/dist/tapestry-react-shim.cjs +1 -1
- package/package.json +2 -2
- package/src/components/button/index.ts +3 -3
- package/src/components/button/transforms/innerRefToRef.test.ts +170 -0
- package/src/components/button/transforms/innerRefToRef.ts +14 -0
- package/src/components/button/transforms/unsupportedProps.ts +8 -31
- package/src/components/checkbox/index.ts +38 -0
- package/src/components/checkbox/transforms/childrenToLabel.test.ts +146 -0
- package/src/components/checkbox/transforms/childrenToLabel.ts +54 -0
- package/src/components/checkbox/transforms/convertStyleProps.test.ts +161 -0
- package/src/components/checkbox/transforms/convertStyleProps.ts +10 -0
- package/src/components/checkbox/transforms/innerRefToRef.test.ts +161 -0
- package/src/components/checkbox/transforms/innerRefToRef.ts +14 -0
- package/src/components/checkbox/transforms/moveCheckboxImport.test.ts +182 -0
- package/src/components/checkbox/transforms/moveCheckboxImport.ts +13 -0
- package/src/components/checkbox/transforms/sizeMapping.test.ts +193 -0
- package/src/components/checkbox/transforms/sizeMapping.ts +45 -0
- package/src/components/checkbox/transforms/unsupportedProps.test.ts +243 -0
- package/src/components/checkbox/transforms/unsupportedProps.ts +47 -0
- package/src/components/link/index.ts +14 -4
- package/src/components/link/transforms/auditSpreadProps.test.ts +351 -0
- package/src/components/link/transforms/auditSpreadProps.ts +24 -0
- package/src/components/link/transforms/innerRefToRef.test.ts +170 -0
- package/src/components/link/transforms/innerRefToRef.ts +14 -0
- package/src/components/link/transforms/moveLinkImport.test.ts +295 -0
- package/src/components/{button/transforms/linkToButton.ts → link/transforms/moveLinkImport.ts} +4 -5
- package/src/components/link/transforms/{inlineMemberToKind.test.ts → removeInlineMember.test.ts} +13 -28
- package/src/components/link/transforms/removeInlineMember.ts +11 -0
- package/src/components/link/transforms/{inlinePropToKind.test.ts → removeInlineProp.test.ts} +12 -29
- package/src/components/link/transforms/{inlinePropToKind.ts → removeInlineProp.ts} +0 -9
- package/src/components/link/transforms/tooltipToWrapper.test.ts +392 -0
- package/src/components/link/transforms/tooltipToWrapper.ts +35 -0
- package/src/components/link/transforms/unsupportedProps.test.ts +265 -0
- package/src/components/link/transforms/unsupportedProps.ts +58 -0
- package/src/components/shared/helpers/unsupportedPropsHelpers.ts +35 -0
- package/src/components/shared/transformFactories/stylePropTransformFactory.ts +1 -0
- package/src/index.ts +18 -7
- package/src/jscodeshiftRunner.ts +9 -1
- package/src/reportGenerator.ts +23 -2
- package/src/components/button/transforms/linkToButton.test.ts +0 -426
- package/src/components/link/transforms/inlineMemberToKind.ts +0 -49
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import { Transform } from "jscodeshift"
|
|
2
|
-
|
|
3
|
-
import { addAttribute } from "../../shared/actions/addAttribute"
|
|
4
|
-
import { attributeTransformFactory } from "../../shared/transformFactories/attributeTransformFactory"
|
|
5
|
-
import { componentTransformFactory } from "../../shared/transformFactories/componentTransformFactory"
|
|
6
|
-
|
|
7
|
-
const addKindAttribute = attributeTransformFactory({
|
|
8
|
-
condition: () => true, // Add to all Link.Inline elements
|
|
9
|
-
targetComponent: "Link.Inline",
|
|
10
|
-
targetPackage: "@planningcenter/tapestry-react",
|
|
11
|
-
transform: (element, { j }) => {
|
|
12
|
-
addAttribute({
|
|
13
|
-
element,
|
|
14
|
-
j,
|
|
15
|
-
name: "kind",
|
|
16
|
-
value: "inline-text",
|
|
17
|
-
})
|
|
18
|
-
return true
|
|
19
|
-
},
|
|
20
|
-
})
|
|
21
|
-
|
|
22
|
-
const transformComponent = componentTransformFactory({
|
|
23
|
-
condition: () => true, // Transform all Link.Inline elements
|
|
24
|
-
fromComponent: "Link.Inline",
|
|
25
|
-
fromPackage: "@planningcenter/tapestry-react",
|
|
26
|
-
toComponent: "Link",
|
|
27
|
-
toPackage: "@planningcenter/tapestry-react",
|
|
28
|
-
})
|
|
29
|
-
|
|
30
|
-
// Combined transform that runs both steps
|
|
31
|
-
const transform: Transform = (fileInfo, api, options) => {
|
|
32
|
-
// Step 1: Add kind attribute to Link.Inline elements
|
|
33
|
-
const result1 = addKindAttribute(fileInfo, api, options)
|
|
34
|
-
|
|
35
|
-
if (!result1) {
|
|
36
|
-
return null
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
// Step 2: Transform Link.Inline to Link
|
|
40
|
-
const result2 = transformComponent(
|
|
41
|
-
{ ...fileInfo, source: result1 as string },
|
|
42
|
-
api,
|
|
43
|
-
options
|
|
44
|
-
)
|
|
45
|
-
|
|
46
|
-
return result2 || result1
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
export default transform
|