Skip to content

Commit 240bbf0

Browse files
committed
ci(package.json): use make
1 parent a6f8e0d commit 240bbf0

File tree

5 files changed

+63
-16
lines changed

5 files changed

+63
-16
lines changed

Diff for: .editorconfig

+3
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,6 @@ trim_trailing_whitespace = false
1616
# Matches the exact files either package.json or .travis.yml
1717
[{package.json,.travis.yml}]
1818
indent_size = 2
19+
20+
[Makefile]
21+
indent_style = tab

Diff for: .github/workflows/ci.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,8 @@ jobs:
5959
if: steps.yarn-cache.outputs.cache-hit != 'true' # Over here!
6060
run: yarn install --frozen-lockfile --ignore-scripts
6161

62-
- name: yarn test
63-
run: yarn test
62+
- name: make test
63+
run: make test
6464

6565
env:
6666
CI: true

Diff for: Makefile

+50
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
SHELL = /bin/sh
2+
3+
YARN = yarn
4+
PRETTIER = $(YARN) prettier
5+
ESLINT = $(YARN) eslint
6+
JEST = $(YARN) test
7+
TOUCH = touch
8+
9+
ARTIFACTS = dist coverage
10+
SRC_TS := $(wildcard ./src/*.ts)
11+
ESLINT_GLOB = "{src,test}/**/*.ts"
12+
PRETTIER_GLOB = "**/*.{js,ts,md,yml,json,html}"
13+
14+
.DEFAULT_TARGET = all
15+
16+
.PHONY: clean coverage build lint lint-fix production test
17+
18+
all: production
19+
20+
install: node_modules
21+
22+
node_modules: yarn.lock
23+
$(YARN) install
24+
$(TOUCH) $@
25+
26+
production: install clean build
27+
rm dist/tsconfig.tsbuildinfo
28+
29+
clean:
30+
rm -rf $(ARTIFACTS)
31+
32+
build: dist
33+
34+
dist: $(SRC_TS)
35+
$(YARN) tsc
36+
$(TOUCH) $@
37+
38+
lint:
39+
$(ESLINT) $(ESLINT_GLOB)
40+
$(PRETTIER) --list-different $(PRETTIER_GLOB)
41+
42+
lint-fix:
43+
$(ESLINT) --fix $(ESLINT_GLOB)
44+
$(PRETTIER) --write $(PRETTIER_GLOB)
45+
46+
test: clean build
47+
$(JEST)
48+
49+
coverage: clean build
50+
$(JEST) --coverage --coverageReporters=lcov

Diff for: README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -582,10 +582,10 @@ $ yarn lint:fix
582582
$ yarn build
583583

584584
# unit tests
585-
$ yarn test
585+
$ yarn build && yarn test
586586

587587
# code coverage
588-
$ yarn cover
588+
$ yarn build && yarn coverage
589589
```
590590

591591
## Changelog

Diff for: package.json

+6-12
Original file line numberDiff line numberDiff line change
@@ -8,20 +8,14 @@
88
"dist"
99
],
1010
"scripts": {
11-
"clean": "rm -rf dist && rm -rf coverage",
12-
"lint": "yarn prettier && yarn eslint",
13-
"lint:fix": "yarn prettier:fix && yarn eslint:fix",
14-
"eslint": "eslint '{src,test}/**/*.ts'",
15-
"eslint:fix": "yarn eslint --fix",
16-
"prettier": "prettier --list-different \"**/*.{js,ts,md,yml,json,html}\"",
17-
"prettier:fix": "prettier --write \"**/*.{js,ts,md,yml,json,html}\"",
18-
"prebuild": "yarn clean",
11+
"clean": "make clean",
12+
"lint": "make lint",
13+
"lint:fix": "make lint-fix",
1914
"build": "tsc",
20-
"pretest": "yarn build",
2115
"test": "jest",
22-
"precoverage": "yarn build",
23-
"coverage": "jest --coverage --coverageReporters=lcov",
24-
"prepare": "husky install && yarn build && rm dist/tsconfig.tsbuildinfo"
16+
"coverage": "make coverage",
17+
"prepare": "husky install",
18+
"prepack": "make production"
2519
},
2620
"repository": {
2721
"type": "git",

0 commit comments

Comments
 (0)