Skip to content

Commit

Permalink
[Makefile] add help recipy
Browse files Browse the repository at this point in the history
  • Loading branch information
dmonad committed Dec 14, 2023
1 parent b2ba6b3 commit 9901e0c
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 10 deletions.
19 changes: 10 additions & 9 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,16 @@ demos = monaco codemirror codemirror.next prosemirror prosemirror-versions quill
dists = $(patsubst %,%/dist,$(demos))
node_modules = $(patsubst %,%/node_modules,$(demos)) demo-server/node_modules

all : $(demos)
.PHONY: help
help: # Show help for each of the Makefile recipes.
@grep -E '^[a-zA-Z0-9 -]+:.*#' Makefile | while read -r l; do printf "\033[1;32m$$(echo $$l | cut -f 1 -d':')\033[00m:$$(echo $$l | cut -f 2- -d'#')\n"; done

# remove all generated files
clean :
dist: $(demos) # Build all distribution files

clean : # remove all generated files
rm -rf */dist */node_modules node_modules

static-content :
static-content : # Build the demos so that they can be served via a CDN
make -j all
rm -rf node_modules */node_modules

Expand All @@ -34,18 +37,16 @@ $(dists) : %/dist : node_modules %/node_modules $$(filter-out %/dist %/node_modu
@touch $@
endif

$(demos) : % : %/dist
$(demos) : % : %/dist # Build a specific demo
.PHONY : $(demos)

demo-server : $(node_modules) node_modules
demo-server : demo-server/node_modules
cd demo-server && npm start
.PHONY : demo-server

# Requires parallel execution of make targets
_serve: demo-server $(demos)

# Start demo server and build & watch all demos in parallel
serve:
serve: # Start demo server and build & watch all demos in parallel
@$(MAKE) -j _serve


2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"test": "standard",
"start": "make serve",
"demo-server": "cd demo-server && npm ci && npm start",
"dist": "make",
"dist": "make dist",
"lint": "standard",
"container:build": "docker build . -t yjs-demos",
"container:run": "docker run -p 3000:3000 --name yjs-demos yjs-demos",
Expand Down

0 comments on commit 9901e0c

Please sign in to comment.