# replace-in-path

> 🔎 A small "find and replace" library that does string replacements in provided paths.

Latest version **1.1.0** (published 2021-08-09) · MIT license · 0 weekly downloads

## Install

```sh
npm install replace-in-path
pnpm add replace-in-path
yarn add replace-in-path
bun add replace-in-path
```

Provides the command `replace-in-path`.

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.1.0 |
| Published | 2021-08-09 |
| First published | 2020-07-07 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 187.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Adrian Smijulj |
| Maintainers | adrian1210 |
| Keywords | contributors |

## Links

- npm: https://www.npmjs.com/package/replace-in-path
- Repository: https://github.com/doitadrian/replace-in-path
- Homepage: https://github.com/doitadrian/replace-in-path#readme
- Issues: https://github.com/doitadrian/replace-in-path/issues
- npm.io page: https://npm.io/package/replace-in-path

## Dependencies (1)

- [globby](https://npm.io/package/globby.md) ^11.0.1

## Recent versions

- 1.1.0 (latest) — 2021-08-09
- 1.0.4 — 2020-07-09
- 1.0.3 — 2020-07-07
- 1.0.2 — 2020-07-07
- 1.0.1 — 2020-07-07
- 1.0.0 — 2020-07-07

## README

# 

![Build](https://github.com/doitadrian/replace-in-path/workflows/Build/badge.svg)
[![](https://img.shields.io/npm/dw/replace-in-path.svg)](https://www.npmjs.com/package/replace-in-path) 
[![](https://img.shields.io/npm/v/replace-in-path.svg)](https://www.npmjs.com/package/replace-in-path)
[![code style: prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=flat-square)](https://github.com/prettier/prettier)
[![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square)](http://makeapullrequest.com)

## Install
```
npm install replace-in-path --save-dev
```

Or if you prefer yarn: 
```
yarn add replace-in-path --dev
```

## Quick Example:

```ts
const codeReplacements = [
    {
        find: `const { security } = this.context;`,
        replaceWith: `// const { security } = this.context;`,
    },
    {
        find: "const identity = await security.getIdentity",
        replaceWith: "// const identity = await security.getIdentity",
    },
    {
        find: new RegExp("createdBy: identity.*},", "gms"),
        replaceWith: "/* $& */",
    },
];

replaceInPath(
    path.join(newCodePath, "/resolvers/TargetDataModelsMutation.ts"),
    codeReplacements
);
```

---
_Source: https://npm.io/package/replace-in-path · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
