From aff1b93268667f01aff6bf704b4fa71ea0a68e09 Mon Sep 17 00:00:00 2001 From: Matt Keeler Date: Tue, 19 Jun 2018 13:51:49 -0400 Subject: [PATCH] Update ui-v2 makefile to handle updating node_modules when needed Also dont include the dist and node_modules folders in the build context. --- build-support/docker/Build-UI.dockerfile | 2 +- build-support/functions/20-build.sh | 2 +- ui-v2/GNUmakefile | 49 +++++++++++------------- 3 files changed, 24 insertions(+), 29 deletions(-) diff --git a/build-support/docker/Build-UI.dockerfile b/build-support/docker/Build-UI.dockerfile index 72a80d2bad..666a1369cb 100644 --- a/build-support/docker/Build-UI.dockerfile +++ b/build-support/docker/Build-UI.dockerfile @@ -11,4 +11,4 @@ RUN apk update && \ mkdir /consul-src WORKDIR /consul-src -CMD make init build +CMD make diff --git a/build-support/functions/20-build.sh b/build-support/functions/20-build.sh index 1a96272f7e..6297ead7f1 100644 --- a/build-support/functions/20-build.sh +++ b/build-support/functions/20-build.sh @@ -68,7 +68,7 @@ function build_ui { then status "Copying the source from '${ui_dir}' to /consul-src within the container" ( - docker cp . ${container_id}:/consul-src && + tar -c $(ls | grep -v "^(node_modules\|dist)") | docker cp - ${container_id}:/consul-src && status "Running build in container" && docker start -i ${container_id} && rm -rf ${1}/ui-v2/dist && status "Copying back artifacts" && docker cp ${container_id}:/consul-src/dist ${1}/ui-v2/dist diff --git a/ui-v2/GNUmakefile b/ui-v2/GNUmakefile index c720727814..f703de4f4f 100644 --- a/ui-v2/GNUmakefile +++ b/ui-v2/GNUmakefile @@ -1,33 +1,28 @@ ROOT:=$(shell dirname $(realpath $(lastword $(MAKEFILE_LIST)))) -server: - yarn run start - -dist: +all: build + +deps: node_modules + +build: deps yarn run build - mv dist ../pkg/web_ui/v2 - -init: - yarn install - -lint: - yarn run lint:js -format: - yarn run format:js - -.PHONY: server dist lint format - -.DEFAULT_GOAL=all -.PHONY: deps test all build start -all: deps -deps: node_modules yarn.lock package.json -node_modules: - yarn -build: - yarn run build -start: + +start: deps yarn run start -test: + +test: deps yarn run test -test-view: + +test-view: deps yarn run test:view + +lint: deps + yarn run lint:js + +format: deps + yarn run format:js + +node_modules: yarn.lock package.json + yarn install + +.PHONY: all deps build start test test-view lint format