From b3f1b703f673bc763e089a34921459c8333add24 Mon Sep 17 00:00:00 2001
From: Robert Speicher <rspeicher@gmail.com>
Date: Mon, 27 Mar 2017 20:14:38 -0400
Subject: [PATCH 1/5] Use yarn instead of npm in Makefile

---
 .gitignore |  1 +
 Makefile   | 10 +++++-----
 2 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/.gitignore b/.gitignore
index a40dd00..15b0976 100644
--- a/.gitignore
+++ b/.gitignore
@@ -49,6 +49,7 @@
 /.gitlab-shell-bundle
 /.gitlab-bundle
 /.gitlab-npm
+/.gitlab-yarn
 /gem/*.gem
 /gitlab-runner-config.toml
 /.gdk-install-root
diff --git a/Makefile b/Makefile
index b80d120..d0c509e 100644
--- a/Makefile
+++ b/Makefile
@@ -21,7 +21,7 @@ all: gitlab-setup gitlab-shell-setup gitlab-workhorse-setup support-setup gitaly
 
 # Set up the GitLab Rails app
 
-gitlab-setup: gitlab/.git gitlab-config bundler .gitlab-bundle .gitlab-npm
+gitlab-setup: gitlab/.git gitlab-config bundler .gitlab-bundle .gitlab-yarn
 
 gitlab/.git:
 	git clone ${gitlab_repo} gitlab
@@ -51,8 +51,8 @@ gitlab/public/uploads:
 	cd ${gitlab_development_root}/gitlab && bundle install --without mysql production --jobs 4
 	touch $@
 
-.gitlab-npm:
-	cd ${gitlab_development_root}/gitlab && npm install
+.gitlab-yarn:
+	cd ${gitlab_development_root}/gitlab && yarn install
 	touch $@
 
 .PHONY:	bundler
@@ -109,7 +109,6 @@ gitlab-update: gitlab/.git/pull gitlab-setup
 	@echo ""
 	cd ${gitlab_development_root}/gitlab && \
 		bundle exec rake db:migrate db:test:prepare
-	cd ${gitlab_development_root}/gitlab && npm prune
 
 gitlab-shell-update: gitlab-shell/.git/pull gitlab-shell-setup
 
@@ -312,6 +311,7 @@ clean-config:
 	nginx/conf/nginx.conf \
 
 unlock-dependency-installers:
-	rm -f .gitlab-npm \
+	rm -f \
 	.gitlab-bundle \
 	.gitlab-shell-bundle \
+	.gitlab-yarn
-- 
GitLab


From 83371d079a1a30f095ddf9b91abeafa89b6dcaab Mon Sep 17 00:00:00 2001
From: Mike Greiling <mike@pixelcog.com>
Date: Thu, 13 Apr 2017 09:51:54 -0500
Subject: [PATCH 2/5] add --pure-lockfile flag to ensure yarn does not modify
 yarn.lock when installing

---
 Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Makefile b/Makefile
index d0c509e..2cfb11e 100644
--- a/Makefile
+++ b/Makefile
@@ -52,7 +52,7 @@ gitlab/public/uploads:
 	touch $@
 
 .gitlab-yarn:
-	cd ${gitlab_development_root}/gitlab && yarn install
+	cd ${gitlab_development_root}/gitlab && yarn install --pure-lockfile
 	touch $@
 
 .PHONY:	bundler
-- 
GitLab


From 18c15cb5ee6259c00f8ba928250f9b5f1e003ffb Mon Sep 17 00:00:00 2001
From: Mike Greiling <mike@pixelcog.com>
Date: Thu, 13 Apr 2017 10:32:30 -0500
Subject: [PATCH 3/5] check that yarn is installed and print a useful error
 message if not

---
 Makefile | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/Makefile b/Makefile
index 2cfb11e..3d35592 100644
--- a/Makefile
+++ b/Makefile
@@ -21,7 +21,7 @@ all: gitlab-setup gitlab-shell-setup gitlab-workhorse-setup support-setup gitaly
 
 # Set up the GitLab Rails app
 
-gitlab-setup: gitlab/.git gitlab-config bundler .gitlab-bundle .gitlab-yarn
+gitlab-setup: gitlab/.git gitlab-config bundler .gitlab-bundle yarn .gitlab-yarn
 
 gitlab/.git:
 	git clone ${gitlab_repo} gitlab
@@ -59,6 +59,14 @@ gitlab/public/uploads:
 bundler:
 	command -v $@ > /dev/null || gem install $@
 
+.PHONY:	yarn
+yarn:
+	@command -v $@ > /dev/null || {\
+		echo "Error: Yarn executable was not detected in the system.";\
+		echo "Download Yarn at https://yarnpkg.com/en/docs/install";\
+		exit 1;\
+	}
+
 # Set up gitlab-shell
 
 gitlab-shell-setup: symlink-gitlab-shell ${gitlab_shell_clone_dir}/.git gitlab-shell/config.yml bundler .gitlab-shell-bundle gitlab-shell/.gitlab_shell_secret
-- 
GitLab


From 01e5c762d19e6d0b088fe54270c5a66829db9cc7 Mon Sep 17 00:00:00 2001
From: Mike Greiling <mike@pixelcog.com>
Date: Thu, 13 Apr 2017 10:38:54 -0500
Subject: [PATCH 4/5] use yarn to run webpack-dev-server in Procfile

---
 Procfile.example | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Procfile.example b/Procfile.example
index 76bb1a1..f63ebb1 100644
--- a/Procfile.example
+++ b/Procfile.example
@@ -15,4 +15,4 @@ rails-background-jobs: exec /usr/bin/env SIDEKIQ_LOG_ARGUMENTS=1 RAILS_ENV=devel
 #sshd: exec /usr/sbin/sshd -e -D -f /home/git/openssh/sshd_config
 #nginx: exec nginx -p /home/git/nginx -c conf/nginx.conf
 gitaly: exec gitaly/bin/gitaly /home/git/gitaly/config.toml
-webpack: exec /usr/bin/env NODE_ENV=development DEV_SERVER_PORT=3808 support/exec-cd gitlab npm run dev-server
+webpack: exec /usr/bin/env NODE_ENV=development DEV_SERVER_PORT=3808 support/exec-cd gitlab yarn dev-server
-- 
GitLab


From d9fe0935860bd83a7fe9a4ab88d4901b115a9bf7 Mon Sep 17 00:00:00 2001
From: Mike Greiling <mike@pixelcog.com>
Date: Thu, 13 Apr 2017 11:05:06 -0500
Subject: [PATCH 5/5] add installation requirements for node and yarn to
 documentation

---
 doc/prepare.md | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/doc/prepare.md b/doc/prepare.md
index 52a0f44..233936d 100644
--- a/doc/prepare.md
+++ b/doc/prepare.md
@@ -14,9 +14,14 @@ during installation.
    system Ruby
 1. Bundler, which you can install with `gem install bundler`
 1. Git version of 2.7.X or higher
+1. Node 4.3 or newer and Yarn 0.17 or newer.  If your package manage does not
+   have up-to-date versions of node or yarn available, visit the official
+   websites for [node] and [yarn] for installation instructions.
 
 [rbenv]: https://github.com/rbenv/rbenv
 [chruby]: https://github.com/postmodern/chruby
+[node]: https://nodejs.org/en/download/package-manager/
+[yarn]: https://yarnpkg.com/en/docs/install/
 
 ### OS X 10.9 (Mavericks), 10.10 (Yosemite), 10.11 (El Capitan), macOS 10.12 (Sierra)
 
@@ -27,7 +32,7 @@ Please read [the prerequisites for all platforms](#prerequisites-for-all-platfor
 ```
 brew tap homebrew/dupes
 brew tap homebrew/versions
-brew install git redis postgresql libiconv icu4c pkg-config cmake nodejs go openssl node npm coreutils
+brew install git redis postgresql libiconv icu4c pkg-config cmake nodejs go openssl node npm yarn coreutils
 bundle config build.eventmachine --with-cppflags=-I/usr/local/opt/openssl/include
 sudo npm install phantomjs-prebuilt@2.1.12 -g
 ```
@@ -37,7 +42,7 @@ sudo npm install phantomjs-prebuilt@2.1.12 -g
 We are using PostgreSQL-9.5 in the following example. If you want to use another version, please adjust paths accordingly.
 
 ```
-sudo port install git redis libiconv postgresql95-server icu pkgconfig cmake nodejs4 go openssl npm2 coreutils
+sudo port install git redis libiconv postgresql95-server icu pkgconfig cmake nodejs4 go openssl npm2 yarn coreutils
 bundle config build.eventmachine --with-cppflags=-I/opt/local/include/openssl
 sudo npm install phantomjs-prebuilt@2.1.12 -g
 echo 'export PATH=/opt/local/lib/postgresql95/bin/:$PATH' >> ~/.profile
-- 
GitLab