Skip to content

Commit

Permalink
Merge pull request #10178 from tamird/ui-yarn
Browse files Browse the repository at this point in the history
*: switch from npm to yarn
  • Loading branch information
tamird authored Oct 24, 2016
2 parents 36cf222 + 8071dc5 commit 00e87d0
Show file tree
Hide file tree
Showing 18 changed files with 5,237 additions and 2,497 deletions.
9 changes: 6 additions & 3 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@
1. Install the following prerequisites, as necessary:
- A C++ compiler that supports C++11. Note that GCC prior to 6.0 doesn't
work due to https://gcc.gnu.org/bugzilla/show_bug.cgi?id=48891
- A Go environment with a 64-bit version of Go 1.7.1
- A Go environment with a recent 64-bit version of the toolchain. Note that
the Makefile enforces the specific version required, as it is updated
frequently.
- Git 1.8+
- Bash

Expand All @@ -32,8 +34,9 @@ We advise to run `go generate` using our embedded Docker setup.
run `build/builder.sh env SKIP_BOOTSTRAP=0 go generate ./...` from the repository
root to get the intended result.

If you want to run it outside of Docker, `go generate` requires a collection of
Node.js modules which are installed via npm.
If you want to run it outside of Docker, `go generate` requires a collection
of Node.js modules which will be automatically installed into the project tree
(not globally).

If you plan on working on the UI, check out [the ui readme](pkg/ui).

Expand Down
2 changes: 1 addition & 1 deletion build/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@

# NPM
node_modules
npm.installed
yarn.installed
18 changes: 11 additions & 7 deletions build/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
FROM golang:1.7.1
FROM golang:1.7.3

MAINTAINER Peter Mattis <[email protected]>

RUN \
apt-key adv --keyserver pgp.mit.edu --recv D101F7899D41F3C3 && \
echo 'deb http://dl.yarnpkg.com/debian/ stable main' | tee /etc/apt/sources.list.d/yarn.list

# nodejs is used to build and test the UI.
# bzip2 and fontconfig are used by phantomjs-prebuilt to test the UI.
# iptables is used in the acceptance tests' partition nemesis.
# parallel is used to speed up `make check`.
# yarn is the dependency manager for the UI, as an alternative to npm.
RUN \
curl --silent --location https://deb.nodesource.com/setup_6.x | bash - && \
apt-get dist-upgrade -y && \
Expand All @@ -14,8 +18,8 @@ RUN \
fontconfig \
iptables \
nodejs \
parallel \
unzip \
yarn \
&& \
apt-get clean autoclean && \
apt-get autoremove -y && \
Expand All @@ -24,10 +28,10 @@ RUN \
rm -rf /tmp/*

RUN \
cd /usr/local/bin && \
curl -O --silent https://releases.hashicorp.com/terraform/0.7.3/terraform_0.7.3_linux_amd64.zip && \
unzip terraform_0.7.3_linux_amd64.zip && \
rm terraform_0.7.3_linux_amd64.zip
cd /usr/local/bin && \
curl --silent https://releases.hashicorp.com/terraform/0.7.7/terraform_0.7.7_linux_amd64.zip -o terraform_linux_amd64.zip && \
unzip terraform_linux_amd64.zip && \
rm terraform_linux_amd64.zip

ENV PATH=/opt/backtrace/bin:/third_party/llvm-build/Release+Asserts/bin:$PATH

Expand Down
2 changes: 1 addition & 1 deletion build/build-osx.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ set -eu
go get -u github.com/karalabe/xgo
# OSX 10.9 is the most recent version available at time of writing.
# If changing the OS/arch target, adjust the filename in push-aws.sh.
xgo --image cockroachdb/xgo:20160912 --targets=darwin-10.9/amd64 --go=1.7.1 --ldflags="$("$(dirname "${0}")"/ldflags.sh)" "${GOPATH%%:*}"/src/github.com/cockroachdb/cockroach
xgo --image cockroachdb/xgo:20161024 --targets=darwin-10.9/amd64 --go=1.7.3 --ldflags="$("$(dirname "${0}")"/ldflags.sh)" "${GOPATH%%:*}"/src/github.com/cockroachdb/cockroach
15 changes: 8 additions & 7 deletions build/builder.sh
Original file line number Diff line number Diff line change
Expand Up @@ -70,17 +70,18 @@ echo "${username}:x:${uid_gid}::${container_home}:/bin/bash" > "${passwd_file}"
# created as the invoking user. Docker would otherwise create them when
# mounting, but that would deny write access to the invoking user since docker
# runs as root.
mkdir -p "${HOME}"/.{jspm,npm} "${gopath0}"/pkg/docker_amd64{,_race} "${gopath0}/bin/docker_amd64"
mkdir -p "${HOME}"/.{jspm,yarn-cache} "${gopath0}"/pkg/docker_amd64{,_race} "${gopath0}/bin/docker_amd64"

# Since we're mounting both /root and /root/.{jspm,npm} in our container,
# Docker will create the .jspm and .npm on the host side under the directory
# Since we're mounting both /root and its subdirectories in our container,
# Docker will create the subdirectories on the host side under the directory
# that we're mounting as /root, as the root user. This creates problems for CI
# processes trying to clean up the working directory, so we create them here
# as the invoking user to avoid root-owned paths.
#
# Note: this only happens on Linux. On Docker for Mac, the directories are
# still created, but they're owned by the invoking user already.
# This issue is tracked in docker issue #26051.
mkdir -p "${host_home}"/.{jspm,npm}
# still created, but they're owned by the invoking user already. See
# https://github.com/docker/docker/issues/26051.
mkdir -p "${host_home}"/.{jspm,yarn-cache}

# Run our build container with a set of volumes mounted that will
# allow the container to store persistent build data on the host
Expand Down Expand Up @@ -108,7 +109,7 @@ vols="${vols} --volume=${gopath0}/pkg/docker_amd64:/usr/local/go/pkg/linux_amd64
vols="${vols} --volume=${gopath0}/pkg/docker_amd64_race:/usr/local/go/pkg/linux_amd64_race"
vols="${vols} --volume=${gopath0}/bin/docker_amd64:/go/bin"
vols="${vols} --volume=${HOME}/.jspm:${container_home}/.jspm"
vols="${vols} --volume=${HOME}/.npm:${container_home}/.npm"
vols="${vols} --volume=${HOME}/.yarn-cache:${container_home}/.yarn-cache"
vols="${vols} --volume=${cockroach_toplevel}:/go/src/github.com/cockroachdb/cockroach"

backtrace_dir="${cockroach_toplevel}/../../cockroachlabs/backtrace"
Expand Down
9 changes: 4 additions & 5 deletions build/protobuf.mk
Original file line number Diff line number Diff line change
Expand Up @@ -84,19 +84,18 @@ $(GW_SOURCES) : $(GW_SERVER_PROTOS) $(GW_TS_PROTOS) $(GO_PROTOS) $(GOGOPROTO_PRO
$(PROTOC) -I.:$(GOGOPROTO_ROOT):$(PROTOBUF_ROOT):$(COREOS_PATH):$(GRPC_GATEWAY_GOOGLEAPIS_PATH) --grpc-gateway_out=logtostderr=true:. $(GW_SERVER_PROTOS)
$(PROTOC) -I.:$(GOGOPROTO_ROOT):$(PROTOBUF_ROOT):$(COREOS_PATH):$(GRPC_GATEWAY_GOOGLEAPIS_PATH) --grpc-gateway_out=logtostderr=true:. $(GW_TS_PROTOS)

$(REPO_ROOT)/build/npm.installed: $(REPO_ROOT)/build/package.json
rm -rf $(REPO_ROOT)/build/node_modules
cd $(REPO_ROOT)/build && npm install --no-progress
$(REPO_ROOT)/build/yarn.installed: $(REPO_ROOT)/build/package.json
cd $(REPO_ROOT)/build && yarn install
touch $@

PBJS_ARGS = --path $(ORG_ROOT) --path $(GOGOPROTO_ROOT) --path $(COREOS_PATH) --path $(GRPC_GATEWAY_GOOGLEAPIS_PATH) $(GW_PROTOS)

$(PKG_ROOT)/ui/app/js/protos.js: $(REPO_ROOT)/build/npm.installed $(GO_PROTOS)
$(PKG_ROOT)/ui/app/js/protos.js: $(REPO_ROOT)/build/yarn.installed $(GO_PROTOS)
# Add comment recognized by reviewable.
echo '// GENERATED FILE DO NOT EDIT' > $@
$(REPO_ROOT)/build/node_modules/.bin/pbjs -t commonjs $(PBJS_ARGS) >> $@

$(PKG_ROOT)/ui/generated/protos.json: $(REPO_ROOT)/build/npm.installed $(GO_PROTOS)
$(PKG_ROOT)/ui/generated/protos.json: $(REPO_ROOT)/build/yarn.installed $(GO_PROTOS)
$(REPO_ROOT)/build/node_modules/.bin/pbjs $(PBJS_ARGS) > $@

$(PKG_ROOT)/ui/generated/protos.d.ts: $(PKG_ROOT)/ui/generated/protos.json
Expand Down
2 changes: 1 addition & 1 deletion build/xgo/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM karalabe/xgo-1.7.1
FROM karalabe/xgo-1.7.3

MAINTAINER Tamir Duberstein <[email protected]>

Expand Down
Loading

0 comments on commit 00e87d0

Please sign in to comment.