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 🙏

© 2024 – Pkg Stats / Ryan Hefner

helium.js

v1.0.3

Published

Server Side Rendering React Developer Tool

Downloads

8

Readme

Helium.js

Making your React application lighter! 🎈

npm Build Status dependencies NSP Status Codacy Badge GitHub stars License: MIT contributions welcome

Helium.js is a node package that helps make your React application isomorphic and optimized.

  • Currently: Includes server side rendering with support for React Router v4 and Redux v3
  • Coming Soon: Optimization for webpack bundles

Prerequisites

You will need to have react/react-dom and the babel-cli installed as dependencies.

$ npm install react react-dom babel-cli --save

Installation

$ npm install helium.js --save

Usage

Hydrating on Client Side

/* Replace render with helium method
inside the index file of React application */

import helium from 'helium.js/react';

helium(
  <BrowserRouter>
    <App/>
  </BrowserRouter>, 
  'root' 
);

(with Redux)

/* Replace render with helium method
inside the index file of React application */

import helium, { getStore } from 'helium.js/react';

helium(
  <Provider store={getStore(reducer)}>
    <BrowserRouter>
      <App/>
    </BrowserRouter>
  </Provider>, 
  'root' 
);

(with Redux and Middlewares)

/* Replace render with helium method
inside the index file of React application.
Declare your middlewares as usual and pass 
in as a second parameter to getStore invocation */

import helium, { getStore } from 'helium.js/react';

// declare your middlewares

helium(
  <Provider store={getStore(reducer, middleware)}>
    <BrowserRouter>
      <App/>
    </BrowserRouter>
  </Provider>, 
  'root' 
);

Rendering on Server Side

Option 1: Automation with CLI

Have your server file automatically generated by answering questions using our cli.

To start up the cli, do one of the following:

* Type this command directly into your terminal
$ ./node_modules/.bin/he
* Add a script to your package.json and run the script
"scripts": {
  "start-helium-server": "./node_modules/.bin/he",
},
$ npm run he
* Install globally
$ npm i -g helium.js
$ he

Image of CLI

Option 2: Do it Yourself

/* Include this in your server file 
(the file in which you initialize your 
express application) */

// import your root component
import App from './src/components/App.js';
const helium = require('helium.js');

// initialize your express application here

helium.init({
  // indicate the path to your main html file
  html: 'index.html',
  // specify the id to which your React application will be mounted on
  id: 'root',
  App,
});

// input api routes here

app.get('*', helium.serve);

(with Redux)

/* Include this in your server file 
(the file in which you initialize your 
express application) */

// import your root component and your reducer
import App from './src/components/App.js';
import reducer from './src/reducers';
const helium = require('helium.js');

// initialize your express application here

helium.init({
  // indicate the path to your main html file
  html: 'index.html',
  // specify the id to which your React application will be mounted on
  id: 'root',
  App,
  reducer,
});

// input api routes here

app.get('*', helium.serveRedux);

Running Your Application

If cli was not used, be sure to add a script to your package.json.

"scripts": {
    "start-helium-server": "./node_modules/.bin/webpack && babel-node HeliumServer.js",
},
# To run your application, type the following into your terminal
$ npm run start-helium-server

Contributing

If you would like to contribute, submit a pull request and update the README.md with details of changes.

Versioning

We use SemVer for versioning. For the versions available, see the tags on this repository.

Authors

License

This project is licensed under the MIT License - see the LICENSE.md file for details