Update ui-v2 makefile to handle updating node_modules when needed

Also dont include the dist and node_modules folders in the build context.
This commit is contained in:
Matt Keeler 2018-06-19 13:51:49 -04:00
parent 21fcb45f36
commit aff1b93268
3 changed files with 24 additions and 29 deletions

View File

@ -11,4 +11,4 @@ RUN apk update && \
mkdir /consul-src mkdir /consul-src
WORKDIR /consul-src WORKDIR /consul-src
CMD make init build CMD make

View File

@ -68,7 +68,7 @@ function build_ui {
then then
status "Copying the source from '${ui_dir}' to /consul-src within the container" 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} && status "Running build in container" && docker start -i ${container_id} &&
rm -rf ${1}/ui-v2/dist && rm -rf ${1}/ui-v2/dist &&
status "Copying back artifacts" && docker cp ${container_id}:/consul-src/dist ${1}/ui-v2/dist status "Copying back artifacts" && docker cp ${container_id}:/consul-src/dist ${1}/ui-v2/dist

View File

@ -1,33 +1,28 @@
ROOT:=$(shell dirname $(realpath $(lastword $(MAKEFILE_LIST)))) ROOT:=$(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))
server: all: build
deps: node_modules
build: deps
yarn run build
start: deps
yarn run start yarn run start
dist: test: deps
yarn run build yarn run test
mv dist ../pkg/web_ui/v2
init: test-view: deps
yarn install yarn run test:view
lint: lint: deps
yarn run lint:js yarn run lint:js
format:
format: deps
yarn run format:js yarn run format:js
.PHONY: server dist lint format node_modules: yarn.lock package.json
yarn install
.DEFAULT_GOAL=all .PHONY: all deps build start test test-view lint format
.PHONY: deps test all build start
all: deps
deps: node_modules yarn.lock package.json
node_modules:
yarn
build:
yarn run build
start:
yarn run start
test:
yarn run test
test-view:
yarn run test:view