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

generator-genreact

v0.9.0

Published

A batteries-included isomorphic react application generator.

Downloads

23

Readme

generator-genreact

Build Status

Welcome to this brave new world. A better future that also brings with us all of the things we learned in the past.

It may be a bit overwhelming if you try to understand all of it right out of the gate, though. This is a layered architecture that sets you up for success at every level. It is highly opinionated, but attempts to hold its opinions loosely so that you can change it if you so desire.

NOTE: This is still alpha. We’re actively using it in prototypes at Skookum and intend on using it for production work imminently.

Get Hacking

  • npm install -g generator-genreact
  • mkdir my-new-project && cd $_
  • yo genreact:app [app-name]
  • npm start
  • open localhost:<%= port %>

Generator commands

Components

Components are the building blocks of your application. Think of them like Web Components, but better. They have clear compositional boundaries, carry their CSS and behavior with them, and your application understands these dependencies so bundling for production is trivial.

Examples:

  • yo genreact:component MyComponentName

This will generate the following file structure in ./app/components.

|- MyComponentname/
  |- index.js
  |- styles.css
  |- __tests__/
    |- index.js

Handlers

Handlers are almost synonymous with a route or URL. Think of these as the entry point to a specific part of your application.

Examples:

  • yo genreact:handler MyPageHandler
  • yo genreact:handler MyPageHandler/MySectionHandler

The key difference is whether it’s a top-level route or a child route. This command will create the following structure and attempt to add it to the appropriate location in your `routes.js file.

Components: Revisited

You’ve generated a few components and now you have a few pages. We’ve already seen the structure that a component generates and requires. To generate additional, section-specific components, you would do the following:

Examples:

  • yo genreact:component MyFlashyComponent --> ./components/MyFlashComponent
  • yo genreact:component MyFlashyComponent --handler MyPageHandler --> ./handlers/MyPageHandler/components/MyFlashComponent
  • yo genreact:component MyPageHandler/MySectionHandler/MyFlashyComponent --> ./app/MyPageHandler/MySectionHandler/components/MyFlashComponent

Action & Reducer (Redux)

You’ve generated a few components and now you want to store data and get data. To generate actions and reducers, you would do the following:

Examples:

  • yo genreact:actionReducer User setUser addUser --> ./actions/UserActions.js --> ./reducers/UserReducer.js
  • yo genreact:action User setUser addUser --> ./actions/UserActions.js
  • yo genreact:reducer User setUser addUser --> ./reducers/UserReducer.js

A few of the things you get

Pablo Picaso said that great artists steal. This toolchain takes the best practices and experiences we’ve had creating great consumer and enterprise products and bundles it together for us in a package that allows us to not just get up and running quickly but to then iterate effectively.

A few of the things that you will find in here:

  • An amazing development environment. There is hot-reloading tooling for both the client and server (TODO: patch reloads) built-in.
  • Isomorphic rendering with es6 everywhere.
  • A component architecture with co-located concerns.
  • Test suites that are ready to go.
  • A UI toolchain. We expect and prefer that your data layer be somewhere else. The data and UI layers should be able to scale independently as needed.
  • (TODO) Rich documentation and style guide web interface.

In this environment, we reduce the concerns of our UI designers and developers to the component level. As a UI developer, you don’t need to worry about how compilation happens or how to ensure that the CSS a component needs gets onto a page. You shouldn’t need to worry about how the final files are delivered to a client in production. These are all practices that are understood well, but full of nuance and tradeoffs. We have tuned — and continue to tune — these characteristics.

Tools in Use

  • Webpack
  • React
  • react-router
  • jest
  • babel

Optional

  • redux
  • redux-thunk
  • redux-actions
  • react-redux

Resources

A few resources that talk about some of the ideas you’ll find in here. Some of these articles were explicit drivers of this project and others were conveniently published since we started this work. To these authors: thank you for our documentation.

  • Folder structure: https://gist.github.com/ryanflorence/daafb1e3cb8ad740b346
  • Block, Element, Modifying Your JS Components: https://medium.com/seek-ui-engineering/block-element-modifying-your-javascript-components-d7f99fcab52b

License

This generator and toolchain is MIT Licensed. The projects and tools we bring together for you each have their own license and terms you should be aware of.