Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/fristaildg/create-react-ds
React Design System Boilerplate
https://github.com/fristaildg/create-react-ds
design-system esbuild react rollup styled-components styled-system typescript
Last synced: 21 days ago
JSON representation
React Design System Boilerplate
- Host: GitHub
- URL: https://github.com/fristaildg/create-react-ds
- Owner: fristaildg
- Created: 2022-12-12T19:10:30.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2023-07-28T10:08:12.000Z (over 1 year ago)
- Last Synced: 2024-11-16T01:16:08.361Z (about 1 month ago)
- Topics: design-system, esbuild, react, rollup, styled-components, styled-system, typescript
- Language: TypeScript
- Homepage:
- Size: 482 KB
- Stars: 10
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
Awesome Lists containing this project
README
# Create React DS
> CLI for bootstrapping your own awesome React design system / components library!
[![NPM](https://img.shields.io/npm/v/create-react-ds)](https://www.npmjs.com/package/create-react-ds)
Create React DS provides a simple command line interface for generating a new project with a set of predefined components and styles. This tool helps to automate the process of creating a design system, which can save a lot of time and effort for developers. The tool also provides a set of options that can be configured to customize the design system to suit the specific needs of the project or organization.
## Features
- Supports Typescript by default
- Bundles `commonjs` and `es` formats
- [Rollup](https://rollupjs.org/) and [Esbuild](https://esbuild.github.io/) for bundling
- [Jest](https://jestjs.io/) and [React Testing Library](https://testing-library.com/docs/react-testing-library/intro/) for testing
- [Styled Components](https://styled-components.com/) for styling
- Easy Theming functionality
- [Storybook](https://storybook.js.org/) for local development / component stories
- [Eslint](https://eslint.org/) and [Prettier](https://prettier.io/) for code linting and formatting## Table of contents
- [Usage](#usage)
- [Standalone mode](#standalone-mode)
- [Development](#development)
- [Bundle your library for publishing](#bundle-your-library-for-publishing)
- [Test you bundle locally before publishing](#test-you-bundle-locally-before-publishing)
- [Publish your library to npm](#publish-your-library-to-npm)
- [Update your published library](#update-your-published-library)
- [Using your newly created components library](#using-your-newly-created-components-library)
- [Install the component library and its peer dependencies](#install-the-component-library-and-its-peer-dependencies)
- [Import ThemeProvider in the root of your app](#import-themeprovider-in-the-root-of-your-app)
- [Local mode](#local-mode)## Usage
This package requires node `>=18.12.1`
- [Standalone mode](#standalone-mode) - Bootstrap a new library to be developed and maintained as a project of it's own
- Local mode - Inject the components library files and dependencies into an already existing react project## Standalone mode
This is de default (and recommended) way of using this library. It will bootstrap a new library to be developed and maintained as a project of it's own```bash
npx create-react-ds my-design-system-name
```### Development
```bash
npm run storybook
```This will start storybook in localhost
### Bundle your library for publishing
```bash
npm run build
```### Test you bundle locally before publishing
```bash
npm pack
```This will create a .tar file (with the exact same content that would be published to npm) which you can `npm install` in any react / next / remix application of yours.
You will be able to consume the library from that application as if it was coming from a published package.### Publish your library to npm
```bash
npm publish
```Just make sure the name of your library is available in npm
### Update your published library
```bash
npm version major / minor / patch
npm publish
```This will bump your library's version according to the semver standards
### Using your newly created components library
Once your library is published or packed, you can install it into your react application and start using it!
### Install the component library and its peer dependencies
```bash
npm install path-to-your-library styled-components themed-props
```### Import `ThemeProvider` in the root of your app
It will typically be in the `App` component, or in the `_app.tsx` file if it's a next app.
Wrap your main component in `ThemeProvider` so that you can leverage the theming functionality across your library's components in your app.```jsx
import { ThemeProvider } from 'your-library';
...return (
);
```## Local mode
If you prefer to just develop your component library within your app instead of maintaining a separate project for it, then you can use this mode. It will inject the components files and dependencies into an already existing react project.This mode assumes a typical frontend react / next.js app folder structure, so run the following command in the root of your app:
```bash
npx create-react-ds my-design-system-name --mode=local
```The resulting folder structure should look something like this:
```
myApp
- scripts
- - generate-component <----
- - ...
- src
- - my-component-library <----
- - ...
...
```Also, some changes will have happened in your `package.json` file:
- All necessary dependencies installed: `styled-components`, `themed-props`
> *For more info on how to leverage the usage of the Theme and Styled Props, please refer to [Styled Components](https://styled-components.com/) and [Styled System](https://styled-system.com/) docs respectively.*
Made with Love!! ❤️