@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 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. Create `config.json` file in the same directory and set an object defining required dependencies as well as the type of the codemod.
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 have `prerequisites` defined in `config.json` that specifies which packages and versions are
237
- required:
236
+ Each transform should export a `packageRequirements` array that specifies which packages and versions are required:
238
237
 
239
- ```json
240
- {
241
- "prerequisites": {
242
- "@wise/components": ">=2.0.0",
243
- "@wise/icons": "^1.0.0"
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/controller/utils/` for common operations like file handling, AST
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 '../../../helpers/createTestTransform';
272
+ import { createTestTransform } from '../../helpers/createTestTransform';
277
273
  import transform from '../my-transform';
278
274
 
279
275
  const testTransform = createTestTransform(transform, [