Skip to content

Commit e9ac881

Browse files
committed
Require Node.js 10
Closes #12
1 parent 9deec61 commit e9ac881

File tree

5 files changed

+19
-23
lines changed

5 files changed

+19
-23
lines changed

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@ os:
44
- windows
55
language: node_js
66
node_js:
7+
- '14'
78
- '12'
89
- '10'
9-
- '8'

cli.js

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
#!/usr/bin/env node
22
'use strict';
33
const meow = require('meow');
4-
const arrify = require('arrify');
54
const replaceInFiles = require('./api');
65

76
const cli = meow(`
@@ -24,13 +23,16 @@ const cli = meow(`
2423
`, {
2524
flags: {
2625
regex: {
27-
type: 'string'
26+
type: 'string',
27+
isMultiple: true
2828
},
2929
string: {
30-
type: 'string'
30+
type: 'string',
31+
isMultiple: true
3132
},
3233
replacement: {
33-
type: 'string'
34+
type: 'string',
35+
isRequired: true
3436
},
3537
ignoreCase: {
3638
type: 'boolean',
@@ -53,17 +55,12 @@ if (!cli.flags.regex && !cli.flags.string) {
5355
process.exit(1);
5456
}
5557

56-
// TODO: Use the required functionality in `meow` when v6 is out
57-
if (cli.flags.replacement === undefined) {
58-
console.error('The `--replacement` flag is required');
59-
process.exit(1);
60-
}
61-
6258
(async () => {
6359
await replaceInFiles(cli.input, {
6460
find: [
65-
...arrify(cli.flags.string),
66-
...arrify(cli.flags.regex).map(regexString => new RegExp(regexString, 'g'))
61+
// TODO: Remove the `|| []` when `meow` 7.1.2 is out.
62+
...(cli.flags.string || []),
63+
...(cli.flags.regex || []).map(regexString => new RegExp(regexString, 'g'))
6764
],
6865
replacement: cli.flags.replacement,
6966
ignoreCase: cli.flags.ignoreCase,

license

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
3+
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (https://sindresorhus.com)
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
66

package.json

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,17 @@
44
"description": "Replace matching strings and regexes in files",
55
"license": "MIT",
66
"repository": "sindresorhus/replace-in-files-cli",
7+
"funding": "https://github.com/sponsors/sindresorhus",
78
"author": {
89
"name": "Sindre Sorhus",
910
"email": "sindresorhus@gmail.com",
10-
"url": "sindresorhus.com"
11+
"url": "https://sindresorhus.com"
1112
},
1213
"bin": {
1314
"replace-in-files": "cli.js"
1415
},
1516
"engines": {
16-
"node": ">=8"
17+
"node": ">=10"
1718
},
1819
"scripts": {
1920
"test": "xo && ava"
@@ -42,16 +43,16 @@
4243
],
4344
"dependencies": {
4445
"arrify": "^2.0.1",
45-
"escape-string-regexp": "^2.0.0",
46-
"globby": "^10.0.1",
47-
"meow": "^5.0.0",
46+
"escape-string-regexp": "^4.0.0",
47+
"globby": "^11.0.1",
48+
"meow": "^7.1.1",
4849
"normalize-path": "^3.0.0",
4950
"write-file-atomic": "^3.0.0"
5051
},
5152
"devDependencies": {
5253
"ava": "^2.1.0",
5354
"execa": "^1.0.0",
5455
"temp-write": "^4.0.0",
55-
"xo": "^0.24.0"
56+
"xo": "^0.33.1"
5657
}
5758
}

readme.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,13 @@
1-
# 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)
1+
# 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)
22

33
> Replace matching strings and regexes in files
44
5-
65
## Install
76

87
```
98
$ npm install --global replace-in-files-cli
109
```
1110

12-
1311
## Usage
1412

1513
```

0 commit comments

Comments
 (0)