updates/Makefile

57 lines
1.5 KiB
Makefile
Raw Normal View History

2022-10-26 15:39:08 +00:00
SRC := updates.js
DST := bin/updates.js
2021-08-23 07:44:25 +00:00
node_modules: package-lock.json
npm install --no-save
2020-10-05 21:10:16 +00:00
@touch node_modules
2022-08-24 23:13:46 +00:00
.PHONY: deps
2020-10-05 21:10:16 +00:00
deps: node_modules
2022-08-24 23:13:46 +00:00
.PHONY: lint
2020-10-05 21:10:16 +00:00
lint: node_modules
2021-08-23 07:44:25 +00:00
npx eslint --color .
2020-08-18 21:06:38 +00:00
2022-08-24 23:13:46 +00:00
.PHONY: test
2020-10-05 21:10:16 +00:00
test: node_modules lint build
2022-10-17 21:36:44 +00:00
npx vitest
2020-08-18 21:06:38 +00:00
.PHONY: test-update
test-update: node_modules lint build
npx vitest -u
2022-08-24 23:13:46 +00:00
.PHONY: build
2022-10-26 15:39:08 +00:00
build: $(DST)
$(DST): $(SRC) node_modules
2022-09-20 20:15:09 +00:00
# workaround for https://github.com/evanw/esbuild/issues/1921
2023-04-18 18:19:24 +00:00
npx esbuild --log-level=warning --platform=node --target=node16 --format=esm --bundle --minify --legal-comments=none --banner:js="import {createRequire} from 'module';const require = createRequire(import.meta.url);" --define:import.meta.VERSION=\"$(shell jq .version package.json)\" --outfile=$(DST) $(SRC) --external:undici
2022-10-26 15:39:08 +00:00
chmod +x $(DST)
2020-03-09 22:57:04 +00:00
2022-08-24 23:13:46 +00:00
.PHONY: publish
2020-10-05 21:10:16 +00:00
publish: node_modules
2017-12-03 11:15:02 +00:00
git push -u --tags origin master
npm publish
2022-08-24 23:13:46 +00:00
.PHONY: update
2020-10-05 21:10:16 +00:00
update: node_modules build
2023-04-23 21:35:27 +00:00
node $(DST) -cu
rm -rf node_modules package-lock.json
2021-08-23 07:44:25 +00:00
npm install
2020-12-22 20:29:00 +00:00
@touch node_modules
2019-05-06 21:33:15 +00:00
2022-08-24 23:13:46 +00:00
.PHONY: patch
2020-10-05 21:10:16 +00:00
patch: node_modules test
2022-10-22 11:06:34 +00:00
npx versions -c 'make --no-print-directory build' patch package.json package-lock.json
2020-08-13 18:37:05 +00:00
@$(MAKE) --no-print-directory publish
2017-12-03 11:15:02 +00:00
2022-08-24 23:13:46 +00:00
.PHONY: minor
2020-10-05 21:10:16 +00:00
minor: node_modules test
2022-10-22 11:06:34 +00:00
npx versions -c 'make --no-print-directory build' minor package.json package-lock.json
2020-08-13 18:37:05 +00:00
@$(MAKE) --no-print-directory publish
2017-12-03 11:15:02 +00:00
2022-08-24 23:13:46 +00:00
.PHONY: major
2020-10-05 21:10:16 +00:00
major: node_modules test
2022-10-22 11:06:34 +00:00
npx versions -c 'make --no-print-directory build' major package.json package-lock.json
2020-08-13 18:37:05 +00:00
@$(MAKE) --no-print-directory publish