-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
53 lines (40 loc) · 1023 Bytes
/
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
SOURCE_FILES:=$(shell find src/ -type f -name '*.ts')
.PHONY:all
all: build
.PHONY:build
build: cjs/build esm/build
.PHONY:test
test:
npx nyc mocha
.PHONY:test-cjs
test-cjs:
mkdir -p cjs-test
cd test; npx tsc --module commonjs --outdir ../cjs-test
echo '{"type": "commonjs"}' > cjs-test/package.json
cd cjs-test; npx mocha --no-package
.PHONY:lint
lint:
npx eslint --quiet 'src/**/*.ts' 'test/**/*.ts'
.PHONY:lint-fix
lint-fix: fix
.PHONY:fix
fix:
npx eslint --quiet 'src/**/*.ts' 'test/**/*.ts' --fix
.PHONY:watch
watch:
npx tsc --watch
.PHONY:start
start: build
.PHONY:clean
clean:
rm -rf dist esm cjs cjs-test
cjs/build: $(SOURCE_FILES)
npx tsc --module commonjs --outDir cjs/
echo '{"type": "commonjs"}' > cjs/package.json
@# Creating a small file to keep track of the last build time
touch cjs/build
esm/build: $(SOURCE_FILES)
npx tsc --module es2022 --outDir esm/
echo '{"type": "module"}' > esm/package.json
@# Creating a small file to keep track of the last build time
touch esm/build