create-react-library
CLI for creating reusable react libraries.
A CLI tool that scaffolds a publishable React component library with bundling, hot-reload development, and npm publishing pre-configured, archived since 2022, with tsup recommended instead.
create-react-library is a command-line tool that sets up the scaffolding for building a reusable React component library that can be published to npm. If you have written a React component and want to package it so that other developers can install it in their own projects, this tool handles the configuration work involved in doing that: bundling, transpiling, test setup, and a local development environment.
Running the tool prompts you for some basic information about your module, then generates a project structure with everything wired together. You get a src folder for your library code, a bundler called Rollup configured to output both CommonJS and ES module formats (the two packaging styles that npm consumers expect), and a separate example folder with a full React app that imports your library so you can preview it in a browser while developing.
The development workflow runs two processes side by side. One watches your library source and recompiles it whenever you save a file. The other runs the example app, which hot-reloads in the browser as changes come in. When you are ready to share the library, a single command builds it and publishes it to npm. There is also a command to deploy the example app to GitHub Pages.
Note that the README opens with a clear statement that this project is no longer actively maintained as of 2022. The author recommends using alternative tools like tsup, tsdx, or microbundle instead. The project was widely used and many npm packages were bootstrapped with it, but it should be treated as archived software rather than a starting point for new work.
Where it fits
- Scaffold a new React component library project with Rollup bundling and npm publishing already configured.
- Preview your React component in a live browser using the built-in example app while developing.
- Publish a React component to npm as both CommonJS and ES module formats with a single build command.