Skip to content

Commit

Permalink
Refactor dev.
Browse files Browse the repository at this point in the history
  • Loading branch information
lgarron committed Jan 6, 2025
1 parent 2cddda0 commit 5480f80
Show file tree
Hide file tree
Showing 8 changed files with 30 additions and 28 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/.cache
/.parcel-cache
/dist
/node_modules
/package-lock.json
46 changes: 28 additions & 18 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,26 +1,36 @@
# This Makefile is a wrapper around the scripts from `package.json`.
# https://github.com/lgarron/Makefile-scripts
.PHONY: build
build: build-esm build-bundle-global build-types

# Note: the first command becomes the default `make` target.
NPM_COMMANDS = build build-types build-esm build-bundle-global build-site dev clean prepack
.PHONY: setup
setup:
bun install --no-save

.PHONY: $(NPM_COMMANDS)
$(NPM_COMMANDS):
npm run $@
.PHONY: build-esm
build-esm: setup
bun run script/build-esm.ts

# 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(\" \")")
.PHONY: update-Makefile
update-Makefile:
sed -i "" "s/^NPM_COMMANDS = .*$$/NPM_COMMANDS = ${DYNAMIC_NPM_COMMANDS}/" Makefile
.PHONY: build-bundle-global
build-bundle-global: setup
bun run script/build-bundle-global.ts

# This is not in `scripts` in `package.json`, because that would cause a double-build.
.PHONY: publish
publish:
npm publish
.PHONY: build-types
build-types: setup
npx tsc -p tsconfig.json

SFTP_PATH = "[email protected]:~/experiments.cubing.net/scramble-display/"
URL = "https://experiments.cubing.net/scramble-display/"
.PHONY: build-site
build-site: setup
bun run script/build-site.ts

.PHONY: dev
dev: setup
bun run script/dev.ts

.PHONY: clean
clean:
rm -rf ./.cache ./dist

.PHONY: prepublishOnly
prepack: clean test

.PHONY: deploy
deploy: clean build-site
Expand Down
9 changes: 1 addition & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,7 @@
},
"repository": "github:cubing/scramble-display",
"scripts": {
"build": "npm run build-types && npm run build-esm && npm run build-bundle-global",
"build-types": "npx tsc -p tsconfig.json",
"build-esm": "node script/build-esm.js",
"build-bundle-global": "node script/build-bundle-global.js",
"build-site": "node script/build-site.js",
"dev": "node script/dev.js",
"clean": "rm -rf ./.cache ./dist",
"prepack": "npm run clean && npm run build"
"prepublishOnly": "make prepublishOnly"
},
"author": "Lucas Garron <[email protected]>",
"license": "GPL-3.0-or-later",
Expand Down

This file was deleted.

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit 5480f80

Please sign in to comment.