0.1.0 • Published 1 year ago

find-repl v0.1.0

Weekly downloads
-
License
Apache-2.0
Repository
-
Last release
1 year ago

find-repl

npm coverage npm type definitions license install size

Find and replace text in your project files ✍️

  • does not modify files that git is ignoring
  • will replace all instances in a file, not just the first
  • supports regex in both CLI and API
  • can pass in a glob to scope the files to be searched/modified
  • zero dependencies, tiny footprint

Install

This package is available from the npm registry.

npm install find-repl

Usage (CLI)

When running directly from the CLI, run with npx find-repl.

USAGE:
  find-repl \
    string-to-search-for \ # (or regex:/js-regex-to-search-for/i)
    string-to-replace-with \
    [glob-of-files-to-search-in] # (optional; default all files known to git)

EXAMPLES:
  find-repl string-to-find string-to-replace-with '**/file-matcher-glob.ts'
  find-repl regex:\/\\bfoo\\b\/ bar

API

Supports JavaScript + TypeScript:

import { findRepl } from "find-repl";

await findRepl(/\bLorem\s+ipsum\b/, "Loremus ipsumus", "**/*.md");

Can also be imported via require("find-repl").

Contributing

GitHub issues / PRs welcome.

Dev environment requires:

  • node >= 16.14.0
  • npm >= 6.8.0
  • git >= 2.11

Licence

Apache-2.0