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 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159
|
.PHONY: all
all: test lint typecheck
.PHONY: clean
clean:
@rm -Rf node_modules dist
.PHONY: commit
commit:
npx cz
.PHONY: publish
publish:
@./bin/publish
.PHONY: version
version:
npx standard-version
.PHONY: version-alpha
version-alpha:
npx standard-version --prerelease alpha
.PHONY: server
server:
@./bin/server --silent --exec "echo Fetch api test suites: http://127.0.0.1:8000/test/fetch-api/"
##
# Builds
node_modules: package.json
npm install && /usr/bin/touch node_modules
dist: package.json rollup.config.js $(wildcard src/*.js) node_modules
@echo ""
@echo "=> make $@"
@npx rollup -c --bundleConfigAsCjs && /usr/bin/touch dist
test/fetch-api/api.spec.js: 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
.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: | test-browser test-node
.PHONY: test-browser
test-browser: |\
test-fetch-browser-native \
test-fetch-browser-whatwg \
test-fetch-browser-service-worker \
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: | dist test/fetch-api/api.spec.js
@echo ""
@echo "=> make $@"
@./test/fetch-api/browser/run.sh
.PHONY: test-fetch-browser-whatwg
test-fetch-browser-whatwg: | dist test/fetch-api/api.spec.js
@echo ""
@echo "=> make $@"
@./test/fetch-api/whatwg/run.sh
.PHONY: test-fetch-browser-service-worker
test-fetch-browser-service-worker: dist test/fetch-api/api.spec.js
@echo ""
@echo "=> make $@"
@./test/fetch-api/service-worker/run.sh
.PHONY: test-fetch-node-native
test-fetch-node-native: | dist test/fetch-api/api.spec.js
@echo ""
@echo "=> make $@"
@./test/fetch-api/node/run.sh
.PHONY: test-fetch-node-fetch
test-fetch-node-fetch: | dist test/fetch-api/api.spec.js
@echo ""
@echo "=> make $@"
@./test/fetch-api/node-fetch/run.sh
.PHONY: test-module-web-cjs
test-module-web-cjs: | dist
@echo ""
@echo "=> make $@"
@./test/module-system/web.cjs/run.sh
.PHONY: test-module-web-esm
test-module-web-esm: | dist
@echo ""
@echo "=> make $@"
@./test/module-system/web.esm/run.sh
.PHONY: test-module-node-cjs
test-module-node-cjs: | dist
@echo ""
@echo "=> make $@"
@./test/module-system/node.cjs/run.sh
.PHONY: test-module-node-esm
test-module-node-esm: | dist
@echo ""
@echo "=> make $@"
@./test/module-system/node.esm/run.sh
.PHONY: test-module-react-native
test-module-react-native: | dist
@echo ""
@echo "=> make $@"
@./test/module-system/react-native/run.sh
|