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

@bkonkle/generator-react

v3.2.0

Published

A set of generators for React

Downloads

6

Readme

@bkonkle/generator-react

npm license

                                          $$\
                                          $$ |
 $$$$$$\   $$$$$$\   $$$$$$\   $$$$$$$\ $$$$$$\
$$  __$$\ $$  __$$\  \____$$\ $$  _____|\_$$  _|
$$ |  \__|$$$$$$$$ | $$$$$$$ |$$ /        $$ |
$$ |      $$   ____|$$  __$$ |$$ |        $$ |$$\
$$ |      \$$$$$$$\ \$$$$$$$ |\$$$$$$$\   \$$$$  |
\__|       \_______| \_______| \_______|   \____/

Brandon's Yeoman generators for scaffolding new React applications

Installation

npm install -g @bkonkle/generator-react

You can also use yarn if you have your global folder configured:

yarn global add @bkonkle/generator-react

Yeoman

You'll also need to install Yeoman to use this generator.

npm i -g yo

(or)

```sh
yarn global add yo

Usage

Run one of the generators below, answer the questions, and you'll have a brand new web application set up in your current directory. Tada! 🎉

Web

To bootstrap a React web project, use the web generator:

mkdir my-new-web-project
cd my-new-web-project

yo @bkonkle/react:web

This results in a build setup adapted from CRA to allow prefetching (or even server rendering, if you want) and to support runtime environment variables. It uses a Webpack config adapted from CRA with tweaks from Razzle and lots of customizations. The dev process is adapted from Razzle, and it runs a base Express process at the requested port, launching the Webpack Dev Server at port + 1 to handle hot reloaded resources. Apollo and Auth0 are optionally included.

You'll get a layout that looks like this (abbreviated):

my-new-web-project
├── assets - build resources not exposed to the public
├── scripts - lightweight build tooling adapted from CRA
│    ├── build.ts - build the project for production use
│    ├── dev.ts - run the project in dev mode alongside Webpack Dev Server
│    └── run.ts - run the project in production mode using the built bundle
├── src
│    ├── __tests__ - a stub folder for Jest tests
│    ├── components - components that handle rendering and presentation
│    ├── [data] - (if useApollo is selected) a folder for data-related modules
│    │    ├── [ApiClient.ts] - (if useApollo is selected) code to initialize an Apollo GraphQL client
│    │    └── [AuthClient.ts] - (if useAuth0 is selected) code to initialize Auth0 authentication
│    ├── state - Redux state management using thunks with context, for things like the Apollo client
│    │    ├── [AuthState.ts] - (if useAuth0 is selected) Redux module to manage auth state
│    │    ├── StateTypes.ts - a centralized module for types related to Redux
│    │    └── Store.ts - Redux store initialization and hot reloading code, with thunk context
│    ├── views - views compose components and handle logic and integration
│    │    ├── App.tsx - attaches providers for react-router, Redux, and optionally Apollo
│    │    ├── DummyApp.tsx - attaches dummy providers for rendering things like the error view
│    │    └── Router.tsx - a simple react-router switch view using routes from Routes.tsx
│    ├── BrowserConfig.ts - prepares and loads configs created by Config.ts below for the browser
│    ├── Client.tsx - bootstraps the application in the browser
│    ├── Config.ts - reads the server environment to create a config for the browser
│    ├── Routes.tsx - uses react-router-dom and react-loadable to describe available routes
│    └── Server.ts - the core Express server that builds a BrowserConfig for each request
├── static - static files made available via the Express server
│    └── document.html - a webpack-html-plugin template that Server.ts injects the config into
├── .babelrc - includes TypeScript, Emotion, and other plugins
├── Dockerfile - a simple container that uses "yarn run"
├── tsconfig.json - used by the Babel plugin
├── tslint.json - starts with Microsoft contrib and overrides a lot
└── webpack.config.ts - adapted from CRA with customizations

Mobile

To bootstrap a React Native mobile project, use the mobile generator:

mkdir my-new-mobile-project
cd my-new--mobile-project

yo @bkonkle/react:mobile

This results in a React Native application using Expo, with React Navigation for routing.

You'll get a layout that looks like this (abbreviated):

my-new-mobile-project
├── assets - static resources such as images
├── src
│    ├── __tests__ - a stub folder for Jest tests
│    ├── components - components that handle rendering and presentation
│    ├── [data] - (same as the web generator)
│    ├── screens - screens compose components and handle logic and integration
│    │    └── LoginScreen.tsx - the default route, intended to render a login experience
│    ├── state - (same as the web generator)
│    ├── Config.ts - sets up config values for all environments, then exports the current values
│    ├── Routes.ts - uses react-navigation to describe available screens
│    ├── Theme.ts - some basic app-wide theming tools
│    └── Types.ts - some general types used across the app
├── .babelrc - includes the standard Expo preset
├── App.js - the Expo entry point, which imports the App.tsx component
├── tsconfig.json - (same as the web generator)
└── tslint.json - (same as the web generator)

GraphQL

To bootstrap a GraphQL Api based on Postgraphile, use the graphql generator:

mkdir my-new-graphql-project
cd my-new--graphql-project

yo @bkonkle/react:graphql

This results in an Express API using Postgraphile and Playground as middleware.

my-new-graphql-project
├── migrations - database schema migrations written in TypeScript and using Knex
├── sql - sql function definitions that are loaded into Postgres
├── src
│    ├── __tests__ - a stub folder for Jest tests
│    ├── utils - assorted utility modules
│    │    └── MigrationUtils.ts - utilities for Knex schema migrations
│    ├── Config.ts - reads the environment and exports various config namespaces
│    ├── Plugins.ts - Postgraphile plugins to extend the GraphQL schema
│    ├── Server.ts - the main Express pipeline with Postgraphile and Playground
│    └── Types.ts - some general types used across the app
├── knexfile.js - Knex schema migration config
├── tsconfig.json - (same as the web generator)
└── tslint.json - (same as the web generator)