node-elm-compiler
Advanced tools
Comparing version 1.0.1 to 2.0.0
31
index.js
'use strict'; | ||
var spawnChildProcess = require('child_process').spawn; | ||
var childProcess = require("child_process"); | ||
var _ = require('lodash'); | ||
@@ -9,3 +9,3 @@ var compilerBinaryName = "elm-make"; | ||
warn: console.warn, | ||
spawn: spawnChildProcess, | ||
spawn: childProcess.spawn, | ||
pathToMake: undefined, | ||
@@ -15,2 +15,3 @@ yes: undefined, | ||
output: undefined, | ||
verbose: false | ||
}; | ||
@@ -39,26 +40,10 @@ | ||
var processOpts = {env: env, stdio: "inherit"}; | ||
var pathToMake = options.pathToMake; | ||
var pathToMake = options.pathToMake || compilerBinaryName; | ||
var verbose = options.verbose; | ||
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 = installation.getPathTo(compilerBinaryName); | ||
} catch (err) { | ||
// Do nothing. | ||
try { | ||
if (verbose) { | ||
console.log(["Running", pathToMake].concat(processArgs || []).join(" ")); | ||
} | ||
} | ||
if (!pathToMake) { | ||
console.error("Something went wrong and pathToMake ended up set to ", JSON.stringify(pathToMake)); | ||
process.exit(1); | ||
} | ||
try { | ||
console.log(["Running", pathToMake].concat(processArgs || []).join(" ")); | ||
return options.spawn(pathToMake, processArgs, processOpts) | ||
@@ -65,0 +50,0 @@ .on('error', function(err) { |
{ | ||
"name": "node-elm-compiler", | ||
"version": "1.0.1", | ||
"version": "2.0.0", | ||
"description": "A Node.js interface to the Elm compiler binaries. Supports Elm versions 0.15 - 0.16.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -5,8 +5,2 @@ # node-elm-compiler | ||
Obtains the `elm-make` executable to use in the following way: | ||
1. If you programmatically specify a path to `elm-make` through the API, runs that. | ||
2. If you do not, looks for an `elm` installation in `node_modules` and runs that. | ||
3. If that is not present, assumes `elm-make` is on your PATH and runs that. | ||
Supports Elm versions 0.15 - 0.16 | ||
@@ -21,1 +15,12 @@ | ||
``` | ||
# Releases | ||
## 2.0.0 | ||
No longer searches `node_modules/.bin` for `elm-make` - now if you don't specify | ||
a `pathToMake` option, only the one on PATH will be used as a fallback. | ||
## 1.0.0 | ||
Initial release. |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Shell access
Supply chain riskThis module accesses the system shell. Accessing the system shell increases the risk of executing arbitrary code.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Shell access
Supply chain riskThis module accesses the system shell. Accessing the system shell increases the risk of executing arbitrary code.
Found 1 instance in 1 package
25
7006
113