replace-in-files-cli
Advanced tools
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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
1
7134
112
35
+ Added@babel/code-frame@7.26.2(transitive)
+ Added@babel/helper-validator-identifier@7.25.9(transitive)
+ Added@types/minimist@1.2.5(transitive)
+ Added@types/normalize-package-data@2.4.4(transitive)
+ Addedcamelcase@5.3.1(transitive)
+ Addedcamelcase-keys@6.2.2(transitive)
+ Addedescape-string-regexp@4.0.0(transitive)
+ Addedfind-up@4.1.0(transitive)
+ Addedglobby@11.1.0(transitive)
+ Addedhard-rejection@2.1.0(transitive)
+ Addedindent-string@4.0.0(transitive)
+ Addedjs-tokens@4.0.0(transitive)
+ Addedjson-parse-even-better-errors@2.3.1(transitive)
+ Addedkind-of@6.0.3(transitive)
+ Addedlines-and-columns@1.2.4(transitive)
+ Addedlocate-path@5.0.0(transitive)
+ Addedmap-obj@4.3.0(transitive)
+ Addedmeow@7.1.1(transitive)
+ Addedmin-indent@1.0.1(transitive)
+ Addedminimist-options@4.1.0(transitive)
+ Addedp-limit@2.3.0(transitive)
+ Addedp-locate@4.1.0(transitive)
+ Addedp-try@2.2.0(transitive)
+ Addedparse-json@5.2.0(transitive)
+ Addedpath-exists@4.0.0(transitive)
+ Addedpicocolors@1.1.1(transitive)
+ Addedquick-lru@4.0.1(transitive)
+ Addedread-pkg@5.2.0(transitive)
+ Addedread-pkg-up@7.0.1(transitive)
+ Addedredent@3.0.0(transitive)
+ Addedstrip-indent@3.0.0(transitive)
+ Addedtrim-newlines@3.0.1(transitive)
+ Addedtype-fest@0.13.10.6.00.8.1(transitive)
+ Addedyargs-parser@18.1.3(transitive)
- Removed@types/glob@7.2.0(transitive)
- Removed@types/minimatch@5.1.2(transitive)
- Removed@types/node@22.10.2(transitive)
- Removedarray-find-index@1.0.2(transitive)
- Removedbalanced-match@1.0.2(transitive)
- Removedbrace-expansion@1.1.11(transitive)
- Removedcamelcase@4.1.0(transitive)
- Removedcamelcase-keys@4.2.0(transitive)
- Removedconcat-map@0.0.1(transitive)
- Removedcurrently-unhandled@0.4.1(transitive)
- Removedescape-string-regexp@2.0.0(transitive)
- Removedfind-up@2.1.0(transitive)
- Removedfs.realpath@1.0.0(transitive)
- Removedglob@7.2.3(transitive)
- Removedglobby@10.0.2(transitive)
- Removedgraceful-fs@4.2.11(transitive)
- Removedindent-string@3.2.0(transitive)
- Removedinflight@1.0.6(transitive)
- Removedinherits@2.0.4(transitive)
- Removedjson-parse-better-errors@1.0.2(transitive)
- Removedload-json-file@4.0.0(transitive)
- Removedlocate-path@2.0.0(transitive)
- Removedloud-rejection@1.6.0(transitive)
- Removedmap-obj@2.0.0(transitive)
- Removedmeow@5.0.0(transitive)
- Removedminimatch@3.1.2(transitive)
- Removedminimist-options@3.0.2(transitive)
- Removedonce@1.4.0(transitive)
- Removedp-limit@1.3.0(transitive)
- Removedp-locate@2.0.0(transitive)
- Removedp-try@1.0.0(transitive)
- Removedparse-json@4.0.0(transitive)
- Removedpath-exists@3.0.0(transitive)
- Removedpath-is-absolute@1.0.1(transitive)
- Removedpath-type@3.0.0(transitive)
- Removedpify@3.0.0(transitive)
- Removedquick-lru@1.1.0(transitive)
- Removedread-pkg@3.0.0(transitive)
- Removedread-pkg-up@3.0.0(transitive)
- Removedredent@2.0.0(transitive)
- Removedstrip-bom@3.0.0(transitive)
- Removedstrip-indent@2.0.0(transitive)
- Removedtrim-newlines@2.0.0(transitive)
- Removedundici-types@6.20.0(transitive)
- Removedwrappy@1.0.2(transitive)
- Removedyargs-parser@10.1.0(transitive)
Updatedescape-string-regexp@^4.0.0
Updatedglobby@^11.0.1
Updatedmeow@^7.1.1