node-rename
v1.1.5
Published
rename files/folders to programming case types
Downloads
6,615
Readme
node-rename ·
Tiny NodeJS package for renaming files/folders to lower
, upper
, camel
, pascal
, snake
, kebab
, train
, random
case types. Also with cli support.
Installation
- Cli usage
npm i node-rename -g
- Node package usage
npm i node-rename
CLI Examples
Cli help to get full documentation:
node-rename --help
Show files/folders by pattern without renaming them:
node-rename --pattern "./src/**"
Then if you want to rename all files/folders within src directory to kebab case add case option:
node-rename --pattern "./src/**" --type kebab
Add "--log" option to see renaming result without renaming
node-rename --pattern "./src/**" --type kebab --log
Custom renaming config
- Init config file
node-rename init
- Set up config file
- Run the config:
node-rename --pattern "./src/**" --config "./rename.config.js" --log
Node package usage
Case type functions:
import { camelCase, kebabCase, lowerCase, pascalCase, randomCase, snakeCase, trainCase, upperCase } from 'node-rename';
upperCase('some sentence!'); // "SOME SENTENCE!"
Rename files and folders:
import { nodeRename } from 'node-rename';
nodeRename({
pattern: 'src/**/*.ts',
type: 'pascal', // type is optional, type: undefined, only returns files to rename
});
// Or cusom rename config
nodeRename({
pattern: 'src/**/*.ts',
config: (name: string) => name.replace('-', ''),
});