GithubHelp home page GithubHelp logo

mkcomponent's Introduction

mkcomponent

mkcomponent for React components.

Why?

I created this package to easily create React components, unifying the way we create them with other engineers in my team. This was inspired by @joaojeronimo when we worked at @Typeform.

Usage

Using npx

  1. Go the directory that you want to create the component and run npx react-mkcomponent *component-name*

Using a pkg manager

  1. Install the package globally: yarn global add react-mkcomponent or npm install -g react-mkcomponent
  2. Run mkcomponent *component-name* in the folder you want to create the component

Component structure

*component-name*/
├── index.js # exports the component
├── *component-name*.js # the component implmentation
├── *component-name*.test.js (opt-in with withTest) # tests with enzyme imported
├── *styled-components*.js (opt-in with withStyled) # well... for the styled components

Options

  • --class: to create a class component
  • --pure: to create a pure component
  • --func: (default) to create a functional component
  • --help: list the options

Configuration

In the package.json of your project you can extend the configuration of the library.

{
  //...
  "mkcomponent": {
    "withTest": false, // <bool> 
    "withStyled": false, // <bool>
    "testSuffix": "test" // {componentName}.{testSuffix}.js
  }
}

Conventions

  • pascal-case for component name
  • slug-case for folder and file names

Roadmap

  • Accept eslint configuration from the project so the component has the same configuration
  • Have a configuration file depending of the project
  • Support React memo
  • Support base file for storybook
  • Support "simple component" to create a file instead a folder

mkcomponent's People

Contributors

jepser avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.