node-elm-compiler
Advanced tools
Comparing version 1.0.0 to 1.0.1
19
index.js
@@ -39,12 +39,21 @@ 'use strict'; | ||
if (pathToMake === undefined) { | ||
if (!pathToMake) { | ||
// If all else fails, use the PATH. | ||
pathToMake = compilerBinaryName; | ||
try { | ||
var installation = require("elm"); | ||
// If a local node_modules/elm is installed, use that. | ||
pathToMake = require("elm")[compilerBinaryName]; | ||
pathToMake = installation.getPathTo(compilerBinaryName); | ||
} catch (err) { | ||
// If none was found, just use the PATH. | ||
pathToMake = compilerBinaryName; | ||
// Do nothing. | ||
} | ||
} | ||
if (!pathToMake) { | ||
console.error("Something went wrong and pathToMake ended up set to ", JSON.stringify(pathToMake)); | ||
process.exit(1); | ||
} | ||
try { | ||
@@ -63,3 +72,3 @@ console.log(["Running", pathToMake].concat(processArgs || []).join(" ")); | ||
} else { | ||
console.error("Exception thrown when attempting to run Elm compiler \"" + pathToMake + "\":\n" + err); | ||
console.error("Exception thrown when attempting to run Elm compiler " + JSON.stringify(pathToMake) + ":\n" + err); | ||
} | ||
@@ -66,0 +75,0 @@ |
{ | ||
"name": "node-elm-compiler", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"description": "A Node.js interface to the Elm compiler binaries. Supports Elm versions 0.15 - 0.16.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
7496
124