Skip to content

Commit

Permalink
Makefile: Split run into new prebuild and run-only targets (#4450)
Browse files Browse the repository at this point in the history
This provides a simple interface for build scripts that want to pre-run
the webpack and ts-compile steps (e.g. when producing a container
image) ahead of time rather, without requiring them to copy the current
set of commands needed for each part and hope they don't change.

Fixes #3287
  • Loading branch information
jrtc27 authored and mattgodbolt committed Jan 24, 2023
1 parent aafb9fd commit f78d885
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions Makefile
Expand Up @@ -70,12 +70,20 @@ pre-commit: $(NODE_MODULES) test-min lint
clean: ## Cleans up everything
rm -rf node_modules .*-updated .*-bin out

.PHONY: run
run: prereqs ## Runs the site like it runs in production
.PHONY: prebuild
prebuild: prereqs
$(NPM) run webpack
$(NPM) run ts-compile

.PHONY: run-only
run-only: node-installed ## Runs the site like it runs in production without building it
env NODE_ENV=production $(NODE) $(NODE_ARGS) -r esm ./out/dist/app.js --webpackContent ./out/webpack/static $(EXTRA_ARGS)

.PHONY: run
run: ## Runs the site like it runs in production
$(MAKE) prebuild
$(MAKE) run-only

.PHONY: dev
dev: prereqs ## Runs the site as a developer; including live reload support and installation of git hooks
./node_modules/.bin/supervisor -w app.js,lib,etc/config,static/tsconfig.json -e 'js|ts|node|properties|yaml' -n exit --exec $(NODE) $(NODE_ARGS) -- -r esm -r ts-node/register ./app.js $(EXTRA_ARGS)
Expand Down

0 comments on commit f78d885

Please sign in to comment.