I’ve recently started a project which will include a clojure service, an Android client, an iOS client and a rails website which will do a bunch of the user management but also provide a Javascript client to the clojure service. I started imagining I would just build the Javascript client inside the rails application but realized all of the rails environment actually distracts a lot from working on the Javascript itself and gets in the way of trying to structure a full fledged Javascript application.

I decided then to start a pure Javascript project. Decided to go with NPM (therefore NodeJS) to manage packages needed for development and production, Bower to obtain javascript libraries used in runtime, Grunt to automate scripts and tests with Mocha, Chai for assertions and Istanbul for coverage.

This may sound like a lot but it allowed me to get a base project that could:
  • Run tests as soon as my files changes (using PhantomJS to not open a browser).
  • Compile all my JS files into a single file to improve download/cache.
  • Minify that file for production usage.
  • Provide me with coverage information (and a badge for the project thanks to code climate).
  • Provide me with dependency tracking (thanks to David).
  • Run tests in the cloud against multiple browsers and multiple versions of browsers and operating systems thanks to Saucelabs (and a nice badge showing me it all worked).
  • Provide me with a Continuous Delivery (actually Continuous Deployment) thanks to Snap-CI.

Having all of that, my workflow is pretty simple:
  1. I start my test watcher with "grunt watch"
  2. Make the changes I want in my tests
  3. Get a nice failure notification (if I know what I’m doing)
  4. Fix my production code
  5. Get a nice success notification (if I did it write)
  6. Repeat 3 to 5 as many times as needed
  7. Commit and push the changes when happy
  8. Get a nice RSS feed (thanks to Snap) telling me everything was fine (or a failure email when I break the build) and my project's Github page has the latest valid (passed the build) version of the JS script minified available.

Overall, the whole experience was quite nice. Thanks to NodeJS, developing Javascript only application is a lot more fun and doesn’t need you to keep a browser open at all times refreshing. It is also possible to write automated tests for fine grained non-client facing code making it so that you feel a lot more confident about the quality of your code. It also helps you enforce DOM isolation.

Although documentation is not very good for most projects and there are a TON of different options of libraries that live and die daily, the Javascript world is finally getting some more mature and developing Javascript applications can no longer be a side thing.