replace-in-path
v1.1.0
Published
🔎 A small "find and replace" library that does string replacements in provided paths.
Downloads
2,137
Readme
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
);