This repository has been archived by the owner on May 31, 2021. It is now read-only.
forked from bundlewatch/bundlewatch
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
94 lines (73 loc) · 2.67 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
ARTIFACT_DIR = artifacts
SHELL := /bin/bash
export PATH := $(shell yarn bin):$(PATH)
ifdef CI
ESLINT_ARGS=--format junit --output-file $(ARTIFACT_DIR)/test_results/eslint/eslint.junit.xml
JEST_ENV_VARIABLES=JEST_SUITE_NAME="Jest Tests" JEST_JUNIT_OUTPUT=$(ARTIFACT_DIR)/test_results/jest/jest.junit.xml
JEST_EXTRA_ARGS=--testResultsProcessor ./node_modules/jest-junit --coverageReporters=text-lcov | coveralls
YARN_ARGS=--frozen-lockfile
else
ESLINT_ARGS=
JEST_ENV_VARIABLES=
YARN_ARGS=
endif
.PHONY: help
help:
@echo "--------------------- Useful Commands for Development ----------------------"
@echo "make help - show this help message"
@echo "make install - install dependencies, blows up node_modules"
@echo "make bundlewatch - runs the bundlewatch command in the project"
@echo "make test - runs test"
@echo "make test-watch - watches test"
@echo "make test-snapshots - runs test and overwrites snapshots"
@echo "make lint - runs eslint"
@echo "make lint-fix - attempts to autofix linting errors"
@echo "make watch - babelize locally for development"
@echo "make package - package (babelize) bundlewatch ready for distribution"
# ---- Installing, Building and Running ----
.PHONY: install
install: check-versions clean node_modules
.PHONY: bundlewatch
bundlewatch: package check-versions node_modules
./lib/bin/index.js ${FLAGS}
ifndef CI
.PHONY: package
endif
package: check-versions node_modules ${ARTIFACT_DIR}
rm -rf lib
babel src --out-dir=lib --copy-files --ignore .test.js
npm pack
mv *.tgz artifacts/
# -------------- Testing and Linting --------------
.PHONY: test
test: check-versions node_modules ${ARTIFACT_DIR}
${JEST_ENV_VARIABLES} jest ${JEST_EXTRA_ARGS}
.PHONY: test-snapshots
test-snapshots: check-versions node_modules ${ARTIFACT_DIR}
${JEST_ENV_VARIABLES} jest -u ${JEST_EXTRA_ARGS}
.PHONY: test-watch
test-watch: check-versions node_modules
jest --watch
.PHONY: lint
lint: check-versions node_modules ${ARTIFACT_DIR}
eslint ${ESLINT_ARGS} .
.PHONY: lint-fix
lint-fix: check-versions node_modules
eslint --fix .
# --------------- CI Scripts -----------------
.PHONY: deploy
deploy:
./scripts/deploy.sh
# ----------------- Helpers ------------------
.PHONY: check-versions
check-versions:
@./scripts/check-versions.sh
.PHONY: clean
clean:
rm -rf ${ARTIFACT_DIR}
rm -rf node_modules
${ARTIFACT_DIR}:
mkdir -p ${ARTIFACT_DIR}/test_results/eslint
node_modules:
yarn install ${YARN_ARGS}
touch node_modules