Makefile #1

  • //
  • guest/
  • perforce_software/
  • helix-web-services/
  • main/
  • source/
  • client-javascript/
  • node_modules/
  • superagent/
  • Makefile
  • View
  • Commits
  • Open Download .zip Download (1 KB)
NODETESTS ?= test/*.js test/node/*.js
BROWSERTESTS ?= test/*.js test/client/*.js
REPORTER = spec

all: superagent.js

test:
	@if [ "x$(BROWSER)" = "x" ]; then make test-node; else make test-browser; fi

test-node:
	@NODE_ENV=test NODE_TLS_REJECT_UNAUTHORIZED=0 ./node_modules/.bin/mocha \
		--require should \
		--reporter $(REPORTER) \
		--timeout 5000 \
		--growl \
		$(NODETESTS)

test-cov: lib-cov
	SUPERAGENT_COV=1 $(MAKE) test REPORTER=html-cov > coverage.html

test-browser:
	./node_modules/.bin/zuul -- $(BROWSERTESTS)

test-browser-local:
	./node_modules/.bin/zuul --local 4000 -- $(BROWSERTESTS)

lib-cov:
	jscoverage lib lib-cov

superagent.js: lib/node/*.js lib/node/parsers/*.js
	@./node_modules/.bin/browserify \
		--standalone superagent \
		--outfile superagent.js .

test-server:
	@node test/server

docs: index.html test-docs

index.html: docs/index.md
	marked < $< \
		| cat docs/head.html - docs/tail.html \
		> $@

docclean:
	rm -f index.html test.html

test-docs:
	make test REPORTER=doc \
		| cat docs/head.html - docs/tail.html \
		> test.html

clean:
	rm -fr superagent.js components

.PHONY: test-cov test docs test-docs clean test-browser-local
# Change User Description Committed
#1 19553 swellard Move and rename clients
//guest/perforce_software/helix-web-services/main/source/clients/2016.1.0/javascript/node_modules/superagent/Makefile
#1 18810 tjuricek First-pass at JavaScript client SDK.

JavaScript requires Node with Gulp to "browserfy" the library. It's the easiest way I found to use the swagger-js project; bundle up a wrapping method.

There is no JavaScript reference guide. The swagger-js doesn't really document what they do very well, actually.

Overall I'm not particularly impressed by swagger-js, it was hard to even figure out what the right method syntax was. We may want to invest time in doing it better.

This required setting CORS response headers, which are currently defaulted to a fairly insecure setting.