File tree Expand file tree Collapse file tree 12 files changed +50
-33
lines changed
Expand file tree Collapse file tree 12 files changed +50
-33
lines changed Original file line number Diff line number Diff line change 88 strategy :
99 matrix :
1010 node-version :
11- - 14.x
1211 - 16.x
13- - 17 .x
12+ - 18 .x
1413 steps :
1514 - uses : actions/checkout@v2
1615 - name : Use Node.js ${{ matrix.node-version }}
Original file line number Diff line number Diff line change @@ -10,3 +10,4 @@ dist-dev
1010
1111* .swp
1212
13+ .idea
Original file line number Diff line number Diff line change 1- # Gritty [ ![ License] [ LicenseIMGURL ]] [ LicenseURL ] [ ![ NPM version] [ NPMIMGURL ]] [ NPMURL ] [ ![ Dependency Status ] [ DependencyStatusIMGURL ]] [ DependencyStatusURL ] [ ![ Build Status] [ BuildStatusIMGURL ]] [ BuildStatusURL ] [ ![ Coverage Status] [ CoverageIMGURL ]] [ CoverageURL ]
1+ # Gritty [ ![ License] [ LicenseIMGURL ]] [ LicenseURL ] [ ![ NPM version] [ NPMIMGURL ]] [ NPMURL ] [ ![ Build Status] [ BuildStatusIMGURL ]] [ BuildStatusURL ] [ ![ Coverage Status] [ CoverageIMGURL ]] [ CoverageURL ]
22
33[ NPMIMGURL ] : https://img.shields.io/npm/v/gritty.svg?style=flat&longCache=true
44[ BuildStatusURL ] : https://github.com/cloudcmd/gritty/actions?query=workflow%3A%22Node+CI%22 " Build Status "
55[ BuildStatusIMGURL ] : https://github.com/cloudcmd/gritty/workflows/Node%20CI/badge.svg
6- [ DependencyStatusURL ] : https://david-dm.org/cloudcmd/gritty " Dependency Status "
7- [ DependencyStatusIMGURL ] : https://img.shields.io/david/cloudcmd/gritty.svg?style=flat&longCache=true
86[ LicenseIMGURL ] : https://img.shields.io/badge/license-MIT-317BF9.svg?style=flat&longCache=true
97[ NPM_INFO_IMG ] : https://nodei.co/npm/cloudcmd.png
108[ NPMURL ] : https://npmjs.org/package/cloudcmd " npm "
@@ -161,4 +159,3 @@ server.listen(port, ip);
161159## License
162160
163161MIT
164-
Original file line number Diff line number Diff line change @@ -73,8 +73,8 @@ function start(options) {
7373 const app = express ( ) ;
7474 const server = http . createServer ( app ) ;
7575
76- const ip = process . env . IP || /* c9 */
77- '0.0.0.0' ;
76+ const ip = process . env . IP /* c9 */
77+ || '0.0.0.0' ;
7878
7979 app . use ( gritty ( ) )
8080 . use ( express . static ( DIR ) ) ;
Original file line number Diff line number Diff line change 11'use strict' ;
22
3+ const isString = ( a ) => typeof a === 'string' ;
4+
35module . exports = ( el ) => {
4- if ( typeof el === 'string' )
6+ if ( isString ( el ) )
57 return document . querySelector ( el ) ;
68
79 return el ;
Original file line number Diff line number Diff line change 11'use strict' ;
22
3+ const isFn = ( a ) => typeof a === 'function' ;
4+
35module . exports = ( env ) => {
46 const obj = { } ;
57
@@ -11,7 +13,7 @@ module.exports = (env) => {
1113} ;
1214
1315function getValue ( value ) {
14- if ( typeof value === 'function' )
16+ if ( isFn ( value ) )
1517 return value ( ) ;
1618
1719 return value ;
Original file line number Diff line number Diff line change @@ -12,16 +12,16 @@ const getHost = require('./get-host');
1212const getEnv = require ( './get-env' ) ;
1313const wrap = require ( 'wraptile' ) ;
1414
15- const onConnect = wrap ( _onConnect ) ;
16- const onDisconnect = wrap ( _onDisconnect ) ;
17- const onData = currify ( _onData ) ;
18- const onTermResize = currify ( _onTermResize ) ;
19- const onTermData = currify ( _onTermData ) ;
15+ const { io} = require ( 'socket.io-client' ) ;
16+ const { Terminal} = require ( 'xterm' ) ;
2017const onWindowResize = wrap ( _onWindowResize ) ;
18+ const onTermData = currify ( _onTermData ) ;
19+ const onTermResize = currify ( _onTermResize ) ;
20+ const onData = currify ( _onData ) ;
2121
22- const { io } = require ( 'socket.io-client' ) ;
22+ const onDisconnect = wrap ( _onDisconnect ) ;
2323
24- const { Terminal } = require ( 'xterm' ) ;
24+ const onConnect = wrap ( _onConnect ) ;
2525
2626module . exports = gritty ;
2727module . exports . _onConnect = _onConnect ;
Original file line number Diff line number Diff line change 11'use strict' ;
22
3- const DIR_ROOT = __dirname + '/.. ';
3+ const isBool = ( a ) => typeof a === 'boolean ';
44
55const path = require ( 'path' ) ;
66const log = require ( 'debug' ) ( 'gritty' ) ;
@@ -11,6 +11,8 @@ const wraptile = require('wraptile');
1111const pty = require ( 'node-pty' ) ;
1212const stringArgv = require ( 'string-to-argv' ) ;
1313
14+ const DIR_ROOT = __dirname + '/..' ;
15+
1416const terminalFn = currify ( _terminalFn ) ;
1517const connectionWraped = wraptile ( connection ) ;
1618
@@ -25,10 +27,10 @@ const getDist = () => {
2527} ;
2628
2729const choose = ( a , b , options ) => {
28- if ( typeof a === 'boolean' )
30+ if ( isBool ( a ) )
2931 return a ;
3032
31- if ( typeof b === 'boolean' )
33+ if ( isBool ( b ) )
3234 return b ;
3335
3436 return options . default ;
Original file line number Diff line number Diff line change 11'use strict' ;
22
3+ const isFn = ( a ) => typeof a === 'function' ;
4+
35const http = require ( 'http' ) ;
46const { promisify} = require ( 'util' ) ;
57
@@ -11,7 +13,7 @@ const gritty = require('..');
1113module . exports = before ;
1214
1315function before ( options , fn = options ) {
14- if ( typeof options === 'function' )
16+ if ( isFn ( options ) )
1517 options = { } ;
1618
1719 const app = express ( ) ;
Original file line number Diff line number Diff line change 11'use strict' ;
22
3- const test = require ( 'supertape' ) ;
4- const stub = require ( '@cloudcmd/stub' ) ;
3+ const {
4+ test,
5+ stub,
6+ } = require ( 'supertape' ) ;
57
68const getEl = require ( '../../client/get-el' ) ;
79
You can’t perform that action at this time.
0 commit comments