1.1.16 • Published 1 year ago

create-react-global v1.1.16

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

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-global

This 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 myApp

This will:

  1. Create a folder named myApp.
  2. Set up the required project structure.
  3. Reuse globally installed dependencies (react, react-dom, react-scripts).
  4. 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

  1. Modify the src/App.js file to start building your custom React app.
  2. Add more components and styles in the src/ directory as needed.

Troubleshooting

  1. If the tool does not work:
    Ensure it is installed globally using the -g flag:

    npm i -g react react-dom react-scripts create-react-global
  2. Error during dependency installation:
    Make sure you have internet access and the necessary permissions to install global npm packages.

  3. 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. 😊


1.1.16

1 year ago

1.1.15

1 year ago

1.1.14

1 year ago

1.1.13

1 year ago

1.1.12

1 year ago

1.1.11

1 year ago

1.1.10

1 year ago

1.1.9

1 year ago

1.1.8

1 year ago

1.1.7

1 year ago

1.1.6

1 year ago