Skip to content

Commit 3c472c1

Browse files
committed
feature(files) add madrun
1 parent 118a12b commit 3c472c1

File tree

7 files changed

+46
-30
lines changed

7 files changed

+46
-30
lines changed

.eslintrc

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

.eslintrc.json

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
"overrides": [{
3+
"files": ["test/**"],
4+
"rules": {
5+
"node/no-unpublished-require": "off"
6+
}
7+
}],
8+
"extends": [
9+
"plugin:putout/recommended",
10+
"plugin:node/recommended"
11+
],
12+
"plugins": [
13+
"putout",
14+
"node"
15+
]
16+
}

.npmignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
11
.*
22

3+
madrun.js
4+

lib/files.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ async function pipeFiles(read, write, options = {}) {
4545
const isStrRead = typeof read === 'string';
4646
const isStrWrite = typeof write === 'string';
4747
const optionsRead = {
48-
bufferSize: 4 * 1024
48+
bufferSize: 4 * 1024,
4949
};
5050

5151
assert(read, 'read could not be empty!');

madrun.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
'use strict';
2+
3+
const {run} = require('madrun');
4+
5+
module.exports = {
6+
'fix:lint': () => run('lint', '--fix'),
7+
'lint': () => 'putout lib test madrun.js',
8+
'lint:test': () => 'putout -c .putoutrc.test test',
9+
'test': () => 'tape test/*.js',
10+
'coverage': () => 'nyc npm test',
11+
'report': () => 'nyc report --reporter=text-lcov | coveralls',
12+
};
13+

package.json

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,12 @@
1010
"url": "git://github.com/coderaiser/files-io.git"
1111
},
1212
"scripts": {
13-
"lint": "redrun lint:*",
14-
"lint:lib": "eslint lib",
15-
"lint:test": "eslint -c .eslintrc.test test",
16-
"test": "tape test/*.js",
17-
"coverage": "nyc npm test",
18-
"report": "nyc report --reporter=text-lcov | coveralls"
13+
"fix:lint": "madrun fix:lint",
14+
"lint": "madrun lint",
15+
"lint:test": "madrun lint:test",
16+
"test": "madrun test",
17+
"coverage": "madrun coverage",
18+
"report": "madrun report"
1919
},
2020
"keywords": [
2121
"files",
@@ -32,8 +32,11 @@
3232
"coveralls": "^3.0.2",
3333
"eslint": "^6.4.0",
3434
"eslint-plugin-node": "^10.0.0",
35+
"eslint-plugin-putout": "^2.0.0",
36+
"madrun": "^3.0.3",
3537
"nyc": "^14.1.1",
3638
"redrun": "^7.0.2",
39+
"supertape": "^1.2.3",
3740
"tape": "^4.9.1",
3841
"try-to-catch": "^1.0.2"
3942
}

test/files.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ const os = require('os');
55
const {join} = require('path');
66

77
const tryToCatch = require('try-to-catch');
8-
const test = require('tape');
8+
const test = require('supertape');
99
const files = require('..');
1010

1111
test('files: read', async (t) => {
@@ -20,7 +20,7 @@ test('files: read', async (t) => {
2020
const expected = {
2121
[`${dir}/package.json`]: fs.readFileSync(`${dir}/package.json`),
2222
[`${dir}/README.md`]: fs.readFileSync(`${dir}/README.md`),
23-
}
23+
};
2424

2525
t.deepEqual(result, expected, 'should equal');
2626
t.end();
@@ -45,7 +45,7 @@ test('files: pipe: gzip', async (t) => {
4545
const to = join(tmpDir, 'README_COPY.gz');
4646

4747
const [e] = await tryToCatch(files.pipe, from, to, {
48-
gzip: true
48+
gzip: true,
4949
});
5050

5151
fs.unlinkSync(to);
@@ -60,7 +60,7 @@ test('files: pipe: gunzip', async (t) => {
6060
const to = join(tmpDir, 'README_COPY.gz');
6161

6262
const [e] = await tryToCatch(files.pipe, from, to, {
63-
gunzip: true
63+
gunzip: true,
6464
});
6565

6666
t.ok(e, 'should be error');
@@ -77,7 +77,7 @@ test('files: pipe: range', async (t) => {
7777
range: {
7878
start: 0,
7979
end: 10,
80-
}
80+
},
8181
});
8282

8383
fs.unlinkSync(to);

0 commit comments

Comments
 (0)