Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

replace-in-files-cli

Package Overview
Dependencies
Maintainers
0
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

replace-in-files-cli - npm Package Compare versions

Comparing version 2.2.0 to 3.0.0

8

api.d.ts
export default function replaceInFiles(
path: string | string[],
options: {
find: Array<string | RegExp>,
replacement: string,
ignoreCase?: boolean,
glob?: boolean
find: Array<string | RegExp>;
replacement: string;
ignoreCase?: boolean;
glob?: boolean;
},
): Promise<void>;

@@ -31,7 +31,7 @@ import process from 'node:process';

replacement = replacement
.replace(/\\n/g, '\n')
.replace(/\\r/g, '\r')
.replace(/\\t/g, '\t');
.replaceAll('\\n', '\n')
.replaceAll('\\r', '\r')
.replaceAll('\\t', '\t');
// TODO: Drop the `normalizePath` call when https://github.com/mrmlnc/fast-glob/issues/240 is fixed.
// TODO: Drop the `normalizePath` call when `convertPathToPattern` from `fast-glob` is added to globby.
filePaths = glob ? await globby(filePaths.map(filePath => normalizePath(filePath))) : [...new Set(filePaths.map(filePath => normalizePath(path.resolve(filePath))))];

@@ -38,0 +38,0 @@

@@ -59,12 +59,10 @@ #!/usr/bin/env node

(async () => {
await replaceInFiles(cli.input, {
find: [
...cli.flags.string,
...cli.flags.regex.map(regexString => new RegExp(regexString, 'g')),
],
replacement: cli.flags.replacement,
ignoreCase: cli.flags.ignoreCase,
glob: cli.flags.glob,
});
})();
await replaceInFiles(cli.input, {
find: [
...cli.flags.string,
...cli.flags.regex.map(regexString => new RegExp(regexString, 'g')),
],
replacement: cli.flags.replacement,
ignoreCase: cli.flags.ignoreCase,
glob: cli.flags.glob,
});
{
"name": "replace-in-files-cli",
"version": "2.2.0",
"version": "3.0.0",
"description": "Replace matching strings and regexes in files",

@@ -21,8 +21,8 @@ "license": "MIT",

},
"sideEffects": false,
"engines": {
"node": "^12.20.0 || ^14.13.1 || >=16.0.0"
"node": ">=18"
},
"scripts": {
"//test": "xo && ava",
"test": "ava"
"test": "xo && ava"
},

@@ -54,13 +54,13 @@ "files": [

"escape-string-regexp": "^5.0.0",
"globby": "^12.0.2",
"meow": "^10.1.1",
"globby": "^14.0.1",
"meow": "^13.2.0",
"normalize-path": "^3.0.0",
"write-file-atomic": "^3.0.3"
"write-file-atomic": "^5.0.1"
},
"devDependencies": {
"ava": "^3.15.0",
"execa": "^5.1.1",
"ava": "^6.1.3",
"execa": "^9.3.0",
"temp-write": "^5.0.0",
"xo": "^0.46.4"
"xo": "^0.58.0"
}
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc