Skip to content
This repository has been archived by the owner on Jul 2, 2020. It is now read-only.

Commit

Permalink
Added general makefile setup to reuse at other packages
Browse files Browse the repository at this point in the history
  • Loading branch information
paulvollmer committed Mar 7, 2018
1 parent 8eca140 commit 095a2b8
Show file tree
Hide file tree
Showing 2 changed files with 74 additions and 0 deletions.
9 changes: 9 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
include ./setup.mk

help:
@echo "fritzing-js Makefile"
@echo ""
@echo " build build the react app"
@echo " test test the app"
@echo " clean remove the build artifacts"
@echo ""
65 changes: 65 additions & 0 deletions setup.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
ifeq ($(OS),Windows_NT)
BIN=node_modules\.bin
PATHSEP2=\\
RM=del -r
else
BIN=./node_modules/.bin
PATHSEP2=/
RM=rm -rf
endif

# make <target> LOG=yes
ifeq "$(LOG)" ""
LOG=no
endif

ifeq "$(LOG)" "no"
L=@
endif

PATHSEP=$(strip $(PATHSEP2))

all: lint test build docs

# BIN ?= ./node_modules/.bin
# DIR ?= $(dir $(lastword $(MAKEFILE_LIST)))
LINT_SRC_JS ?= .

lint:
$(L)$(BIN)$(PATHSEP)eslint $(LINT_SRC_JS)
lint-fix:
$(L)$(BIN)$(PATHSEP)eslint $(LINT_SRC_JS) --fix
.PHONY: lint lint-fix

vars:
@echo $(OS)
@echo $(LOG)
@echo $(BIN)
@echo $(PATHSEP)
@echo $(RM)

test:
$(L)$(BIN)$(PATHSEP)jest
open-coverage: test
$(L)open coverage$(PATHSEP)lcov-report$(PATHSEP)index.html
.PHONY: test open-coverage

build:
$(L)$(BIN)$(PATHSEP)babel -o lib$(PATHSEP)index.js src$(PATHSEP)index.js
.PHONY: build

docs:
$(L)$(BIN)$(PATHSEP)esdoc
docs-open: docs
$(L)open docs$(PATHSEP)index.html
.PHONY: docs docs-open

release-commit: build docs
git add lib
git add docs
git commit -m "Updated build artifacts (lib and docs)"
.PHONY: release-commit

clean:
$(L)$(RM) coverage
.PHONY: clean

0 comments on commit 095a2b8

Please sign in to comment.