项目作者: aiherrera

项目描述 :
Simple project for creating react libraries
高级语言: JavaScript
项目地址: git://github.com/aiherrera/create-react-library.git
创建时间: 2021-02-26T20:56:27Z
项目社区:https://github.com/aiherrera/create-react-library

开源协议:MIT License

下载


React Component Library

Build status
License: MIT

Note: This is a customized fork from react-component-library by Harvey Delaney

This project skeleton was created to help people get started with creating their own React component library using:

Development

Testing

  1. npm run test

Building

  1. npm run build

Storybook

To run a live-reload Storybook server on your local machine:

  1. npm run storybook

To export your Storybook as static files:

  1. npm run storybook:build

Generating New Components
I’ve included a handy NodeJS util file under util called create-component.js. Instead of copy pasting components to create a new component, you can instead run this command to generate all the files you need to start building out a new component. To use it:

  1. npm run generate YourComponentName

This will generate:

  1. /src
  2. /YourComponentName
  3. YourComponentName.tsx
  4. YourComponentName.stories.tsx
  5. YourComponentName.test.tsx
  6. YourComponentName.types.ts
  7. YourComponentName.scss

The default templates for each file can be modified under util/templates.

You can type the component name in lowercase mode the command will Capitilized your component on generation time.

Don’t forget to add the component to your index.ts exports if you want the library to export the component!