-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
121 lines (93 loc) · 2.46 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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
export DIR_WORKSPACE := build/workspace
default:
#
# --
# -- Testing
# --
.PHONY: \
test \
test.watch \
test.coverage.open
test:
npx vitest run -c vitest.config.ts --coverage
test.watch:
npx vitest watch -c vitest.config.ts
test.coverage.open:
open build/coverage/index.html
# ---
# --- Package Build
# ---
.PHONY: \
build \
build.clean \
build.setup \
build.compile \
build.compile.verify \
build.compile.clean \
build.package \
build.package.verify \
build.package.install
build: \
build.clean \
build.setup \
build.compile \
build.compile.verify \
build.compile.clean \
build.package \
build.package.verify
build.clean:
rm -rf ${DIR_WORKSPACE}/*
build.setup:
mkdir -p ${DIR_WORKSPACE}
build.compile:
npx tsc -p build/tsconfig.json
build.compile.verify:
test -f ${DIR_WORKSPACE}/index.js
test -f ${DIR_WORKSPACE}/index.d.ts
test -d ${DIR_WORKSPACE}/core
test -f ${DIR_WORKSPACE}/core/assert-never.js
test -f ${DIR_WORKSPACE}/core/assert-never.d.ts
build.compile.clean:
# Delete all tests and proof files to reduce the impact of the package.
find ${DIR_WORKSPACE} -type f -name "*.bench.js" -delete
find ${DIR_WORKSPACE} -type f -name "*.proof.js" -delete
find ${DIR_WORKSPACE} -type f -name "*.spec.js" -delete
find ${DIR_WORKSPACE} -type f -name "*.test.js" -delete
# Ensure all typescript files remaining are declaration files.
# In this case, ensure we remove the declaration files for tests that was generated.
find ${DIR_WORKSPACE} -type f -name "*.bench.d.ts" -delete
find ${DIR_WORKSPACE} -type f -name "*.proof.d.ts" -delete
find ${DIR_WORKSPACE} -type f -name "*.spec.d.ts" -delete
find ${DIR_WORKSPACE} -type f -name "*.test.d.ts" -delete
build.package:
cp package.json ${DIR_WORKSPACE}/package.json
cp package-lock.json ${DIR_WORKSPACE}/package-lock.json
cp README.md ${DIR_WORKSPACE}/README.md
build.package.verify:
test -f ${DIR_WORKSPACE}/package.json
test -f ${DIR_WORKSPACE}/package-lock.json
# ---
# --- Package Build
# ---
.PHONY: \
package \
package.publish
package:
npm publish --access public --dry-run ./${DIR_WORKSPACE}
package.publish:
npm publish --access public ./${DIR_WORKSPACE}
package.publish.next:
npm publish --access public --tag next ./${DIR_WORKSPACE}
# ---
# --- Versioning
# ---
.PHONY: \
version.major \
version.minor \
version.patch
version.major:
npm version --no-git-tag-version major
version.minor:
npm version --no-git-tag-version minor
version.patch:
npm version --no-git-tag-version patch