DEV Community

Vikash Kumar
Vikash Kumar

Posted on

Rename codebase with ease - "caselyjs"

Know the uses!

Renaming or changing files/folders is very common thing most of devs do it more often.

Cause

You've a project with 50+ files and folders. You're using camelCase for naming files and folders so far.

Then you realized I should use another case eg.- PascalCase, kebab-case.

In such case, you'll rename them manually.
Good but not Efficient.

Lets increase the numbers of file or folders to 500+


Caselyjs

Built to eliminate manual task.

Suppose, You've a project built on react using vite.

and the folder structure looks like

To organize entire codebase, You've decided to choose one naming case for the entire codebase, that is kebab-case.

To achieve this all you need caselyjs

npm i caselyjs
Enter fullscreen mode Exit fullscreen mode

Create a file parallel to src directory as rename.js ( or change.js ) anything its up to you.

Configs

import { casely } from 'caselyjs';

casely.config({
   path: 'src',
   case: 'kebab',
   file: ['js', 'jsx', 'ts', 'tsx'],
   operate: 'full'
})

casely.execute()
Enter fullscreen mode Exit fullscreen mode

npm/caselyjs

Thank You!

Top comments (1)

Some comments may only be visible to logged-in visitors. Sign in to view all comments.