Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

improve default npm path handling #1278

Merged
merged 1 commit into from
Jul 12, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 9 additions & 8 deletions build.sh
Original file line number Diff line number Diff line change
@@ -1,38 +1,39 @@
#!/bin/bash
#!/usr/bin/env bash

if test "$OS" = "Windows_NT"
then
# use .Net

.paket/paket.bootstrapper.exe
exit_code=$?
if [ $exit_code -ne 0 ]; then
exit $exit_code
exit $exit_code
fi

.paket/paket.exe restore
exit_code=$?
if [ $exit_code -ne 0 ]; then
exit $exit_code
exit $exit_code
fi

[ ! -e build.fsx ] && .paket/paket.exe update
[ ! -e build.fsx ] && packages/build/FAKE/tools/FAKE.exe init.fsx
packages/build/FAKE/tools/FAKE.exe $@ --fsiargs -d:MONO build.fsx
packages/build/FAKE/tools/FAKE.exe $@ --fsiargs -d:MONO build.fsx
else
# use mono
mono .paket/paket.bootstrapper.exe
exit_code=$?
if [ $exit_code -ne 0 ]; then
exit $exit_code
exit $exit_code
fi

mono .paket/paket.exe restore
exit_code=$?
if [ $exit_code -ne 0 ]; then
exit $exit_code
exit $exit_code
fi

[ ! -e build.fsx ] && mono .paket/paket.exe update
[ ! -e build.fsx ] && mono packages/build/FAKE/tools/FAKE.exe init.fsx
mono packages/build/FAKE/tools/FAKE.exe $@ --fsiargs -d:MONO build.fsx
mono packages/build/FAKE/tools/FAKE.exe $@ --fsiargs -d:MONO build.fsx
fi
14 changes: 13 additions & 1 deletion src/app/FakeLib/NpmHelper.fs
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,23 @@ module Fake.NpmHelper
open Fake
open System
open System.IO
open System.Diagnostics

/// Default paths to Npm
let private npmFileName =
match isUnix with
| true -> "/usr/local/bin/npm"
| true ->
let info = new ProcessStartInfo("which","npm")
info.StandardOutputEncoding <- System.Text.Encoding.UTF8
info.RedirectStandardOutput <- true
info.UseShellExecute <- false
info.CreateNoWindow <- true
use proc = Process.Start info
proc.WaitForExit()
match proc.ExitCode with
| 0 when not proc.StandardOutput.EndOfStream ->
proc.StandardOutput.ReadLine()
| _ -> "/usr/bin/npm"
| _ -> "./packages/Npm.js/tools/npm.cmd"

/// Arguments for the Npm install command
Expand Down