From 749d3151b11bc33d0e2dcd91f33a5e0a2f03a1ed Mon Sep 17 00:00:00 2001
From: Igor Klopov <igor@klopov.com>
Date: Fri, 9 Dec 2016 12:12:48 +0300
Subject: [PATCH] compatibility with yarn

---
 index.js | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/index.js b/index.js
index b9d3c44..a4883b4 100644
--- a/index.js
+++ b/index.js
@@ -19,10 +19,16 @@ function inCommand (cmd) {
   return false
 }
 
+function inYarn () {
+  return /\byarn\b/.test(process.env['npm_config_user_agent']);
+}
+
 exports.inPublish = function () {
+  if (inYarn()) return false;
   return inCommand(/^pu(b(l(i(sh?)?)?)?)?$/)
 }
 
 exports.inInstall = function () {
+  if (inYarn()) return true;
   return inCommand(/^i(n(s(t(a(ll?)?)?)?)?)?$/)
 }