1.0.2 • Published 1 year ago

solvr_react_storybook v1.0.2

Weekly downloads
-
License
ISC
Repository
-
Last release
1 year ago

CLI tool for generating react native storybook components

This CLI tool is called "solvr" and is used to generate React Native storybook components.

Installation To install "solvr" globally, run the following command:

Copy code npm install -g solvr Usage

solvr generate options

Commands Generate This command generates a new component with the specified type and name. The generated component will include storybook stories and tests. The command also has an optional "-f" or "--force" flag that overwrites existing files.

Usage:

solvr generate options Options:

-f, --force: Overwrite existing files. Example:

solvr generate lib ComponentName -f This will generate a new component called "ComponentName" in "Lib" and overwrite any existing files.

Functionality The generate function takes two arguments: the type of the component (e.g. "lib", "components" , "screens", "pages" , etc.) and the name of the component (e.g. "Card", "Button", etc.). It then creates a folder for the component with the specified name inside the "src/type of the compoenent" folder. It also creates "stories" and "tests" subfolders inside the component folder.

The generate function also calls three other functions to create additional files:

generateStoryBookIndex: This function generates an index file for the storybook stories. generateComponentIndex: This function generates an index file for the component. generateComponentTests: This function generates a test file for the component.

The program object is used to define the command line interface for the tool. The name method sets the name of the tool, the description method sets the description, and the command method sets the name of the command ("generate") and the required arguments ("type" and "name"). The option method defines an optional flag ("-f" or "--force") and its description. The action method specifies the function to be called when the command is run. In this case, it calls the generate function and checks for the "force" flag. Finally, the parse method is called to parse the command line arguments.

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago