Details
-
Story
-
Resolution: Fixed
-
Major
-
None
-
None
-
None
-
NodeJS, Bower, Grunt
-
NDS Sprint 18, NDS Sprint 19
Description
As a developer of NDS Labs, there should be tooling to help prepare the JavaScript code for production-quality. Thankfully we can use Grunt to automate many of the more common tasks for us. Grunt accepts plugins that specify tasks, many if which are available through NPM.
The tasks we should implement, in order, are as follows:
- jshint / csslint: Display syntax errors / warnings from JS / CSS
concat: Concatenate all JS / CSS to a single fileuglify does this as well- uglify / cssmin: Minify / compress all JS / CSS files
- imagemin: Compress all locally-stored images
karma/protractor: Run unit/integration tests on the GUI against the mock server(seeNDS-725)- start
http-serverexpress (with different modes? i.e. production vs. dev - seeNDS-727)
This story is complete when the Gruntfile.js in the ndslabs GUI source is filled out to automate some or all of the above tasks. At the very least, jshint, uglify, cssmin, imagemin and concat should be present.
More tasks can be added at any time if we decide that there is anything else we might find helpful.
Only helpful if we do all of them:
- swagger / swagger-server: Generate a REST client and mock server (for testing or backend-less development) from a swagger api spec
- connect / watch: start a test server to develop against (may require changes to apiserver CORS) and automatically refresh the UI / run unit tests when files change on disk
- istanbul: report code coverage of the tests run - seems to require running a proxy server, which may cause issues with CORS
Other "maybes":
jsdoc: Generate HTML pages containing documentation from comments in the source (javadoc for js)(minimal is preferred to optimal)browserify: resolve nodejs modules within JS source(would require several changes - seeNDS-229)- moustache: templating engine that can ease things like versioning
- cachebuster: append magic strings to index.html to prevent caching
- Other tasks that may need exploration:
- html2js
- precompile js templates
- generate / apply certs?
- the order in which these tasks will need to run to function properly