1
0
mirror of https://github.com/yldio/copilot.git synced 2024-11-28 14:10:04 +02:00

Cleaning up Makefiles

This commit is contained in:
Tom Gallacher 2016-10-24 15:52:46 +01:00
parent b4c66e1bb3
commit cf78ae9d84
7 changed files with 91 additions and 38 deletions

View File

@ -2,36 +2,23 @@
check:
@./bin/setup
.PHONY: test-cloudapi-graphql
test-cloudapi-graphql:
$(MAKE) -C cloudapi-graphql test
SUBDIRS := $(shell find -maxdepth 2 -mindepth 2 -name 'Makefile' -printf '%h/.\n')
TARGETS := clean install test # whatever else, but must not contain '/'
.PHONY: test-frontend
test-frontend:
$(MAKE) -C frontend test
# foo/.all bar/.all foo/.clean bar/.clean
SUBDIRS_TARGETS := \
$(foreach t,$(TARGETS),$(addsuffix $t,$(SUBDIRS)))
.PHONY: test-ui
test-ui:
$(MAKE) -C ui test
.PHONY: $(TARGETS) $(SUBDIRS_TARGETS)
.PHONY: test
test: test-cloudapi-graphql test-frontend test-ui
# static pattern rule, expands into:
# all clean: %: foo/.% bar/.%
$(TARGETS): %: $(addsuffix %,$(SUBDIRS))
@echo 'Done "$*" target'
.PHONY: install-cloudapi-graphql
install-cloudapi-graphql:
$(MAKE) -C cloudapi-graphql install
.PHONY: install-frontend
install-frontend:
$(MAKE) -C frontend install
.PHONY: install-ui
install-ui:
$(MAKE) -C ui install
.PHONY: install-backend
install-backend:
$(MAKE) -C backend install
.PHONY: install
install: install-cloudapi-graphql install-frontend install-backend install-ui
# here, for foo/.all:
# $(@D) is foo
# $(@F) is .all, with leading period
# $(@F:.%=%) is just all
$(SUBDIRS_TARGETS):
$(MAKE) -C $(@D) $(@F:.%=%)

View File

@ -1,5 +1,29 @@
include ../tools/node-install.mk
FRONTEND = "../frontend"
.PHONY: install
install:
yarn install
.PHONY: install-production
install-production:
yarn install --production --pure-lockfile
.PHONY: clean
clean:
@rm -rf node_modules
.PHONY: test
test:
./node_modules/.bin/ava
@echo "No tests for backend"
.PHONY: app-install
app-install:
$(MAKE) -C $(FRONTEND) copy
install: app-install
.PHONY: start
start:
npm run start

View File

@ -1 +1,2 @@
FROM quay.io/yldio/alpine-node-containerpilot:latest
# FROM quay.io/yldio/alpine-node-containerpilot:latest
FROM 7510c64b7b41

View File

@ -1,5 +1,21 @@
include ../tools/node-install.mk
.PHONY: install
install:
yarn install
.PHONY: install-production
install-production:
yarn install --production --pure-lockfile
.PHONY: clean
clean:
@rm -rf node_modules
.PHONY: test
test:
./node_modules/.bin/ava
.PHONY: start
start:
npm run start

View File

@ -1,5 +1,19 @@
include ../tools/node-install.mk
BACKEND = "../backend/static"
.PHONY: install
install:
yarn install
.PHONY: install-production
install-production:
yarn install --production --pure-lockfile
.PHONY: clean
clean:
@rm -rf node_modules
.PHONY: test
test:
npm run test
@ -7,3 +21,9 @@ test:
.PHONY: compile
compile: install
NODE_ENV=production ./node_modules/.bin/webpack --config webpack/index.js
# I'm not sure this is the best idea, let's see how this works out for us
# and then go with something better once we find pain points
.PHONY: copy
copy: compile
@cp -r static/* $(BACKEND)

View File

@ -1,7 +0,0 @@
.PHONY: install
install:
yarn install
.PHONY: install-production
install-production:
yarn install --production --pure-lockfile

View File

@ -3,3 +3,15 @@ include ../tools/node-install.mk
.PHONY: test
test:
yarn run test
.PHONY: install
install:
yarn install
.PHONY: install-production
install-production:
yarn install --production --pure-lockfile
.PHONY: clean
clean:
@rm -rf node_modules