Skip to content

Commit

Permalink
Move handling of older versions of node to the top
Browse files Browse the repository at this point in the history
  • Loading branch information
victorporof committed Jul 20, 2014
1 parent 7c6ad50 commit 6b84ba5
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions scripts/run.js
Expand Up @@ -9,6 +9,10 @@ var fs = require("fs");
var jshint = require("jshint/src/jshint.js").JSHINT;
var minify = require("jsonminify");

// Older versions of node have `existsSync` in the `path` module, not `fs`. Meh.
fs.existsSync = fs.existsSync || path.existsSync;
path.sep = path.sep || "/";

var tempPath = process.argv[2] || ""; // The source file to be linted.
var filePath = process.argv[3] || ""; // The original source's path.
var pluginFolder = path.dirname(__dirname);
Expand Down Expand Up @@ -76,10 +80,6 @@ function setOptions(file, isPackageJSON, optionsStore, globalsStore) {
var jshintrcPath;
var packagejsonPath;

// Older versions of node has `existsSync` in the path module, not fs. Meh.
fs.existsSync = fs.existsSync || path.existsSync;
path.sep = path.sep || "/";

// Try and get some persistent options from the plugin folder.
if (fs.existsSync(jshintrcPath = pluginFolder + path.sep + ".jshintrc")) {
setOptions(jshintrcPath, false, options, globals);
Expand Down

0 comments on commit 6b84ba5

Please sign in to comment.