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
1
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 0.3.1 to 1.0.0

21

cli.js
#!/usr/bin/env node
'use strict';
const meow = require('meow');
const arrify = require('arrify');
const replaceInFiles = require('./api');

@@ -27,9 +26,12 @@

regex: {
type: 'string'
type: 'string',
isMultiple: true
},
string: {
type: 'string'
type: 'string',
isMultiple: true
},
replacement: {
type: 'string'
type: 'string',
isRequired: true
},

@@ -57,13 +59,8 @@ ignoreCase: {

// TODO: Use the required functionality in `meow` when v6 is out
if (cli.flags.replacement === undefined) {
console.error('The `--replacement` flag is required');
process.exit(1);
}
(async () => {
await replaceInFiles(cli.input, {
find: [
...arrify(cli.flags.string),
...arrify(cli.flags.regex).map(regexString => new RegExp(regexString, 'g'))
// TODO: Remove the `|| []` when `meow` 7.1.2 is out.
...(cli.flags.string || []),
...(cli.flags.regex || []).map(regexString => new RegExp(regexString, 'g'))
],

@@ -70,0 +67,0 @@ replacement: cli.flags.replacement,

{
"name": "replace-in-files-cli",
"version": "0.3.1",
"version": "1.0.0",
"description": "Replace matching strings and regexes in files",
"license": "MIT",
"repository": "sindresorhus/replace-in-files-cli",
"funding": "https://github.com/sponsors/sindresorhus",
"author": {
"name": "Sindre Sorhus",
"email": "sindresorhus@gmail.com",
"url": "sindresorhus.com"
"url": "https://sindresorhus.com"
},

@@ -16,3 +17,3 @@ "bin": {

"engines": {
"node": ">=8"
"node": ">=10"
},

@@ -46,5 +47,5 @@ "scripts": {

"arrify": "^2.0.1",
"escape-string-regexp": "^2.0.0",
"globby": "^10.0.1",
"meow": "^5.0.0",
"escape-string-regexp": "^4.0.0",
"globby": "^11.0.1",
"meow": "^7.1.1",
"normalize-path": "^3.0.0",

@@ -57,4 +58,4 @@ "write-file-atomic": "^3.0.0"

"temp-write": "^4.0.0",
"xo": "^0.24.0"
"xo": "^0.33.1"
}
}

@@ -1,6 +0,5 @@

# replace-in-files-cli [![Build Status](https://travis-ci.com/sindresorhus/replace-in-files-cli.svg?branch=master)](https://travis-ci.com/sindresorhus/replace-in-files-cli)
# replace-in-files-cli [![Build Status](https://travis-ci.com/sindresorhus/replace-in-files-cli.svg?branch=master)](https://travis-ci.com/github/sindresorhus/replace-in-files-cli)
> Replace matching strings and regexes in files
## Install

@@ -12,3 +11,2 @@

## Usage

@@ -15,0 +13,0 @@

Sorry, the diff of this file is not supported yet

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