Skip to content

Commit 3430779

Browse files
committed
feature(spawnify) drop support of node < 14
1 parent baec86c commit 3430779

File tree

8 files changed

+31
-35
lines changed

8 files changed

+31
-35
lines changed

.eslintrc.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"extends": [
3-
"plugin:putout/recommended",
4-
"plugin:node/recommended"
3+
"plugin:node/recommended",
4+
"plugin:putout/recommended"
55
],
66
"plugins": [
77
"putout",

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,4 @@ npm-debug.log
44

55
*.swp
66

7+
.putoutcache

.madrun.js

Lines changed: 0 additions & 9 deletions
This file was deleted.

.madrun.mjs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import {run} from 'madrun';
2+
3+
export default {
4+
'lint': () => 'putout .',
5+
'fresh:lint': () => run('lint', '--fresh'),
6+
'lint:fresh': () => run('lint', '--fresh'),
7+
'fix:lint': () => run('lint', '--fix'),
8+
};
9+

.travis.yml

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,12 @@
11
language: node_js
22
node_js:
3-
- 13
4-
- 12
5-
- 10
6-
3+
- 15
4+
- 14
75
script:
86
- npm run lint
9-
107
notifications:
11-
email:
12-
on_success: never
13-
on_failure: change
14-
8+
email:
9+
on_success: never
10+
on_failure: change
1511
sudo: false
16-
12+
cache: false

bin/spawnify.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,24 +2,24 @@
22

33
'use strict';
44

5-
var spawn,
6-
spawnify = require('../'),
7-
argv = process.argv.slice(2),
8-
command = argv.join(' ');
5+
let spawn;
6+
const spawnify = require('../');
7+
const argv = process.argv.slice(2);
8+
const command = argv.join(' ');
99

1010
if (!command) {
1111
console.log('spawnify <command>');
1212
} else {
1313
spawn = spawnify(command);
14-
spawn.on('data', function(data) {
14+
spawn.on('data', (data) => {
1515
console.log(data);
1616
});
1717

18-
spawn.on('error', function(error) {
18+
spawn.on('error', (error) => {
1919
console.error(error.message);
2020
});
2121

22-
spawn.on('close', function() {
22+
spawn.on('close', () => {
2323
console.log('closed');
2424
spawn = null;
2525
});

lib/spawnify.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ Spawnify.prototype._onMessage = function onMessage(command, options) {
5858
const symbolsExec = [
5959
'~', '>', '<', '#',
6060
'*', '&', '{', '}',
61-
'|', '\'','"', ';',
61+
'|', '\'', '"', ';',
6262
'`', '$',
6363
];
6464

@@ -235,7 +235,7 @@ Spawnify.prototype._onCD = function onCD(command, currDir) {
235235
const CD = 'cd ';
236236
const isChangeVolume = win.isChangeVolume(command);
237237
const isVolume = win.isVolume(command);
238-
const regExpRoot = RegExp('^[/\\\\]');
238+
const regExpRoot = /^[/\\]/;
239239

240240
this.on('error', () => {
241241
wasError = true;
@@ -310,7 +310,7 @@ Spawnify.prototype._getFirstWord = function getFirstWord(str) {
310310
return result[1] || str;
311311

312312
result = str.match(regExp);
313-
return result && result[1] || str;
313+
return result?.[1] || str;
314314
};
315315

316316
function getRegStrEnd() {
@@ -330,7 +330,7 @@ function isContain(str, symbols) {
330330
assert(symbols, 'symbols could not be empty!');
331331

332332
return symbols.some((symbol) => {
333-
return ~str.indexOf(symbol);
333+
return str.includes(symbol);
334334
});
335335
}
336336

package.json

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
"spawnify": "bin/spawnify.js"
1919
},
2020
"engines": {
21-
"node": ">=10"
21+
"node": ">=14"
2222
},
2323
"dependencies": {
2424
"glob": "^7.1.0",
@@ -32,8 +32,7 @@
3232
"eslint-plugin-node": "^11.0.0",
3333
"eslint-plugin-putout": "^6.11.1",
3434
"madrun": "^8.6.0",
35-
"putout": "^13.7.1",
36-
"supertape": "^4.8.0"
35+
"putout": "^13.7.1"
3736
},
3837
"publishConfig": {
3938
"access": "public"

0 commit comments

Comments
 (0)