replacy

0.1.8 • Public • Published

replacy

Replace one term with another in a directory, including file names and their contents.

Installation

CLI version

$ npm install replacy -g

For development

$ npm install replacy -s

Usage

CLI

$ replacy {oldExp} {newExp}
where:
{oldExp} is the expression to be replaced
{newExp} is the replacement

$ replacy oldFoo newBar

For development

Functions:
rename(path, justFiles, oldExp, newExp) -> renames all files [and folders if justFiles=false]. Doesn't touches its contents.
replaceContent(path, oldExp, newExp) -> replaces oldExp with newExp inside all files. Doesn't changes file names.
renameAndReplace(path, oldExp, newExp) -> run all together. Uses 'justFiles' = true to rename

Params:
-- justFiles: bool -> true=rename only files; false=include folders
-- path: string -> working dir
-- oldExp: string -> expression to be replaced
-- newExp: string -> replacement

Using:
var replacy = require('replacy')
replacy.rename('/someDir', true||false, 'oldFoo', 'newBar')
replacy.replaceContent('/someDir', 'oldFoo', 'newBar')
replacy.renameAndReplace('/someDir', 'oldFoo', 'newBar')

Important

The action is made recursively, the only exception is .git directory. All the rest will be changed (according with the search expression).

Readme

Keywords

none

Package Sidebar

Install

npm i replacy

Weekly Downloads

0

Version

0.1.8

License

MIT

Last publish

Collaborators

  • jdanper