.PHONY: create-polyfill-monster
## create polyfill.io url
create-polyfill-monster: $(MONSTER_SOURCE_FILES)
	$(ECHOMARKER) "create and replace polyfill"
	$(QUIET) $(DEVELOPMENT_SCRIPTS_PATH)create-polyfill.sh $(MJS_RELATIVE_SOURCE_FILES)


.PHONY: test-browser-monster
## create test-browser-monster
test-browser-monster: create-polyfill-monster
	$(ECHOMARKER) "create browser test and start chrome"
	$(QUIET) $(FIND) $(TEST_PATH)cases -type f | $(SED) "s|^$(TEST_PATH)cases||" > $(TEST_PATH)web/import.js
	$(QUIET) $(SED) -i 's|^|import "../cases|' $(TEST_PATH)web/import.js
	$(QUIET) $(SED) -i 's|$$|";|' $(TEST_PATH)web/import.js 
	$(QUIET) $(SED) -i "1 i import \"./prepare.js\";"  $(TEST_PATH)web/import.js
	$(QUIET) $(SED) -i "1 i /** this file was created automatically by the make target test-browser-monster */"  $(TEST_PATH)web/import.js
	$(ESBUILD) --platform=browser --sourcemap=inline --external:ws --external:jsdom --external:process --external:crypto --bundle $(TEST_PATH)web/import.js --outfile=$(TEST_PATH)web/tests.js
#	$(QUIET) $(CD) $(MONSTER_BUILD_TEST_BROWSER_DIR); $(WEBPACK) ; $(CD) - 
#	$(QUIET) $(SED) -i -E "/<h1/s_.*_  <h1 style='margin-bottom: 0.1em;'>Monster $(PROJECT_VERSION)</h1>_" $(TEST_PATH)web/test.html $(TEST_PATH)web/monster.html $(TEST_PATH)web/monster-dev.html 
#	$(QUIET) $(SED) -i -E "/id=\"lastupdate\"/s_.*_  <div id=\"lastupdate\" style='font-size:0.7em'>last update $(shell date)</div>_" $(TEST_PATH)web/test.html $(TEST_PATH)web/monster.html $(TEST_PATH)web/monster-dev.html   
#	$(QUIET) $(SED) -i -E "s_src=\"([\"]*)\.js.*\"_src=\"\1.js?r=$(shell date +"%T")\"_" $(TEST_PATH)web/test.html $(TEST_PATH)web/monster.html $(TEST_PATH)web/monster-dev.html
#	$(QUIET) $(SED) -i -E "s_dist/([0-9]+\.[0-9]+\.[0-9]+)*/dist/monster_dist/$(PROJECT_VERSION)/dist/monster_" $(TEST_PATH)web/monster.html $(TEST_PATH)web/monster-dev.html
#	#$(QUIET) if $(OPENBROWSER) ; then google-chrome --profile-directory="Default" $(TEST_PATH)web/test.html ; fi


## -> eigenes repos für monsterjs.org
#.PHONY: web-to-s3
### transfer web to s3	
#web-to-s3:
#	$(ECHOMARKER) "transfer web to s3"
#	$(QUIET) $(AWS) s3 --recursive --only-show-errors cp $(DEPLOYMENT_PATH)web/assets/ s3://monsterjs.org/assets/
#	$(QUIET) $(AWS) s3 --recursive --only-show-errors cp $(DEPLOYMENT_PATH)web/vendor/ s3://monsterjs.org/vendor/
#	$(QUIET) $(AWS) s3 --only-show-errors cp $(DEPLOYMENT_PATH)web/index.html s3://monsterjs.org/index.html
#	$(QUIET) $(AWS) s3 --only-show-errors cp $(DEPLOYMENT_PATH)web/error.html s3://monsterjs.org/error.html


.PHONY: doc-to-s3
## transfer doc to s3	
doc-to-s3: jsdoc-build
	$(ECHOMARKER) "transfer doc to s3"
	$(QUIET) $(AWS) s3 --recursive --only-show-errors cp $(BUILD_PATH)docs s3://monsterjs.org/en/doc/monster/