Skip to content

Commit 850b2f5

Browse files
committed
refactor: replace fs.existsSync
1 parent 29f33da commit 850b2f5

2 files changed

Lines changed: 4 additions & 3 deletions

File tree

index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,14 @@ var plugin = require('shelljs/plugin');
33

44
// Require whatever modules you need for your project
55
var opener = require('opener');
6-
var fs = require('fs');
6+
var pathExists = require('path-exists');
77

88
// Implement your command in a function, which accepts `options` as the
99
// first parameter, and other arguments after that
1010
function open(options, fileName) {
1111
var URL_REGEX = /^https?:\/\/.*/;
1212

13-
if (!fs.existsSync(fileName) && !fileName.match(URL_REGEX)) {
13+
if (!pathExists.sync(fileName) && !fileName.match(URL_REGEX)) {
1414
plugin.error('Unable to locate file: ' + fileName);
1515
}
1616

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
"shelljs": "^0.7.3"
4141
},
4242
"dependencies": {
43-
"opener": "^1.4.1"
43+
"opener": "^1.4.1",
44+
"path-exists": "^3.0.0"
4445
}
4546
}

0 commit comments

Comments
 (0)