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

zwen-react

v0.8.3

Published

Code generator CLI for projects using react and redux

Readme

zwen-react

zwen-react is a code generator CLI for projects using react and redux. You can generate the following:

We're also working on generating SCSS stylesheets and an initial project setup for the redux store.

The code generated by zwen-react follows our best practices at Zweitag and is therefore highly opinionated.

Contents

  1. Installation
  2. Configuration
  3. Usage
  4. Advanced Usage
  5. Architecture

Installation

npm i -g zwen-react

or

yarn global add zwen-react

Configuration

Some settings can be adjusted by creating a .zwen file in your project directory.

Source Directory

Especially for repositories holding both backend and frontend it might be necessary to change the default source directory.

// => .zwen
{
  "srcDir": "frontend/src" // default: "src"
}

Indentation

If you prefer tabs or any other kind of indentation you may define it here.

// => .zwen
{
  "indent": "    " // default: "  " (two spaces)
}

Usage

Actions

zwen action path/to/myAction

This will create or update the action creators (src/actions/path/to/creators.js) and tests (src/actions/path/to/creators.test.js) with an action called myAction. If you choose to, it will also create or update src/actions/path/to/types.js with the type MY_ACTION.

It will also wire up exports along the path and create new index.js files if they don't exist.

(More about actions)

Components

zwen component path/to/myComponent

This will create a new component file (src/components/path/to/MyComponent.js). You can choose if the component should be connected to the store, or – if not – should be set up with props.

You also have the option to generate a class component by supplying a flag:

zwen component path/to/myComponent --classComp

or

zwen component path/to/myComponent -c

(More about components)

Middleware

zwen middleware myMiddleware

This will create a new middleware file (src/middleware/myMiddleware.js) and a test file (src/middleware/myMiddleware.test.js).

It will also export the new middleware from the folder's index.js file.

(More about midddleware)

Reducers

zwen reducer path/to/myReducer

This will create a new reducer file (src/reducers/path/to/myReducer.js) and a test file (src/reducers/path/to/myReducer.test.js).

It will also wire up exports along the path and create new index.js files if they don't exist.

(More about reducers) (More about selectors)

Selectors

zwen selector path/to/mySelector

This will create or update the file located at src/selectors/path/to.js and a test file (src/selectors/path/to.test.js). The new selector will be named mySelector. It will also wire up the imports and create new index.js files if they don't exist.

You will get a list with all selectors defined in reducer files (we're working on adding complex selectors to that list as well), from which you choose the ones to use in your new selector. Type done! when your selection is complete.

(More about selectors)

Advanced Usage

Sorting

When generating exports in index.js files zwen-react automatically sorts everything alphabetically. This might become a problem as soon as you want to have a certain order to your exports (e.g. middleware).

To make sure some exports remain at the top of a file you can make use of the following syntax:

/* zwen-keep-start */
export { default as firstMiddleware } from './firstMiddleware';
/* zwen-keep-end */

// all other (sorted) exports

zwen-react will respect this section and keep it at the top of the file after inserting the new export.

Architecture

zwen-react expects your frontend architecture to follow the following structure (names written like [this] are examples):

|--actions
|----[request]
|------creators.js
|------creators.test.js
|------index.js
|------types.js
|----index.js
|----types.js
|
|--components
|----[generic]
|------[Button.js]
|----App.js
|
|--middleware
|----index.js
|----[sendRequest.js]
|----[sendRequest.test.js]
|
|--reducers
|----[filter]
|------index.js
|------[selectedDate.js]
|------[selectedDate.test.js]
|----index.js
|
|--selectors
|----index.js
|----ui.js
|----ui.test.js
|
|--stylesheets
|----components
|------[generic]
|--------[button.scss]
|----manifest.scss
|
|--index.js
|--store.js