@grabantot/react-cli
Automate components management routine
Last updated a year ago by grabantot .
ISC · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install @grabantot/react-cli -g
SYNC missed versions from official npm registry.

react-cli

Installation

npm i -g @grabantot/react-cli

Usage

animation gif

Usage: react-cli [options] [command] <path/Component>

Manage react components and related files

Options:
  -V, --version  output the version number
  -f, --func     create functional component or convert the existing class component to functional
  -c, --class    create class component or convert the existsing functional component to class
  -s, --style    create style module and add 'import styles' to the component
  -i, --index    add component export to index.js in its directory
  -h, --help     output usage information

Commands:
  config <path>  set directory for templates and config file; will be filled with defaults if empty

Global config location: '/home/tot/.react-cli/config.json'.

Examples:
  $ react-cli -fs src/components/views/Primitives/Button
  $ react-cli -csi src/components/views/User/UserCard
  $ react-cli config path/to/empty/dir/to/put/react-cli-config-and-templates

Config options (react-cli.config.json):

{
  "useSemicolons": false,
  "componentExtension": ".js",
  "styleModuleExtension": ".module.scss"
}

Todo

Per directory configs. Configurable names for templates.

Commands:

  • mv - move/rename the component and related files, fix imports in the project

Options:

  -p, --prop-types  find props used in render and add propTypes for them
  -r, --redux       connect the component to the redux store
  -S, --story       create storybook story for the component
  -P, --pure        make the component pure (use recompose's pure for functional components)
  -t, --test        add tests for the component

Assumptions

  • Components are default exports in files
  • Functional components are defined as function ComponentName(props)
  • ...

No assumptions about the project structure.

Contribute

It's 2019 and still there is no decent react cli. Yet all the appropriate names for such a package on npm are taken.

Let's fix this. Contributions of any kind are welcome: add features, add tests, refactor the code or simply share you thoughts in issues.

Related projects

Less related:

Current Tags

  • 1.2.1                                ...           latest (a year ago)

10 Versions

  • 1.2.1                                ...           a year ago
  • 1.2.0                                ...           a year ago
  • 1.1.0                                ...           a year ago
  • 1.0.6                                ...           a year ago
  • 1.0.5                                ...           a year ago
  • 1.0.4                                ...           a year ago
  • 1.0.3                                ...           a year ago
  • 1.0.2                                ...           a year ago
  • 1.0.1                                ...           a year ago
  • 1.0.0                                ...           a year ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 10
Last Day 0
Last Week 10
Last Month 0
Dependencies (4)
Dev Dependencies (0)
None
Dependents (0)
None

Copyright 2014 - 2016 © taobao.org |