Use path-exists instead of fs.exists.

fs.exists is being deprecated, see: https://github.com/nodejs/io.js/issues/103.
This commit is contained in:
Mark-Simulacrum
2015-06-25 12:39:39 -06:00
parent 560a044d8f
commit b308602098
10 changed files with 33 additions and 26 deletions

View File

@@ -1,9 +1,10 @@
#!/usr/bin/env node
var readline = require("readline");
var child = require("child_process");
var path = require("path");
var fs = require("fs");
var pathExists = require("path-exists");
var readline = require("readline");
var child = require("child_process");
var path = require("path");
var fs = require("fs");
function spawn(cmd, args, callback) {
console.log(">", cmd, args);
@@ -98,7 +99,7 @@ var cmds = {
write("README.md", template("README.md", templateData));
if (!fs.existsSync("src")) {
if (!pathExists.sync("src")) {
fs.mkdirSync("src");
write("src/index.js", template("index.js", templateData));
}

View File

@@ -1,4 +1,5 @@
var outputFileSync = require("output-file-sync");
var pathExists = require("path-exists");
var chokidar = require("chokidar");
var slash = require("slash");
var path = require("path");
@@ -41,7 +42,7 @@ module.exports = function (commander, filenames, opts) {
};
var handle = function (filename) {
if (!fs.existsSync(filename)) return;
if (!pathExists.sync(filename)) return;
var stat = fs.statSync(filename);

View File

@@ -100,7 +100,7 @@ module.exports = function (commander, filenames, opts) {
results = [];
_.each(filenames, function (filename) {
if (!fs.existsSync(filename)) return;
if (!pathExists.sync(filename)) return;
var stat = fs.statSync(filename);
if (stat.isDirectory()) {

View File

@@ -1,6 +1,7 @@
#!/usr/bin/env node
var moduleFormatters = require("babel-core/lib/babel/transformation/modules");
var pathExists = require("path-exists");
var commander = require("commander");
var transform = require("babel-core").transform;
var kebabCase = require("lodash/string/kebabCase");
@@ -88,7 +89,7 @@ var filenames = commander.args.reduce(function (globbed, input) {
filenames = uniq(filenames);
each(filenames, function (filename) {
if (!fs.existsSync(filename)) {
if (!pathExists.sync(filename)) {
errors.push(filename + " doesn't exist");
}
});