-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
92 lines (67 loc) · 2.46 KB
/
Copy pathMakefile
File metadata and controls
92 lines (67 loc) · 2.46 KB
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
SHELL := /bin/bash
.PHONY: help clean clean-build clean-test init/pre_commit_install init lint lint-flake8 coverage check/pre-commit check fmt/py validate build publish .init-git-repository
.DEFAULT_GOAL := help
define PRINT_HELP_PYSCRIPT
import re, sys
targets = []
for line in sys.stdin:
match = re.match(r'^([a-zA-Z_-]+):.*?## (.*)$$', line)
if match:
target, help = match.groups()
targets.append((target, help))
for target, help in sorted(targets, key=lambda x: x[0]):
print("%-20s %s" % (target, help))
endef
export PRINT_HELP_PYSCRIPT
define BROWSER_PYSCRIPT
import os, webbrowser, sys
from urllib.request import pathname2url
webbrowser.open("file://" + pathname2url(os.path.abspath(sys.argv[1])))
endef
export BROWSER_PYSCRIPT
BROWSER := python3 -c "$$BROWSER_PYSCRIPT"
TFlINT_INSTALLED=$(if $(shell which $(exec)),0,1)
help:
@python3 -c "$$PRINT_HELP_PYSCRIPT" < $(MAKEFILE_LIST)
init: .init-git-repository ## initialize project
npm install
pip install -U pre-commit
git config --unset-all core.hooksPath
pre-commit install
npm run prepare
clean: clean-build clean-coverage ## remove all build, test and coverage artifacts
clean-build: ## remove build artifacts
rm -fr dist/
clean-coverage: ## remove test coverage data
rm -rf coverage/
.init-git-repository: ## initialize git repository
if [ -d ".git" ]; then \
echo "git repository already exists, nothing to do"; \
else \
echo "not a git repo, creating new one"; \
git init; \
git checkout -b main; \
git add .; \
git commit -m "initial commit, startproject"; \
fi
typecheck: ## typescript typecheck with tsc
npm run typecheck
lint: ## static code analysis with eslint
npm run lint
check-format: ## check if properly formatted
npx prettier -c src
coverage: ## check code coverage quickly with the default Python
-npm run coverage
$(BROWSER) coverage/index.html
check: typecheck check-format lint ## check code for linting, static code analysis errors and formatting errors
stories: ## open storybook in watch mode
npm run storybook
format: ## format source files (see https://prettier.io/docs/en/options.html, check package.json section 'prettier')
npx prettier --write src
fmt: format ## see target 'format'
test: ## run tests
npm run test
validate: check test ## validate code by performing test and check tasks
build: ## Builds the app for production to the build folder. It correctly bundles React in production mode and optimizes the build for the best performance.
rm -rf dist
npm run build