npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

generator-rails-react-browserify

v0.6.0

Published

Yeoman generator

Readme

generator-rails-react-browserify

Yeoman generator

NPM

Getting Started

To install generator-rails-react-browserify from npm, run:

$ npm install -g generator-rails-react-browserify

Usage for Rails 4.*

Create Ruby on Rails project with normal rails command, but skip gem bundling:

$ rails new app-name --skip-bundle

Then, initiate the generator:

$ cd app-name
$ yo rails-react-browserify

Answer 'Yes' to all 'Overwrite' actions. Then, update 'config/database.yml' if you use different database than 'sqlite3'.

Dependencies

  • Bower via npm install -g bower

Application template

I define all my javascript modules in 'app/frontend/javascripts', which will be compiled into 'app/assets/javascript/build' folder later.

Multiple bundle for browserify

Append suffix .bundle.js for each built module.

application/
  |- app/
  |  |- frontend/
  |  |  |- javascripts/
  |  |  |  |- <page-module>.bundle.js

Change the default configuration for built glob in config/browserify/config.json if you want to use other suffix than '.bundle.js'

package.json

Manage development dependencies for javascript with incremental rebuilding for each module. Turn ES6+ code into vanilla ES5 using 6to5 with the support of Browserify for javascript moduling. Inject regeneratorRunTime environment to support ES6 generators feature which allows you to using modern javascript libraries like js-csp today. Contain transform configurations for browserify-shim. Make sure that view their recipes for more informations.

gulpfile.js

  • config/browserify/config.json is responsible for controlling development and production build for javascript modules. Additionally, you can define extra configurations here, then, it will be loaded into javascript-build.js via config = require('./config.json');
  • config/browserify/errors-handler.js is responsible for errors handling. Currently, there is only Browserify has use this functions
  • config/browserify/javascript-build.js is responsible for transforming ES6+ into ES5 and building javascript modules.

Current transformation applied

ES6 generator

Add require('babel/pollyfill'); to support es6 generator syntax at the top level bundle

Apply transform to node__modules/some_modules

Specify transformation on the node_modules/module/package.json itself

"browserify": { "transform": [ "babelify" ] },

Use global transform

b.transform(transform, { global: true });

Available gulp task

$ gulp javascript:clean # remove the build folder placed at 'app/assets/javascripts/build'
$ gulp javascript:dev # watch over changes for multiple js bundle, rebuild for each module that changes
$ gulp javascript:dev --only main.bundle.js # watch over changes for single js module
$ gulp javascript:build # build for production with no source map

Start developing

Run these commands, and start coding

$ gulp javascript:dev
$ rails server

Assets compile

Compile your assets before deploying to production server

$ gulp javascript:build
$ rake assets:precompile RAILS_ENV=production

Options

Name: mongoid (for mongodb)

add --skip-active-record option to your rails new app --skip-active-record command before selecting this option.

Task

Live reload

For using livereload utility, firstly, install guard. Then, use rack-livereload or install LiveReload Safari/Chrome extension

$ bundle exec guard # to run the guard server and enjoy coding

Testing

Test files are placed in the same folder with component.

▾ home/
    home-test.js
    home.js*

Use iojs instead of node to run mocha test (See more here). And update mocha config if you need to in package.json

npm test
npm run test-converage # generate test coverage using istanbul

Structure

application/
  |- app/
  |  |- apis/
  |  |  |- v1/
  |  |  |  |- base.rb
  |  |  |  |- person_api.rb
  |  |  |- base.rb
  |  |- assets/
  |  |  |- images/
  |  |  |- javascripts/
  |  |  |  |- build/
  |  |  |  |  |- page-module.bundle.js
  |  |  |  |- application.js
  |  |  |- stylesheets/
  |  |  |  |- application.css
  |  |- frontend/
  |  |  |- javascripts/
  |  |  |  |- <page-module-dependencies>/
  |  |  |  |- <page-module>.bundle.js
  |  |- controllers/
  |  |- helpers/
  |  |- mailers/
  |  |- models/
  |  |- views/
  |  |  |- application/
  |  |  |  |- index.html # default template for the application
  |  |  |- layouts/
  |  |  |  |- application.html.erb
  |- bin/
  |- config/
  |  |- browserify/
  |  |  |- config.json
  |  |  |- errors-handler.js
  |  |  |- javascript-build.js
  |  |- initializers/
  |  |  |- bower_rails.rb # bower rails config
  |- db/
  |- lib/
  |- log/
  |- public/
  |- test/
  |- vendor/
  |  |- assets/
  |  |  |- bower_components/
  |  |  |  |- third libararies/
  |- |  |- bower.json
  |- Bowerfile # bower package dependencies
  |- config.ru
  |- gulpfile.js
  |- package.json
  |- config.ru
  |- Gemfile
  |- Gemfile.lock
  |- Guardfile # Guard file for livereload
  |- Rakefile
  |- README.rdoc

Running example

alt text

Contribution

All contributions are welcomed.

License

MIT License