1
0
mirror of https://github.com/yldio/copilot.git synced 2024-09-21 13:53:51 +03: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: check:
@./bin/setup @./bin/setup
.PHONY: test-cloudapi-graphql SUBDIRS := $(shell find -maxdepth 2 -mindepth 2 -name 'Makefile' -printf '%h/.\n')
test-cloudapi-graphql: TARGETS := clean install test # whatever else, but must not contain '/'
$(MAKE) -C cloudapi-graphql test
.PHONY: test-frontend # foo/.all bar/.all foo/.clean bar/.clean
test-frontend: SUBDIRS_TARGETS := \
$(MAKE) -C frontend test $(foreach t,$(TARGETS),$(addsuffix $t,$(SUBDIRS)))
.PHONY: test-ui .PHONY: $(TARGETS) $(SUBDIRS_TARGETS)
test-ui:
$(MAKE) -C ui test
.PHONY: test # static pattern rule, expands into:
test: test-cloudapi-graphql test-frontend test-ui # all clean: %: foo/.% bar/.%
$(TARGETS): %: $(addsuffix %,$(SUBDIRS))
@echo 'Done "$*" target'
.PHONY: install-cloudapi-graphql # here, for foo/.all:
install-cloudapi-graphql: # $(@D) is foo
$(MAKE) -C cloudapi-graphql install # $(@F) is .all, with leading period
# $(@F:.%=%) is just all
.PHONY: install-frontend $(SUBDIRS_TARGETS):
install-frontend: $(MAKE) -C $(@D) $(@F:.%=%)
$(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

View File

@ -1,5 +1,29 @@
include ../tools/node-install.mk 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 .PHONY: test
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 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 .PHONY: test
test: test:
./node_modules/.bin/ava ./node_modules/.bin/ava
.PHONY: start
start:
npm run start

View File

@ -1,5 +1,19 @@
include ../tools/node-install.mk 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 .PHONY: test
test: test:
npm run test npm run test
@ -7,3 +21,9 @@ test:
.PHONY: compile .PHONY: compile
compile: install compile: install
NODE_ENV=production ./node_modules/.bin/webpack --config webpack/index.js 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 .PHONY: test
test: test:
yarn run 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