Comparing version 0.15.1-beta3 to 0.15.1-beta4
var path = require("path"); | ||
var getPathTo = require(path.join(__dirname, "index")).getPathTo; | ||
var spawn = require("child_process").spawn; | ||
@@ -7,3 +6,2 @@ var platform = require(path.join(__dirname, "platform")); | ||
module.exports = function(executable) { | ||
var filename = getPathTo(executable); | ||
var input = process.argv.slice(2); | ||
@@ -13,4 +11,4 @@ | ||
spawn(filename, input, {stdio: 'inherit'}) | ||
spawn(platform.executablePaths[executable], input, {stdio: 'inherit'}) | ||
.on('exit', process.exit); | ||
}; |
@@ -13,11 +13,10 @@ var Promise = require("promise"); | ||
var shareReactorDir = platform.shareReactorDir; | ||
var expectedExecutablePaths = platform.executables.map(function(executable) { | ||
return path.join(distDir, executable); | ||
}); | ||
function checkBinariesPresent() { | ||
return Promise.all( | ||
expectedExecutablePaths.map(function(executable) { | ||
platform.executables.map(function(executable) { | ||
var executablePath = platform.executablePaths[executable]; | ||
return new Promise(function(resolve, reject) { | ||
fs.stat(executable, function(err, stats) { | ||
fs.stat(executablePath, function(err, stats) { | ||
if (err) { | ||
@@ -50,5 +49,3 @@ reject(executable + " was not found."); | ||
if (response.statusCode == 404) { | ||
console.log("There are currently no Elm Platform binaries available for your operating system and architecture. Building from source..."); | ||
return platform.buildFromSource().then(resolve, reject); | ||
reject("Unfortunately, there are currently no Elm Platform binaries available for your operating system and architecture.\n\nIf you would like to build Elm from source, there are instructions at https://github.com/elm-lang/elm-platform#build-from-source\n"); | ||
} | ||
@@ -55,0 +52,0 @@ |
{ | ||
"name": "elm", | ||
"version": "0.15.1-beta3", | ||
"version": "0.15.1-beta4", | ||
"description": "The Elm Platform: Binaries for the Elm programming language.", | ||
@@ -21,13 +21,8 @@ "preferGlobal": true, | ||
}, | ||
"main": "./index.js", | ||
"scripts": { | ||
"install": "node install.js", | ||
"prepublish": "node prepublish.js", | ||
"build-from-source": "node buildFromSource.js" | ||
"install": "node install.js" | ||
}, | ||
"files": [ | ||
"BuildFromSource.hs", | ||
"install.js", | ||
"platform.js", | ||
"buildFromSource.js", | ||
"binaries.json", | ||
@@ -34,0 +29,0 @@ "binwrap.js", |
@@ -12,33 +12,18 @@ var Promise = require("promise"); | ||
var shareReactorDir = path.join(shareDir, "reactor"); | ||
var executables = Object.keys(packageInfo.bin); | ||
var binaryExtension = process.platform === "win32" ? ".exe" : ""; | ||
var executablePaths = {}; | ||
function buildFromSource() { | ||
return new Promise(function(resolve, reject) { | ||
// From the "build from source" docs: | ||
// | ||
// Now that you have chosen a home for Elm-Platform/, add the absolute path | ||
// to Elm-Platform/0.15.1/.cabal-sandbox/bin to your PATH. This is | ||
// necessary to successfully build elm-reactor which relies on elm-make. | ||
process.env.PATH = (process.env.PATH || "").split(":").concat([distDir]).join(":"); | ||
executables.forEach(function(executable) { | ||
executablePaths[executable] = path.join(distDir, executable + binaryExtension); | ||
}); | ||
var child = spawn("runhaskell", ["BuildFromSource.hs", elmVersion], | ||
{stdio: "inherit"}); | ||
child.on("exit", function(exitCode) { | ||
if (exitCode === 0) { | ||
resolve(); | ||
} else { | ||
reject(exitCode); | ||
} | ||
}); | ||
}); | ||
} | ||
module.exports = { | ||
packageInfo: packageInfo, | ||
elmVersion: elmVersion, | ||
buildFromSource: buildFromSource, | ||
distDir: distDir, | ||
shareDir: shareDir, | ||
shareReactorDir: shareReactorDir, | ||
executables: Object.keys(packageInfo.bin) | ||
executablePaths: executablePaths, | ||
executables: executables | ||
}; |
@@ -14,4 +14,2 @@ npm install elm [![Build Status](https://travis-ci.org/elm-lang/elm-platform.svg?branch=master)](http://travis-ci.org/elm-lang/elm-platform) | ||
For `elm-reactor` to work properly, set your `ELM_HOME` environment variable to `/usr/local/lib/node_modules/elm/share` or the appropriate directory created on your machine. | ||
## Troubleshooting | ||
@@ -18,0 +16,0 @@ |
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
Deprecated
MaintenanceThe maintainer of the package marked it as deprecated. This could indicate that a single version should not be used, or that the package is no longer maintained and any new vulnerabilities will not be fixed.
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
Deprecated
MaintenanceThe maintainer of the package marked it as deprecated. This could indicate that a single version should not be used, or that the package is no longer maintained and any new vulnerabilities will not be fixed.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
5
10007
10
178
23