diff --git a/Makefile b/Makefile index dcbf569..bf2345c 100644 --- a/Makefile +++ b/Makefile @@ -17,7 +17,7 @@ include build/setup.mk BUNDLE_NAME ?= $(PLUGIN_ID)-$(PLUGIN_VERSION).tar.gz -# Include custom makefile, if pressent +# Include custom makefile, if present ifneq ($(wildcard build/custom.mk),) include build/custom.mk endif @@ -103,6 +103,13 @@ ifneq ($(HAS_WEBAPP),) cd webapp && $(NPM) run build; endif +## Builds the webapp in debug mode, if it exists. +webapp-debug: webapp/.npminstall +ifneq ($(HAS_WEBAPP),) + cd webapp && \ + $(NPM) run debug; +endif + ## Generates a tar bundle of the plugin for install. .PHONY: bundle bundle: @@ -150,6 +157,12 @@ else @echo "No supported deployment method available. Install plugin manually." endif +.PHONY: debug-deploy +debug-deploy: debug-dist deploy + +.PHONY: debug-dist +debug-dist: apply server webapp-debug bundle + ## Runs any lints and unit tests defined for the server and webapp, if they exist. .PHONY: test test: webapp/.npminstall diff --git a/README.md b/README.md index 0a97c6c..da6d777 100644 --- a/README.md +++ b/README.md @@ -71,3 +71,6 @@ if appErr := p.API.SetProfileImage(userID, profileImage); appErr != nil { return errors.Wrap(err, "failed to set profile image") } ``` + +### How do I build the plugin with unminified JavaScript? +Use `make debug-dist` and `make debug-deploy` in place of `make dist` and `make deploy` to configure webpack to generate unminified Javascript. diff --git a/webapp/package.json b/webapp/package.json index 268096e..daf40de 100644 --- a/webapp/package.json +++ b/webapp/package.json @@ -5,6 +5,7 @@ "main": "src/index.js", "scripts": { "build": "webpack --mode=production", + "debug": "webpack --mode=none", "lint": "eslint --ignore-pattern node_modules --ignore-pattern dist --ext .js --ext .jsx . --quiet", "fix": "eslint --ignore-pattern node_modules --ignore-pattern dist --ext .js --ext .jsx . --quiet --fix", "test": "jest --forceExit --detectOpenHandles --verbose"