File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11language : c++
22sudo : false
33env :
4+ - NODE_VERSION="0.11"
5+ - NODE_VERSION="0.12"
6+ - NODE_VERSION="1"
7+ - NODE_VERSION="2"
8+ - NODE_VERSION="3"
49 - NODE_VERSION="4"
510 - NODE_VERSION="5"
611 - NODE_VERSION="6"
Original file line number Diff line number Diff line change @@ -61,7 +61,7 @@ shell.open('file.txt'); // the plugin is now available!
6161 - OS X
6262 - Windows
6363
64- This is only supported for Node v4 +
64+ This is supported for Node v0.11 +
6565
6666## Writing plugins
6767
Original file line number Diff line number Diff line change @@ -3,14 +3,22 @@ var plugin = require('shelljs/plugin');
33
44// Require whatever modules you need for your project
55var opener = require ( 'opener' ) ;
6- var pathExists = require ( 'path-exists' ) ;
6+ var fs = require ( 'fs' ) ;
7+ var pathExistsSync = function ( filePath ) {
8+ try {
9+ fs . accessSync ( filePath ) ;
10+ return true ;
11+ } catch ( e ) {
12+ return false ;
13+ }
14+ } ;
715
816// Implement your command in a function, which accepts `options` as the
917// first parameter, and other arguments after that
1018function open ( options , fileName ) {
1119 var URL_REGEX = / ^ h t t p s ? : \/ \/ .* / ;
1220
13- if ( ! pathExists . sync ( fileName ) && ! fileName . match ( URL_REGEX ) ) {
21+ if ( ! pathExistsSync ( fileName ) && ! fileName . match ( URL_REGEX ) ) {
1422 plugin . error ( 'Unable to locate file: ' + fileName ) ;
1523 }
1624
Original file line number Diff line number Diff line change 66 "scripts" : {
77 "posttest" : " npm run lint" ,
88 "test" : " mocha" ,
9- "lint" : " eslint . " ,
9+ "lint" : " node scripts/eslint-wrapper.js " ,
1010 "changelog" : " shelljs-changelog" ,
1111 "release:major" : " shelljs-release major" ,
1212 "release:minor" : " shelljs-release minor" ,
4040 "shelljs" : " ^0.7.3"
4141 },
4242 "dependencies" : {
43- "opener" : " ^1.4.1" ,
44- "path-exists" : " ^3.0.0"
43+ "opener" : " ^1.4.1"
4544 }
4645}
Original file line number Diff line number Diff line change 1+ #!/usr/bin/env node
2+
3+ var exec = require ( 'child_process' ) . exec ;
4+
5+ // var version = process.version;
6+ var version = process . version . substr ( 1 ) . split ( '.' ) ;
7+ if ( parseInt ( version [ 0 ] , 10 ) >= 4 ) {
8+ exec ( 'eslint .' , { stdio : 'inherit' } , function ( code ) {
9+ process . exit ( code ) ;
10+ } ) ;
11+ } else {
12+ console . log ( 'Linting is only supported on node v4+' ) ;
13+ process . exit ( 0 ) ;
14+ }
You can’t perform that action at this time.
0 commit comments