diff options
Diffstat (limited to 'web/GNUmakefile')
-rw-r--r-- | web/GNUmakefile | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/web/GNUmakefile b/web/GNUmakefile new file mode 100644 index 0000000..a1738fa --- /dev/null +++ b/web/GNUmakefile @@ -0,0 +1,47 @@ +# Directory where the build output should be written to +DIST ?= dist +# Change this to "development" for source maps and non-minifyed code +NODE_ENV ?= production +# If true, we don't attempt to fetch dependencies via yarn +OFFLINE ?= false + +ifeq ($(NODE_ENV),production) +ESBUILDFLAGS = --minify +else +ESBUILDFLAGS = --sourcemap +endif + +ESBUILDFLAGS += --platform=browser --bundle +ESBUILDFLAGS += --target=es6,edge79,firefox54,chrome51,safari11 + +ESBUILD ?= esbuild +ESBUILD += $(ESBUILDFLAGS) + +INSTALL ?= install +INSTALL += -m644 + +all: dist/main.js dist/index.html dist/custom.css dist/vis-network.min.css + +$(DIST): + mkdir -p $@ + +node_modules: + $(OFFLINE) || yarn install --frozen-lockfile --prod + +$(DIST)/vis-network.min.css: node_modules $(DIST) + $(ESBUILD) node_modules/vis-network/dist/dist/vis-network.min.css --outfile=$@ + +$(DIST)/%.js: source/%.js $(DIST) node_modules + $(ESBUILD) $< --outfile=$@ + +$(DIST)/%.css: source/%.css $(DIST) + $(ESBUILD) $< --outfile=$@ + +$(DIST)/%: source/% $(DIST) + $(INSTALL) $< $@ + +clean: + rm -rf $(DIST) + rm -rf node_modules + +.PHONY: clean node_modules |