A Codemod for the Intuita Registry requires four files:
- index.js (contains the codemod transformation logic)
- test.js (contains test cases to verify the codemod works)
- config.json (contains meta data about the codemod)
- readME.md (describes the codemod and what it does)
Copying and pasting these four files, and then editing each file to tailor to many different codemods is repetitive and time-consuming. The goal of this repository is to create tools to save time and to streamline the process so that Codemod importation can be a smooth and enjoyable experience.
The current template-create script prompts the user for the names of each Codemod, along with information about the engine, language, and owner and creates the templates for each Codemod. The program takes into account similarities and differences commonly shared so that developers can save time and not worry about making these tedious small edits.
Here we run the template-create script. It initially asks for the number of Codemods we create and then other information like the engine, language, and owner.
![Screen Shot 2023-10-04 at 5 57 09 PM](https://private-user-images.githubusercontent.com/44513934/272750654-93b055a9-7a47-4971-8aa5-b1b4bd5950a1.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MzkxNzYyOTUsIm5iZiI6MTczOTE3NTk5NSwicGF0aCI6Ii80NDUxMzkzNC8yNzI3NTA2NTQtOTNiMDU1YTktN2E0Ny00OTcxLThhYTUtYjFiNGJkNTk1MGExLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTAyMTAlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwMjEwVDA4MjYzNVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTkzZWNhMDc4ZmJlMmM5MTk2ZTgxMWExMjgxM2ZlNzQzY2MwNjUzZTIxMTNhODc0YzkyZmY5MjJjNThmNjg3ZjUmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.H-GaH0TF_8794pgdAUruwtswYxCEhbEPcncRF3R96MI)
The confirm to continue(y/n) allows user to make changes if typos were made.
Below we can see that two directories were made. One for the "replace_brackets_with_angle_brackets" Codemod and a second for the "v15_return_format" Codemod. Each Codemod folder has the four files mentioned earlier(index.js, test.js, config.json, and readME.md).
![Screen Shot 2023-10-04 at 5 57 26 PM](https://private-user-images.githubusercontent.com/44513934/272750631-a22ec5e4-7609-4119-bd52-cce8a6c6ec6a.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MzkxNzYyOTUsIm5iZiI6MTczOTE3NTk5NSwicGF0aCI6Ii80NDUxMzkzNC8yNzI3NTA2MzEtYTIyZWM1ZTQtNzYwOS00MTE5LWJkNTItY2NlOGE2YzZlYzZhLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTAyMTAlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwMjEwVDA4MjYzNVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWNmZjgzOGI3MmY3YjkzNjFjNzY0Y2NkOTU4ZjUyMDFjYjUwZjEwMzk1YmRjM2IwYmI4MWYzNzZhMzFjYTJiYTMmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.PJcDQSfEJafiAwWH-sr6Bn0fFIKqpWULEYxzEsnX70k)
Opening the config.json file in ~/replace_brackets_with_angle_brackets, we can view the information that was filled out by the program using our input.
![Screen Shot 2023-10-04 at 5 57 36 PM](https://private-user-images.githubusercontent.com/44513934/272750611-88827237-ae88-494f-a5c8-44a28fca29a8.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MzkxNzYyOTUsIm5iZiI6MTczOTE3NTk5NSwicGF0aCI6Ii80NDUxMzkzNC8yNzI3NTA2MTEtODg4MjcyMzctYWU4OC00OTRmLWE1YzgtNDRhMjhmY2EyOWE4LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTAyMTAlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwMjEwVDA4MjYzNVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTg4ZjEyNjI2OTFmY2I1ZmUxY2IwNDY5NmI2NzRhOTFhMGRiMjFkZjQwNDQxOWIwYjY5M2NmZDhiOTVmM2Y0NjgmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.XJW7H08JeAW7zTaMdwkFuvY0QivUnMOcpvxXYbkSeFc)
Imagine you had to import 20 Codemods from a framework or technology, this should save you a lot of copying, pasting, and editing these 4 files!