@ax51/react-component-creator

1.0.12 • Public • Published

This is a simple CLI utility to helps create React Components.

You can install it using your favorite package manager:

npm i -D @ax51/react-component-creator
yarn add -D @ax51/react-component-creator
pnpm i -D @ax51/react-component-creator
bun add -d @ax51/react-component-creator

Or you could simply use it without installing as dependence:

npx @ax51/react-component-creator
yarn dlx @ax51/react-component-creator
pnpm dlx @ax51/react-component-creator

It could be configured to create a folder, named as the given component name, which has such structure:

[path to components folder]
├── Component
│   ├── index.ts
│   ├── Component.tsx
│   ├── Component[.module].css
│   └── Component.spec.ts

While you use this util first time, it asks you to config fhe followind properties:

  1. default path to the components (such as ./src/Components)
  2. your stypesheet files extension (such as .less | .sass | .css etc.)
  3. would you like to use module stylesheets
  4. would you like to use TypeScript files (.ts) or plain JavaScript (.js)
  5. would you like to include test files to your component.

This settings will be saved in component-creator.json file in the root of your project and used next time you call this util.

After initial setup this util, next time you could use it in 2 ways:

  1. Interactive. Just run it (npx @ax51/react-component-creator) and interactively tells new Component name
  2. Pass arguments while call util. First argument will be Component name, and the second (optional) is the custom path (doesn't override settings); For example:
npx @ax51/react-component-creator Header ./view/components
                 ^                  ^              ^
            package name     Component name    custom path

Package Sidebar

Install

npm i @ax51/react-component-creator

Weekly Downloads

1

Version

1.0.12

License

ISC

Unpacked Size

7.04 kB

Total Files

4

Last publish

Collaborators

  • ax51