create-react-global v1.1.16
create-react-global
A CLI tool to quickly set up a basic React app with a simple structure and pre-configured dependencies.
Features
- Implements the DRY (Don't Repeat Yourself) principle to save time.
- Installs global dependencies (
react,react-dom,react-scripts,create-react-global) initially. - Reuses globally installed dependencies for subsequent projects, enabling React app creation in 3-5 seconds.
- Creates a React app with essential files and directories.
- Starts the development server immediately after setup.
Installation
Install the required packages globally (this step takes ~6 minutes initially):
npm i -g react react-dom react-scripts create-react-globalThis installs the necessary React dependencies globally, reducing the setup time for subsequent projects.
Usage
Run the command to create a new React project:
create-react-global <project-name>Replace <project-name> with your desired project name.
Example:
create-react-global myAppThis will:
- Create a folder named
myApp. - Set up the required project structure.
- Reuse globally installed dependencies (
react,react-dom,react-scripts). - Start the React development server.
Advantages of Using DRY Principle
- Initial Setup Time: Installing global dependencies takes ~6 minutes.
- Subsequent Project Creation: After the initial setup, you can create multiple React apps within 3-5 seconds by reusing the global dependencies.
Project Structure
After running the command, the following structure will be created:
myApp/
├── public/
│ └── index.html
├── src/
│ ├── App.js
│ ├── App.css
│ ├── index.js
│ └── index.css
├── .gitignore
├── package.json
└── node_modules/ (symlinked to global dependencies)Scripts
The package.json includes the following scripts:
start: Runs the development server.build: Creates a production build.test: Runs tests.eject: Ejects the React app configuration (not recommended).
Customization
- Modify the
src/App.jsfile to start building your custom React app. - Add more components and styles in the
src/directory as needed.
Troubleshooting
If the tool does not work:
Ensure it is installed globally using the-gflag:npm i -g react react-dom react-scripts create-react-globalError during dependency installation:
Make sure you have internet access and the necessary permissions to install global npm packages.React development server not starting:
Navigate to the project folder and run:npm start
License
This project is licensed under the MIT License.
Author
Crafted by Nithya Ganesh K. 😊