Yeoman – React & RequireJS Generator

What is Yeoman and this generator?

Apart from being a farmer, Yeoman is also a development tool, used for quickly setting up a frontend stack. Yeoman is installed via Npm and is typically used alongside NodeJs, Grunt and Bower. Yeoman generators are the actual stacks and can be used when you start a new project. So once you have Yeoman installed, you can install generators via Npm, then build your new project base using the generators. This means you don’t have to do all the nitty gritty stuff, like setting up test frameworks, task runners, static code analysis etc.

The creators of Yeoman have created a huge amount of generators for libraries like Angular, Backbone, Ember, Chromeapps etc. There are also around 1,000 created by third parties. So I thought I’d get on the bang wagon and make one more.

What is the React-Require generator?

After a bit of digging around I soon realised that no one had created a Yeoman generators for a React application that also used RequireJS. It may have something to do with Angular being so dominant right now, but I like React, so I thought I’d create a generator for it. The startup application that it creates is a todo list that updates all clients in real time using WebSockets.

The tools and libraries I chose to use as part of this generator include:

  1. Bootstrap – This is used to create the interface for the todo list.
  2. Node/Express – An Express server running on NodeJS, this is used to keep a persistent state of all items in the todo list, across all clients.
  3. Grunt – This is used to startup the Express server and create another server for the React application (So a server like Apache isn’t require)
  4. React/JSX – React is a tool developed by Facebook for creating templates using data bindings. JSX is XML language which can be used inside React to simplify usage.
  5. RequireJS – This is and AMD loader for browsers, which is useful for dependency injection.
  6. Socket.IO – Socket.IO is used by the clients and Express server to update changes across all clients, when changes are made.
  7. Karma/Jasmine – Karma is a test runner developed by Google, Jasmine is a BBD framework, Jasmine tests are run as part of Grunt.
  8. JSHint/JSCS – These are both static code analysis tools for JavaScript and are both run by Grunt.
  9. Sass – This is a CSS preprocessor, Sass is compiled to CSS using Grunt.
  10. Bower – This is a package manager and is used for installing libraries like Bootstrap and RequireJS.

How do I use the generator?

It’s all pretty simple stuff. I’ve create a README in the projects repository on Github, which explains everything.

Github Link

https://github.com/jakowicz/generator-react-require

Enjoy

I hope you find the generator useful and please do contribute.

2 Love This

2 Comments Yeoman – React & RequireJS Generator

    1. Simon

      That is exactly what it says on the tin 😀

      Yeoman and React have come along leaps and bounds since I wrote this. I also haven’t been working on frontend development much the last few years, so I never really updated this unfortunately.

      Reply

Leave a Reply

Your email address will not be published.

Time limit is exhausted. Please reload the CAPTCHA.