Skip to content

Instantly share code, notes, and snippets.

@nickstenning
Created March 9, 2017 13:03
Show Gist options
  • Save nickstenning/54db868fa58aa98bf2132dfd8516b98f to your computer and use it in GitHub Desktop.
Save nickstenning/54db868fa58aa98bf2132dfd8516b98f to your computer and use it in GitHub Desktop.
diff --git a/Makefile b/Makefile
index a0e4750..cfdb2c6 100644
--- a/Makefile
+++ b/Makefile
@@ -5,6 +5,11 @@ ESLINT := node_modules/.bin/eslint
EXORCIST := node_modules/.bin/exorcist
MUSTACHE := node_modules/.bin/mustache
+CLIENT_ENTRYPOINT := $(shell node -p 'require.resolve("hypothesis")' 2>/dev/null)
+ifndef CLIENT_ENTRYPOINT
+$(error Could not determine 'hypothesis' entrypoint location. Have you run `npm install`?)
+endif
+
.PHONY: default
default: extension
@@ -29,7 +34,8 @@ EXTENSION_SRC := content help images lib
.PHONY: extension
extension: build/extension.bundle.js
extension: build/manifest.json
-extension: build/client/build
+extension: build/client
+extension: build/client/boot.js
extension: build/client/app.html
extension: build/settings-data.js
extension: $(addprefix build/,$(EXTENSION_SRC))
@@ -46,12 +52,17 @@ build/extension.bundle.js: src/common/extension.js
>build/.extension.bundle.deps
build/manifest.json: src/chrome/manifest.json.mustache build/.settings.json
$(MUSTACHE) build/.settings.json $< > $@
-build/client/build: node_modules/hypothesis/build/manifest.json
+build/client: $(CLIENT_ENTRYPOINT)
@mkdir -p $@
- cp -R node_modules/hypothesis/build/* $@
+ cp -R node_modules/hypothesis/* $@
@# We can't leave the client manifest in the build or the Chrome Web Store
@# will complain.
- rm $@/manifest.json
+ @#
+ @# FIXME: remove the manifest from the client -- it's not needed any more.
+ rm $@/build/manifest.json
+build/client/boot.js: $(CLIENT_ENTRYPOINT) build/client
+ cp $< $@
+
build/client/app.html: src/client/app.html.mustache build/client build/.settings.json
tools/template-context-app.js build/.settings.json | $(MUSTACHE) - $< >$@
build/settings-data.js: src/chrome/settings-data.js.mustache build/client build/.settings.json
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment