From d364bfc353796d1d70045496c250bdd897b0cb46 Mon Sep 17 00:00:00 2001 From: Brian Gough Date: Fri, 23 Feb 2018 11:36:08 +0000 Subject: [PATCH 1/4] add support for debugging --- services/web/Makefile | 34 +++++++++++++++++----------------- services/web/package.json | 2 +- 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/services/web/Makefile b/services/web/Makefile index 76d8891dd7..484ba1b597 100644 --- a/services/web/Makefile +++ b/services/web/Makefile @@ -27,31 +27,31 @@ LESS_FILES := $(shell find public/stylesheets -name '*.less') CSS_FILES := public/stylesheets/style.css public/stylesheets/ol-style.css app.js: app.coffee - $(COFFEE) --compile --print $< > $@ + $(COFFEE) $(COFFEE_OPTIONS) --compile -o $(@D) $< app/js/%.js: app/coffee/%.coffee @mkdir -p $(dir $@) - $(COFFEE) --compile --print $< > $@ + $(COFFEE) $(COFFEE_OPTIONS) --compile -o $(@D) $< public/js/%.js: public/coffee/%.coffee @mkdir -p $(dir $@) - $(COFFEE) --output $(dir $@) --map --compile $< + $(COFFEE) $(COFFEE_OPTIONS) --output $(dir $@) --map --compile $< test/unit/js/%.js: test/unit/coffee/%.coffee @mkdir -p $(dir $@) - $(COFFEE) --compile --print $< > $@ + $(COFFEE) $(COFFEE_OPTIONS) --compile -o $(@D) $< test/acceptance/js/%.js: test/acceptance/coffee/%.coffee @mkdir -p $(dir $@) - $(COFFEE) --compile --print $< > $@ + $(COFFEE) $(COFFEE_OPTIONS) --compile -o $(@D) $< test/unit_frontend/js/%.js: test/unit_frontend/coffee/%.coffee @mkdir -p $(dir $@) - $(COFFEE) --compile --print $< > $@ + $(COFFEE) $(COFFEE_OPTIONS) --compile -o $(@D) $< test/smoke/js/%.js: test/smoke/coffee/%.coffee @mkdir -p $(dir $@) - $(COFFEE) --compile --print $< > $@ + $(COFFEE) $(COFFEE_OPTIONS) --compile -o $(@D) $< public/js/libs/sharejs.js: $(SHAREJS_COFFEE_FILES) @echo "Compiling public/js/libs/sharejs.js" @@ -102,13 +102,13 @@ compile: $(JS_FILES) css public/js/libs/sharejs.js public/js/main.js public/js/i @$(MAKE) compile_modules compile_full: - $(COFFEE) -c -p app.coffee > app.js - $(COFFEE) -o app/js -c app/coffee - $(COFFEE) -o public/js -c public/coffee - $(COFFEE) -o test/acceptance/js -c test/acceptance/coffee - $(COFFEE) -o test/smoke/js -c test/smoke/coffee - $(COFFEE) -o test/unit/js -c test/unit/coffee - $(COFFEE) -o test/unit_frontend/js -c test/unit_frontend/coffee + $(COFFEE) $(COFFEE_OPTIONS) -c -p app.coffee > app.js + $(COFFEE) $(COFFEE_OPTIONS) -o app/js -c app/coffee + $(COFFEE) $(COFFEE_OPTIONS) -o public/js -c public/coffee + $(COFFEE) $(COFFEE_OPTIONS) -o test/acceptance/js -c test/acceptance/coffee + $(COFFEE) $(COFFEE_OPTIONS) -o test/smoke/js -c test/smoke/coffee + $(COFFEE) $(COFFEE_OPTIONS) -o test/unit/js -c test/unit/coffee + $(COFFEE) $(COFFEE_OPTIONS) -o test/unit_frontend/js -c test/unit_frontend/coffee rm -f public/js/ide.js public/js/main.js # We need to generate ide.js, main.js manually later $(MAKE) $(CSS_FILES) $(MAKE) compile_modules_full @@ -149,13 +149,13 @@ $(MODULE_MAKEFILES): Makefile.module clean: clean_app clean_frontend clean_css clean_tests clean_modules clean_app: - rm -f app.js + rm -f app.js app.js.map rm -rf app/js clean_frontend: rm -rf public/js/{analytics,directives,filters,ide,main,modules,services,utils} - rm -f public/js/*.js - rm -f public/js/libs/sharejs.js + rm -f public/js/*.{js,map} + rm -f public/js/libs/sharejs.{js,map} clean_tests: rm -rf test/unit/js diff --git a/services/web/package.json b/services/web/package.json index 38c1891e0e..6fee55852c 100644 --- a/services/web/package.json +++ b/services/web/package.json @@ -17,7 +17,7 @@ "test:unit": "npm -q run compile && bin/unit_test $@", "test:frontend": "karma start --single-run", "compile": "make compile", - "start": "npm -q run compile && node app.js", + "start": "npm -q run compile && node $NODE_APP_OPTIONS app.js", "nodemon": "nodemon --config nodemon.json", "nodemon:frontend": "nodemon --config nodemon.frontend.json", "webpack": "webpack-dev-server --config webpack.config.dev.js" From 42b701fd34bb1bca8c1b0392e0bf117688f878c4 Mon Sep 17 00:00:00 2001 From: Brian Gough Date: Fri, 23 Feb 2018 11:43:10 +0000 Subject: [PATCH 2/4] use the make automatic variable @D for the target directory name --- services/web/Makefile | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/services/web/Makefile b/services/web/Makefile index 484ba1b597..ad53354a9b 100644 --- a/services/web/Makefile +++ b/services/web/Makefile @@ -26,31 +26,32 @@ SHAREJS_COFFEE_FILES := \ LESS_FILES := $(shell find public/stylesheets -name '*.less') CSS_FILES := public/stylesheets/style.css public/stylesheets/ol-style.css +# The automatic variable $(@D) is the target directory name app.js: app.coffee $(COFFEE) $(COFFEE_OPTIONS) --compile -o $(@D) $< app/js/%.js: app/coffee/%.coffee - @mkdir -p $(dir $@) + @mkdir -p $(@D) $(COFFEE) $(COFFEE_OPTIONS) --compile -o $(@D) $< public/js/%.js: public/coffee/%.coffee - @mkdir -p $(dir $@) - $(COFFEE) $(COFFEE_OPTIONS) --output $(dir $@) --map --compile $< + @mkdir -p $(@D) + $(COFFEE) $(COFFEE_OPTIONS) --output $(@D) --map --compile $< test/unit/js/%.js: test/unit/coffee/%.coffee - @mkdir -p $(dir $@) + @mkdir -p $(@D) $(COFFEE) $(COFFEE_OPTIONS) --compile -o $(@D) $< test/acceptance/js/%.js: test/acceptance/coffee/%.coffee - @mkdir -p $(dir $@) + @mkdir -p $(@D) $(COFFEE) $(COFFEE_OPTIONS) --compile -o $(@D) $< test/unit_frontend/js/%.js: test/unit_frontend/coffee/%.coffee - @mkdir -p $(dir $@) + @mkdir -p $(@D) $(COFFEE) $(COFFEE_OPTIONS) --compile -o $(@D) $< test/smoke/js/%.js: test/smoke/coffee/%.coffee - @mkdir -p $(dir $@) + @mkdir -p $(@D) $(COFFEE) $(COFFEE_OPTIONS) --compile -o $(@D) $< public/js/libs/sharejs.js: $(SHAREJS_COFFEE_FILES) @@ -95,7 +96,6 @@ $(CSS_FILES): $(LESS_FILES) minify: $(CSS_FILES) $(JS_FILES) $(GRUNT) compile:minify - css: $(CSS_FILES) compile: $(JS_FILES) css public/js/libs/sharejs.js public/js/main.js public/js/ide.js From bc37003769e59a51c7b76266e50fc6798267d179 Mon Sep 17 00:00:00 2001 From: Brian Gough Date: Mon, 26 Feb 2018 09:50:23 +0000 Subject: [PATCH 3/4] use COFFEE_OPTIONS by default --- services/web/Makefile | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/services/web/Makefile b/services/web/Makefile index ad53354a9b..10e79e282f 100644 --- a/services/web/Makefile +++ b/services/web/Makefile @@ -5,7 +5,7 @@ PROJECT_NAME = web MODULE_DIRS := $(shell find modules -mindepth 1 -maxdepth 1 -type d -not -name '.git' ) MODULE_MAKEFILES := $(MODULE_DIRS:=/Makefile) -COFFEE := node_modules/.bin/coffee +COFFEE := node_modules/.bin/coffee $(COFFEE_OPTIONS) GRUNT := node_modules/.bin/grunt APP_COFFEE_FILES := $(shell find app/coffee -name '*.coffee') FRONT_END_COFFEE_FILES := $(shell find public/coffee -name '*.coffee') @@ -28,31 +28,31 @@ CSS_FILES := public/stylesheets/style.css public/stylesheets/ol-style.css # The automatic variable $(@D) is the target directory name app.js: app.coffee - $(COFFEE) $(COFFEE_OPTIONS) --compile -o $(@D) $< + $(COFFEE) --compile -o $(@D) $< app/js/%.js: app/coffee/%.coffee @mkdir -p $(@D) - $(COFFEE) $(COFFEE_OPTIONS) --compile -o $(@D) $< + $(COFFEE) --compile -o $(@D) $< public/js/%.js: public/coffee/%.coffee @mkdir -p $(@D) - $(COFFEE) $(COFFEE_OPTIONS) --output $(@D) --map --compile $< + $(COFFEE) --output $(@D) --map --compile $< test/unit/js/%.js: test/unit/coffee/%.coffee @mkdir -p $(@D) - $(COFFEE) $(COFFEE_OPTIONS) --compile -o $(@D) $< + $(COFFEE) --compile -o $(@D) $< test/acceptance/js/%.js: test/acceptance/coffee/%.coffee @mkdir -p $(@D) - $(COFFEE) $(COFFEE_OPTIONS) --compile -o $(@D) $< + $(COFFEE) --compile -o $(@D) $< test/unit_frontend/js/%.js: test/unit_frontend/coffee/%.coffee @mkdir -p $(@D) - $(COFFEE) $(COFFEE_OPTIONS) --compile -o $(@D) $< + $(COFFEE) --compile -o $(@D) $< test/smoke/js/%.js: test/smoke/coffee/%.coffee @mkdir -p $(@D) - $(COFFEE) $(COFFEE_OPTIONS) --compile -o $(@D) $< + $(COFFEE) --compile -o $(@D) $< public/js/libs/sharejs.js: $(SHAREJS_COFFEE_FILES) @echo "Compiling public/js/libs/sharejs.js" @@ -102,13 +102,13 @@ compile: $(JS_FILES) css public/js/libs/sharejs.js public/js/main.js public/js/i @$(MAKE) compile_modules compile_full: - $(COFFEE) $(COFFEE_OPTIONS) -c -p app.coffee > app.js - $(COFFEE) $(COFFEE_OPTIONS) -o app/js -c app/coffee - $(COFFEE) $(COFFEE_OPTIONS) -o public/js -c public/coffee - $(COFFEE) $(COFFEE_OPTIONS) -o test/acceptance/js -c test/acceptance/coffee - $(COFFEE) $(COFFEE_OPTIONS) -o test/smoke/js -c test/smoke/coffee - $(COFFEE) $(COFFEE_OPTIONS) -o test/unit/js -c test/unit/coffee - $(COFFEE) $(COFFEE_OPTIONS) -o test/unit_frontend/js -c test/unit_frontend/coffee + $(COFFEE) -c -p app.coffee > app.js + $(COFFEE) -o app/js -c app/coffee + $(COFFEE) -o public/js -c public/coffee + $(COFFEE) -o test/acceptance/js -c test/acceptance/coffee + $(COFFEE) -o test/smoke/js -c test/smoke/coffee + $(COFFEE) -o test/unit/js -c test/unit/coffee + $(COFFEE) -o test/unit_frontend/js -c test/unit_frontend/coffee rm -f public/js/ide.js public/js/main.js # We need to generate ide.js, main.js manually later $(MAKE) $(CSS_FILES) $(MAKE) compile_modules_full From 18cd5a5e5460c7815316d140dae829b198671f52 Mon Sep 17 00:00:00 2001 From: Brian Gough Date: Mon, 26 Feb 2018 09:51:37 +0000 Subject: [PATCH 4/4] ignore sourcemap for app.js --- services/web/.gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/services/web/.gitignore b/services/web/.gitignore index eb63304ecf..5fb08380e8 100644 --- a/services/web/.gitignore +++ b/services/web/.gitignore @@ -37,6 +37,7 @@ node_modules/* data/* app.js +app.js.map app/js/* test/unit/js/* test/unit_frontend/js/*