From d77b3209b024436cc26ce2d04dc579596e7da69a Mon Sep 17 00:00:00 2001 From: Ke Zhu Date: Sun, 4 May 2014 21:48:03 -0400 Subject: [PATCH] update npm login method --- pkg/plugin/publish/npm.go | 8 ++++---- pkg/plugin/publish/npm_test.go | 4 ---- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/pkg/plugin/publish/npm.go b/pkg/plugin/publish/npm.go index 865e70d8a..42b26165a 100644 --- a/pkg/plugin/publish/npm.go +++ b/pkg/plugin/publish/npm.go @@ -6,11 +6,11 @@ import ( "github.com/drone/drone/pkg/build/buildfile" ) +// use npm trick instead of running npm adduser that requires stdin var npmLoginCmd = ` -npm login < ~/.npmrc +_auth = $(echo "%s:%s" | tr -d "\r\n" | base64) +email = %s EOF ` diff --git a/pkg/plugin/publish/npm_test.go b/pkg/plugin/publish/npm_test.go index d94d7bac6..96c52581d 100644 --- a/pkg/plugin/publish/npm_test.go +++ b/pkg/plugin/publish/npm_test.go @@ -59,10 +59,6 @@ func TestNPMPublish(t *testing.T) { t.Fatalf("Can't unmarshal publish script: %s", err) } - if !strings.Contains(bscr, "npm login") { - t.Error("Expect script to contain login command") - } - if !strings.Contains(bscr, "npm publish") { t.Error("Expect script to contain install command") }