Skip to content

Commit

Permalink
refactor: make targets were rearranged in groups and phony declaratio…
Browse files Browse the repository at this point in the history
…n colocated
  • Loading branch information
lquixada committed Apr 29, 2023
1 parent a276386 commit de3d402
Showing 1 changed file with 57 additions and 22 deletions.
79 changes: 57 additions & 22 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,115 +1,150 @@
##
# Work flow

.PHONY: all
all: test lint typecheck

.PHONY: browser
browser:
@./bin/server --exec "npx open-cli http://localhost:8000/test/fetch-api/browser/"

.PHONY: commit
commit:
npx cz

.PHONY: release
release:
npx standard-version

.PHONY: release-alpha
release-alpha:
npx standard-version --prerelease alpha


##
# Builds

node_modules: package.json
npm install && /usr/bin/touch node_modules

.PHONY: build
build:
@echo ""
@echo "=> make $@"
@npx rollup -c --bundleConfigAsCjs

browser:
@./bin/server --exec "npx open-cli http://localhost:8000/test/fetch-api/browser/"

commit:
npx cz

commitlint: node_modules
npx commitlint --from origin/main --to HEAD --verbose

.PHONY: compile
compile: test/fetch-api/api.spec.ts
@echo ""
@echo "=> make $@"
@npx tsc


##
# Checks

.PHONY: commitlint
commitlint: node_modules
npx commitlint --from origin/main --to HEAD --verbose

.PHONY: cov
cov:
npx nyc report --reporter=text-lcov > .reports/coverage.lcov && npx codecov

.PHONY: lint
lint:
@echo ""
@echo "=> make $@"
@npx standard

release:
npx standard-version

release-alpha:
npx standard-version --prerelease alpha

.PHONY: secure
secure:
@echo ""
@echo "=> make $@"
@npx snyk test

.PHONY: typecheck
typecheck:
@echo ""
@echo "=> make $@"
@npx tsc --lib ES6 --noEmit index.d.ts ./test/fetch-api/api.spec.ts


##
# Test groups

.PHONY: test
test: compile test-browser test-node

.PHONY: test-browser
test-browser: \
test-fetch-browser-native \
test-fetch-browser-whatwg \
test-module-web-cjs \
test-module-web-esm \
test-module-react-native

.PHONY: test-node
test-node: \
test-fetch-node-native \
test-fetch-node-fetch \
test-module-node-cjs \
test-module-node-esm


##
# Test units

.PHONY: test-fetch-browser-native
test-fetch-browser-native: build
@echo ""
@echo "=> make $@"
@./test/fetch-api/browser/run.sh

.PHONY: test-fetch-browser-whatw
test-fetch-browser-whatwg: build
@echo ""
@echo "=> make $@"
@./test/fetch-api/whatwg/run.sh

.PHONY: test-fetch-node-native
test-fetch-node-native: build
@echo ""
@echo "=> make $@"
@./test/fetch-api/node/run.sh

.PHONY: test-fetch-node-fetch
test-fetch-node-fetch: build
@echo ""
@echo "=> make $@"
@./test/fetch-api/node-fetch/run.sh

.PHONY: test-module-web-cjs
test-module-web-cjs: build
@echo ""
@echo "=> make $@"
@./test/module-system/web.cjs/run.sh

.PHONY: test-module-web-esm
test-module-web-esm: build
@echo ""
@echo "=> make $@"
@./test/module-system/web.esm/run.sh

.PHONY: test-module-node-cjs
test-module-node-cjs: build
@echo ""
@echo "=> make $@"
@./test/module-system/node.cjs/run.sh

.PHONY: test-module-node-esm
test-module-node-esm: build
@echo ""
@echo "=> make $@"
@./test/module-system/node.esm/run.sh

.PHONY: test-module-react-native
test-module-react-native: build
@echo ""
@echo "=> make $@"
@./test/module-system/react-native/run.sh

typecheck:
@echo ""
@echo "=> make $@"
@npx tsc --lib ES6 --noEmit index.d.ts ./test/fetch-api/api.spec.ts

.PHONY: all build deploy lint test test-fetch test-browser test-node test-fetch-browser-native test-fetch-browser-whatwg test-fetch-node-native test-fetch-node-fetch test-module test-module-web-cjs test-module-web-esm test-module-node-cjs test-module-node-esm test-module-react-native typecheck

0 comments on commit de3d402

Please sign in to comment.