-
Notifications
You must be signed in to change notification settings - Fork 8
/
Makefile
72 lines (57 loc) · 1.48 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
SOURCE_FILES := index.ts
DIST_FILES := dist/index.js
ifeq ($(shell sed --version 2>/dev/null | grep -q GNU && echo gnu),gnu)
SED_INPLACE := sed -i
else
SED_INPLACE := sed -i ''
endif
node_modules: package-lock.json
npm install --no-save
@touch node_modules
.PHONY: deps
deps: node_modules
.PHONY: lint
lint: node_modules
npx eslint --ext js,jsx,ts,tsx --color .
npx tsc
.PHONY: lint-fix
lint-fix: node_modules
npx eslint --ext js,jsx,ts,tsx --color . --fix
npx tsc
.PHONY: test
test: node_modules build
npx vitest
.PHONY: test-update
test-update: node_modules build
npx vitest -u
.PHONY: hashbang
hashbang:
@$(SED_INPLACE) "1s/.*/\#\!\/usr\/bin\/env node/" dist/index.js
.PHONY: build
build: node_modules $(DIST_FILES)
$(DIST_FILES): $(SOURCE_FILES) package-lock.json vite.config.ts
npx vite build
@$(MAKE) --no-print-directory hashbang
chmod +x $(DIST_FILES)
.PHONY: publish
publish: node_modules
git push -u --tags origin master
npm publish
.PHONY: update
update: node_modules
npx updates -cu
rm -rf node_modules package-lock.json
npm install
@touch node_modules
.PHONY: path
patch: node_modules lint test build
npx versions patch package.json package-lock.json
@$(MAKE) --no-print-directory publish
.PHONY: minor
minor: node_modules lint test build
npx versions minor package.json package-lock.json
@$(MAKE) --no-print-directory publish
.PHONY: major
major: node_modules lint test build
npx versions major package.json package-lock.json
@$(MAKE) --no-print-directory publish