Skip to content

adrians5j/replace-in-path

Repository files navigation

Build code style: prettier PRs Welcome

Install

npm install replace-in-path --save-dev

Or if you prefer yarn:

yarn add replace-in-path --dev

Quick Example:

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
);

About

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

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published