Start updating the build commands.

This commit is contained in:
Lucas Garron 2022-01-11 12:59:03 -08:00
Родитель a4ba112324
Коммит af89a194bb
2 изменённых файлов: 10 добавлений и 8 удалений

Просмотреть файл

@ -1,18 +1,23 @@
# This Makefile is a wrapper around the scripts from `package.json`.
# https://github.com/lgarron/Makefile-scripts
# Run `make first-run` once to set up the commands. # this-line-will-be-deleted-during-first-run
.PHONY: first-run # this-line-will-be-deleted-during-first-run
first-run: update-Makefile # this-line-will-be-deleted-during-first-run
# Note: the first command becomes the default `make` target.
NPM_COMMANDS = build build-main build-types build-extended build-extended-types build-browser-global build-bin build-demo build-inspector dev dev-inspector clean test setup lint format prepack postpublish
NPM_COMMANDS = build build-js build-types build-bin build-demo build-inspector dev dev-inspector clean test setup lint format prepack postpublish
.PHONY: $(NPM_COMMANDS)
$(NPM_COMMANDS):
npm run $@
# We write the npm commands to the top of the file above to make shell autocompletion work in more places.
DYNAMIC_NPM_COMMANDS = $(shell cat package.json | npx jq --raw-output ".scripts | keys_unsorted | join(\" \")")
DYNAMIC_NPM_COMMANDS = $(shell node -e 'console.log(Object.keys(require("./package.json").scripts).join(" "))')
UPDATE_MAKEFILE_SED_ARGS = "s/^NPM_COMMANDS = .*$$/NPM_COMMANDS = ${DYNAMIC_NPM_COMMANDS}/" Makefile
.PHONY: update-Makefile
update-Makefile:
sed -i "" "s/^NPM_COMMANDS = .*$$/NPM_COMMANDS = ${DYNAMIC_NPM_COMMANDS}/" Makefile
if [ "$(shell uname -s)" = "Darwin" ] ; then sed -i "" ${UPDATE_MAKEFILE_SED_ARGS} ; fi
if [ "$(shell uname -s)" != "Darwin" ] ; then sed -i"" ${UPDATE_MAKEFILE_SED_ARGS} ; fi
.PHONY: publish
publish:

Просмотреть файл

@ -33,12 +33,9 @@
"typescript": "^3.9.7"
},
"scripts": {
"build": "npm run build-main && npm run build-types && npm run build-extended && npm run build-extended-types && npm run build-browser-global && npm run build-bin && npm run build-demo",
"build-main": "npx parcel build --target main src/targets/main.ts",
"build": "npm run build-js",
"build-js": "node script/build.js",
"build-types": "npx parcel build --target types src/targets/main.types.ts",
"build-extended": "npx parcel build --target extended src/targets/extended.ts",
"build-extended-types": "npx parcel build --target extended-types src/targets/extended.types.ts",
"build-browser-global": "npx parcel build --target browser-global src/targets/browser-global.ts",
"build-bin": "npx parcel build --target bin src/targets/bin.ts && make format-bin",
"build-demo": "npx parcel build --public-url . --target demo src/targets/demo/index.html",
"build-inspector": "npx parcel build --target inspector src/targets/inspector/inspector.ts",