node-elm-compiler
Advanced tools
Comparing version 0.0.1 to 0.0.2
{ | ||
"name": "node-elm-compiler", | ||
"version": "0.0.1", | ||
"version": "0.0.2", | ||
"homepage": "https://github.com/rtfeldman/node-elm-compiler", | ||
@@ -5,0 +5,0 @@ "authors": [ |
var compile = require("../index.js").compile; | ||
compile(["./HelloWorld.elm"], { | ||
output: "compiled-hello-world.js", | ||
onFinished: function() { | ||
console.log("Finished!"); | ||
} | ||
}) | ||
output: "compiled-hello-world.js" | ||
}).on('close', function(exitCode) { | ||
console.log("Finished with exit code", exitCode); | ||
}); |
12
index.js
@@ -25,3 +25,2 @@ /* | ||
warn: console.warn, | ||
onFinished: function() {}, | ||
pathToMake: __dirname + "/node_modules/elm-platform-bin/bin/elm-make", | ||
@@ -44,3 +43,3 @@ spawn: spawnChildProcess, | ||
if (!(sources instanceof Array)) { | ||
throw "compile() did not receive an Array for its list of sources." | ||
throw "compile() received neither an Array nor a String for its sources argument." | ||
} | ||
@@ -50,10 +49,11 @@ | ||
if (typeof options.spawn !== "function") { | ||
throw "options.spawn was a(n) " + (typeof options.spawn) + " instead of a function." | ||
} | ||
var compilerArgs = compilerArgsFromOptions(options, options.warn); | ||
var processArgs = sources ? sources.concat(compilerArgs) : compilerArgs; | ||
var spawnOpts = {cwd: options.cwd, env: options.env, stdio: options.stdio} | ||
var childProcess = options.spawn(options.pathToMake, processArgs, spawnOpts); | ||
childProcess.on('close', function(exitCode) { | ||
options.onFinished(exitCode); | ||
}); | ||
return options.spawn(options.pathToMake, processArgs, spawnOpts); | ||
} | ||
@@ -60,0 +60,0 @@ |
{ | ||
"name": "node-elm-compiler", | ||
"version": "0.0.1", | ||
"version": "0.0.2", | ||
"description": "A Node.js interface to the Elm compiler binaries.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
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
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
16281
101