Skip to content

Scaffold a react monorepo and its component parts.

License

Notifications You must be signed in to change notification settings

noderaider/modular

Repository files navigation

NPM

An unofficial companion ecosystem to create-react-app

Build Status codecov

What is this?

Often react applications can grow extremely large. create-react-app is a very innovative step forward in react apps, encouraging keeping them small by abstracting the build into a separate module (react-scripts). This 'managed' build strategy has many upsides, with the primary drawback being that you cannot modify the build process as easily. @raider/modular is an ecosystem of companion tools to create-react-app to continue in its footsteps, targeting the areas that it does not hit such as CSS modules support, and doing it in such a way that it will encourage project stacks to grow horizontally (many modules) instead of vertically.

Tenets

  • Every module is its own npm package.
  • Every module has built in hot reloading support to work in conjunction with a create-react-app downstream project.
  • Fast yarn installation support with fallback to npm if yarn is not installed.
  • Works on every platform.

PROGRESS

create-component-module react-foo-bar [-t/--with-test-module]

After publishing / linking, you may use the component from your downstream react app like so:

import React from 'react'
import reactFooBar from 'react-foo-bar'

// Create the component
const FooBar = reactFooBar(React)

export default (props) => <FooBar foo="bar" />

Note: Exporting modules as factories sidesteps a wide range of issues causing multiple instances of React in your downstream app.

Utils

Acknowledgements

Special thanks to Facebook for innovations with create-react-app, without it this project would not be possible.