@wise/wds-codemods 0.0.1-experimental-db88b03 → 0.0.1-experimental-795f13a

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,22 +224,25 @@ 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. Export a `packageRequirements` array defining required dependencies.
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.
228
228
  3. Export a default function following the jscodeshift transformer signature.
229
- 4. Use helper utilities from `src/transforms/helpers/` for common operations.
229
+ 4. Use helper utilities from `src/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 export a `packageRequirements` array that specifies which packages and versions are required:
236
+ Each transform should have `prerequisites` defined in `config.json` that specifies which packages and versions are
237
+ required:
237
238
 
238
- ```ts
239
- export const packageRequirements = [
240
- { name: '@wise/components', version: '>=2.0.0' },
241
- { name: '@wise/icons', version: '>=1.0.0' },
242
- ];
239
+ ```json
240
+ {
241
+ "prerequisites": {
242
+ "@wise/components": ">=2.0.0",
243
+ "@wise/icons": "^1.0.0"
244
+ }
245
+ }
243
246
  ```
244
247
 
245
248
  The system will automatically validate these requirements before running the transform, supporting:
@@ -251,7 +254,7 @@ The system will automatically validate these requirements before running the tra
251
254
 
252
255
  ### Helper Utilities
253
256
 
254
- The codemod provides several helper utilities in `src/transforms/helpers/`:
257
+ The codemod provides several helper utilities in `src/helpers/`:
255
258
 
256
259
  - **`hasImport`** - Check for and manipulate import statements
257
260
  - **`processIconChildren`** - Handle icon component transformations
@@ -260,7 +263,8 @@ The codemod provides several helper utilities in `src/transforms/helpers/`:
260
263
  - **JSX Element Utils** - Utilities for manipulating JSX elements and attributes
261
264
  - **JSX Reporting Utils** - Standardised reporting for common manual review scenarios
262
265
 
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.
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.
264
268
 
265
269
  #### Writing Unit Tests for Transforms
266
270
 
@@ -269,7 +273,7 @@ It is important that all codemod transforms have corresponding unit tests to ens
269
273
  **Basic test setup:**
270
274
 
271
275
  ```ts
272
- import { createTestTransform } from '../../helpers/createTestTransform';
276
+ import { createTestTransform } from '../../../helpers/createTestTransform';
273
277
  import transform from '../my-transform';
274
278
 
275
279
  const testTransform = createTestTransform(transform, [