Bash script to create React components (or component pages) with a single command.
- Add executable permissions to the script
$ chmod +x react_scaffold.sh
- Run the script
$ ./react_scaffold.sh [flags] <ComponentOne> <ComponentTwo> ...
Flag | Description | Values | Default |
---|---|---|---|
-h, --help | Show help | - | - |
-c, --component | Create a component instead of a component page | - | component |
-p, --page | Create a component page instead of a normal component | - | component |
-s, --styles | Select styles file | css, scss, sass, styled, stitches | styled |
-l, --language | Select language | js, ts | ts |
$ ./react_scaffold.sh -p -s sass -l js ComponentOne ComponentTwo
-
It is recomended to remove the extension of the script file (
react_scaffold.sh -> react_scaffold
) and move it to/usr/bin
,/usr/local/bin
or any other directory in your PATH variable to access it from anywhere in your system. -
By default, the script will create a component in the first
components
orpages
directory it finds recursively from the current location. The option to select a specific directory will be added in the future.