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

replace-in-file

Package Overview
Dependencies
Maintainers
1
Versions
81
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

replace-in-file - npm Package Compare versions

Comparing version 2.3.2 to 2.4.0

17

bin/cli.js

@@ -18,3 +18,3 @@ #!/usr/bin/env node

//Collect main arguments
const from = argv._.shift();
let from = argv._.shift();
const to = argv._.shift();

@@ -27,2 +27,17 @@

//If the --isRegex flag is passed, send the 'from' parameter
//to the lib as a RegExp object
if (argv.isRegex) {
const flags = from.replace(/.*\/([gimy]*)$/, '$1');
const pattern = from.replace(new RegExp(`^/(.*?)/${flags}$`), '$1');
try {
from = new RegExp(pattern, flags);
}
catch (error) {
console.error('Could not create RegExp from \'from\' parameter:');
console.error(error);
process.exit(1);
}
}
//Log

@@ -29,0 +44,0 @@ console.log(`Replacing '${from}' with '${to}'`);

2

package.json
{
"name": "replace-in-file",
"version": "2.3.2",
"version": "2.4.0",
"description": "A simple utility to quickly replace text in one or more files.",

@@ -5,0 +5,0 @@ "homepage": "https://github.com/adamreisnz/replace-in-file#readme",

@@ -98,10 +98,12 @@ # Replace in file

```sh
replace-in-file from to some/file.js,some/**/glob.js
replace-in-file from to some/file.js,some/**/glob.js [--isRegex]
```
The options `allowEmptyPaths` and `encoding` are supported in the CLI.
In addition, the CLI supports the `verbose` option to list the changed files.
The flags `allowEmptyPaths` and `encoding` are supported in the CLI.
In addition, the CLI supports the `verbose` flag to list the changed files.
Multiple files or globs can be replaced by providing a comma separated list.
A regular expression may be used for the `from` parameter by specifying the `--isRegex` flag.
## License

@@ -108,0 +110,0 @@ (MIT License)

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