@wise/wds-codemods 0.0.1-experimental-c8c6ec3 → 0.0.1-experimental-6832f82
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 +11 -15
- package/dist/index.js +5273 -230
- package/dist/index.js.map +1 -1
- package/dist/{reportManualReview-AT6NdVJd.js → reportManualReview-CQm-npxR.js} +11 -2
- package/dist/reportManualReview-CQm-npxR.js.map +1 -0
- package/dist/transforms/{button/transformer.js → button.js} +6 -6
- package/dist/transforms/button.js.map +1 -0
- package/package.json +2 -2
- package/dist/reportManualReview-AT6NdVJd.js.map +0 -1
- package/dist/transforms/button/config.json +0 -6
- package/dist/transforms/button/transformer.js.map +0 -1
package/README.md
CHANGED
|
@@ -224,25 +224,22 @@ export default transformer;
|
|
|
224
224
|
### Adding a New Transform
|
|
225
225
|
|
|
226
226
|
1. Create a new `.ts` file in `src/transforms/your-transform-name/`.
|
|
227
|
-
2.
|
|
227
|
+
2. Export a `packageRequirements` array defining required dependencies.
|
|
228
228
|
3. Export a default function following the jscodeshift transformer signature.
|
|
229
|
-
4. Use helper utilities from `src/helpers/` for common operations.
|
|
229
|
+
4. Use helper utilities from `src/transforms/helpers/` for common operations.
|
|
230
230
|
5. Write unit tests for your transform using the `createTestTransform` utility.
|
|
231
231
|
6. Build the project to compile your transform.
|
|
232
232
|
7. Run the codemod runner and select your new transform.
|
|
233
233
|
|
|
234
234
|
### Package Requirements
|
|
235
235
|
|
|
236
|
-
Each transform should
|
|
237
|
-
required:
|
|
236
|
+
Each transform should export a `packageRequirements` array that specifies which packages and versions are required:
|
|
238
237
|
|
|
239
|
-
```
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
}
|
|
245
|
-
}
|
|
238
|
+
```ts
|
|
239
|
+
export const packageRequirements = [
|
|
240
|
+
{ name: '@wise/components', version: '>=2.0.0' },
|
|
241
|
+
{ name: '@wise/icons', version: '>=1.0.0' },
|
|
242
|
+
];
|
|
246
243
|
```
|
|
247
244
|
|
|
248
245
|
The system will automatically validate these requirements before running the transform, supporting:
|
|
@@ -254,7 +251,7 @@ The system will automatically validate these requirements before running the tra
|
|
|
254
251
|
|
|
255
252
|
### Helper Utilities
|
|
256
253
|
|
|
257
|
-
The codemod provides several helper utilities in `src/helpers/`:
|
|
254
|
+
The codemod provides several helper utilities in `src/transforms/helpers/`:
|
|
258
255
|
|
|
259
256
|
- **`hasImport`** - Check for and manipulate import statements
|
|
260
257
|
- **`processIconChildren`** - Handle icon component transformations
|
|
@@ -263,8 +260,7 @@ The codemod provides several helper utilities in `src/helpers/`:
|
|
|
263
260
|
- **JSX Element Utils** - Utilities for manipulating JSX elements and attributes
|
|
264
261
|
- **JSX Reporting Utils** - Standardised reporting for common manual review scenarios
|
|
265
262
|
|
|
266
|
-
Additional utilities are available in `src/
|
|
267
|
-
manipulation, and reporting. As this project evolves, we encourage contributors to add new utilities that can benefit the broader codemod ecosystem.
|
|
263
|
+
Additional utilities are available in `src/utils/` for common operations like file handling, AST manipulation, and reporting. As this project evolves, we encourage contributors to add new utilities that can benefit the broader codemod ecosystem.
|
|
268
264
|
|
|
269
265
|
#### Writing Unit Tests for Transforms
|
|
270
266
|
|
|
@@ -273,7 +269,7 @@ It is important that all codemod transforms have corresponding unit tests to ens
|
|
|
273
269
|
**Basic test setup:**
|
|
274
270
|
|
|
275
271
|
```ts
|
|
276
|
-
import { createTestTransform } from '
|
|
272
|
+
import { createTestTransform } from '../../helpers/createTestTransform';
|
|
277
273
|
import transform from '../my-transform';
|
|
278
274
|
|
|
279
275
|
const testTransform = createTestTransform(transform, [
|