Skip to content

Commit

Permalink
feature(socket-file) drop support of node < 14
Browse files Browse the repository at this point in the history
  • Loading branch information
coderaiser committed Jan 19, 2021
1 parent 7039b31 commit c41acfb
Show file tree
Hide file tree
Showing 10 changed files with 56 additions and 43 deletions.
7 changes: 5 additions & 2 deletions .eslintrc.json
@@ -1,7 +1,10 @@
{
"parserOptions": {
"ecmaVersion": 2021
},
"extends": [
"plugin:putout/recommended",
"plugin:node/recommended"
"plugin:node/recommended",
"plugin:putout/recommended"
],
"plugins": [
"putout",
Expand Down
7 changes: 5 additions & 2 deletions .gitignore
@@ -1,4 +1,7 @@
node_modules
npm-debug.log
*.swp
.nyc_output
.putoutcache

node_modules
npm-debug.log
yarn-error.log
10 changes: 5 additions & 5 deletions .madrun.js → .madrun.mjs
@@ -1,11 +1,11 @@
'use strict';
import {run} from 'madrun';

const {run} = require('madrun');

module.exports = {
export default {
'test': () => 'tape test/**/*.js',
'watch:test': () => 'nodemon -w test -w lib --exec npm test',
'lint': () => 'putout lib test .madrun.js',
'lint': () => 'putout .',
'fresh:lint': () => run('lint', '--fresh'),
'lint:fresh': () => run('lint', '--fresh'),
'fix:lint': () => run('lint', '--fix'),
'lint:eslint:client': () => 'putout --config .putoutrc-client lib',
'lint:eslint:server': () => 'putout lib test',
Expand Down
3 changes: 1 addition & 2 deletions .npmignore
@@ -1,5 +1,4 @@
.*
test

madrun.js
yarn-error.log

14 changes: 14 additions & 0 deletions .nycrc.json
@@ -0,0 +1,14 @@
{
"check-coverage": false,
"all": false,
"exclude": [
"**/*.spec.js",
"**/fixture",
"test",
".*.{js,mjs}"
],
"branches": 100,
"lines": 100,
"functions": 100,
"statements": 100
}
16 changes: 6 additions & 10 deletions .travis.yml
@@ -1,17 +1,13 @@
language: node_js
node_js:
- 13
- 12
- 10

- 15
- 14
script:
- npm run lint
- npm run coverage && npm run report

notifications:
email:
on_success: never
on_failure: change

email:
on_success: never
on_failure: change
sudo: false

cache: false
21 changes: 10 additions & 11 deletions README.md
Expand Up @@ -27,22 +27,21 @@ socketFile(socket, {
prefix: 'edward',
root: '/', /* string or function */
size: '512000', /* max file size for patch */
auth: (accept, reject) => (username, password) {
auth: (accept, reject) => (username, password) => {
accept();
}
},
});
```

## License

MIT

[NPMIMGURL]: https://img.shields.io/npm/v/socket-file.svg?style=flat
[DependencyStatusIMGURL]: https://img.shields.io/david/coderaiser/node-socket-file.svg?style=flat
[LicenseIMGURL]: https://img.shields.io/badge/license-MIT-317BF9.svg?style=flat
[BuildStatusIMGURL]: https://img.shields.io/travis/coderaiser/node-socket-file/master.svg?style=flat
[NPMURL]: https://npmjs.org/package/socket-file "npm"
[DependencyStatusURL]: https://david-dm.org/coderaiser/node-socket-file "Dependency Status"
[LicenseURL]: https://tldrlegal.com/license/mit-license "MIT License"
[BuildStatusURL]: https://travis-ci.org/coderaiser/node-socket-file "Build Status"

[NPMIMGURL]: https://img.shields.io/npm/v/socket-file.svg?style=flat
[DependencyStatusIMGURL]: https://img.shields.io/david/coderaiser/node-socket-file.svg?style=flat
[LicenseIMGURL]: https://img.shields.io/badge/license-MIT-317BF9.svg?style=flat
[BuildStatusIMGURL]: https://img.shields.io/travis/coderaiser/node-socket-file/master.svg?style=flat
[NPMURL]: https://npmjs.org/package/socket-file "npm"
[DependencyStatusURL]: https://david-dm.org/coderaiser/node-socket-file "Dependency Status"
[LicenseURL]: https://tldrlegal.com/license/mit-license "MIT License"
[BuildStatusURL]: https://travis-ci.org/coderaiser/node-socket-file "Build Status"
4 changes: 2 additions & 2 deletions lib/socket-file.js
Expand Up @@ -17,8 +17,8 @@ module.exports = (sock, options) => {

if (!options)
options = {
size : 512000,
root : '/',
size: 512_000,
root: '/',
};

check(options.auth);
Expand Down
11 changes: 3 additions & 8 deletions package.json
Expand Up @@ -13,12 +13,6 @@
"coverage": "madrun coverage",
"report": "madrun report"
},
"nyc": {
"exclude": [
"**/*.spec.js",
"test"
]
},
"repository": {
"type": "git",
"url": "git://github.com/coderaiser/node-socket-file.git"
Expand Down Expand Up @@ -52,9 +46,10 @@
"putout": "^13.7.1",
"socket.io": "^3.1.0",
"socket.io-client": "^3.1.0",
"supertape": "^4.7.0"
"supertape": "^4.7.0",
"try-catch": "^3.0.0"
},
"engines": {
"node": ">=10.0.0"
"node": ">=14"
}
}
6 changes: 5 additions & 1 deletion test/socket-file.js
@@ -1,5 +1,7 @@
'use strict';

const tryCatch = require('try-catch');

const test = require('supertape');
const socketFile = require('..');
const connect = require('./connect')('socket-file', socketFile);
Expand Down Expand Up @@ -46,7 +48,9 @@ test('socket-file: options: auth not function', (t) => {
});
};

t.throws(fn, /auth should be function!/, 'should throw when auth not function');
const [error] = tryCatch(fn);

t.equal(error.message, 'auth should be function!', 'should throw when auth not function');
t.end();
});

Expand Down

0 comments on commit c41acfb

Please sign in to comment.