Skip to content

MisatoKatsuragi/react-scaffolding

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Optimized Build Scaffolding for React

This project is a React-based frontend scaffolding designed for optimized builds. It integrates several powerful tools and configurations to enhance performance, maintainability, and development speed. The structure includes Vite for fast builds, Tailwind CSS for styling, Prettier for code formatting, ESLint for linting, and Jest for testing.

Table of Contents

Project Structure Technologies Used Getting Started Scripts Configuration Features Contributing License

Project Structure

optimized-build-scaffolding/
├── public/                               # Static assets
│   └── vite.svg                          # SVG logo for Vite
├── src/                                  # Main source code
│   ├── assets/                           # Additional assets (e.g., images, fonts)
│   ├── App.css                           # Main application styles
│   ├── App.tsx                           # Main application component
│   ├── index.css                         # Global styles
│   ├── main.tsx                          # Entry point for the application
│   └── vite-env.d.ts                    # Type definitions for Vite
├── .babelrc                              # Babel configuration
├── .eslintrc.cjs                         # ESLint configuration
├── .gitignore                            # Files and directories to ignore by Git
├── .npmrc                                # NPM configuration
├── .prettierrc                           # Prettier configuration
├── eslint.config.js                      # ESLint configuration (alternative)
├── index.html                            # Main HTML file
├── jest.config.js                        # Jest configuration for testing
├── LICENSE                               # Project license
├── package-lock.json                     # NPM lock file
├── package.json                          # Project metadata and dependencies
├── postcss.config.js                     # PostCSS configuration
├── README.md                             # Project documentation
├── setupTests.ts                         # Setup file for Jest tests
├── stats.html                            # Build statistics generated by Vite
├── tailwind.config.js                    # Tailwind CSS configuration
├── tsconfig.app.json                     # TypeScript configuration for the app
├── tsconfig.app.tsbuildinfo              # TypeScript build info file
├── tsconfig.json                         # Main TypeScript configuration
├── tsconfig.node.json                    # TypeScript configuration for Node
├── tsconfig.node.tsbuildinfo             # Node TypeScript build info file
└── vite.config.ts                        # Vite configuration

Technologies Used

  • Vite: A modern frontend build tool that provides a fast development server and optimized production builds.
  • React: A JavaScript library for building user interfaces.
  • Tailwind CSS: A utility-first CSS framework for rapid UI development.
  • Prettier: An opinionated code formatter that enforces consistent style.
  • ESLint: A static code analysis tool for identifying problematic patterns in JavaScript code.
  • Jest: A testing framework for JavaScript that allows you to write unit tests for your application.

Getting Started

Clone the repository:

git clone <repository-url>
cd optimized-build-scaffolding

Install dependencies:

npm install

Run the development server:

npm run dev

This will start the Vite development server. You can view your application in the browser at http://localhost:3000.

Build the application for production:

npm run build

This command will create an optimized production build in the dist folder.

Scripts

  • dev: Starts the Vite development server.
  • build: Builds the application for production.
  • lint: Runs ESLint to check for code quality.
  • format: Runs Prettier to format the code.
  • test: Runs Jest to execute unit tests.

Configuration

Vite Configuration (vite.config.ts)

  • Plugins: This configuration uses several plugins:

    • @vitejs/plugin-react: Adds React support.
    • rollup-plugin-visualizer: Visualizes the bundle size.
    • vite-plugin-babel: Transpiles modern JavaScript to support older browsers.
    • vite-plugin-imagemin: Optimizes images for reduced size.
  • Build Options:

    • Minification: Uses Terser for JavaScript minification, removing console logs and comments.
    • Source Maps: Generates source maps for easier debugging in production.
    • Chunking: Implements manual chunking to separate vendor libraries from application code.

ESLint Configuration (.eslintrc.js)

Configures ESLint rules and settings for JavaScript and TypeScript files, ensuring code quality and consistency.

Prettier Configuration (.prettierrc)

Defines formatting rules for Prettier, ensuring that all code adheres to a consistent style.

Jest Configuration (jest.config.js)

Sets up Jest for running unit tests, specifying options for test files and coverage reporting.

Features

  1. Optimized Builds: Vite provides fast builds and hot module replacement for a smooth development experience.
  2. Tree Shaking: Unused code is removed from the final bundle, reducing file sizes.
  3. Code Splitting: The application can be split into multiple bundles, which improves loading times.
  4. Image Optimization: Images are optimized to reduce size without compromising quality.
  5. Babel Transpilation: Supports older browsers through Babel, with configurations for environment targets.
  6. Size Analysis: Visualizes the size of bundles to identify large modules for optimization.
  7. Source Maps: Generates source maps for easier debugging in production.
  8. Tailwind CSS Integration: Provides a utility-first CSS framework for styling.
  9. Code Quality Tools: ESLint and Prettier ensure code quality and consistency.
  10. Unit Testing: Jest is included for testing the application.

Contributing

Contributions are welcome! Please fork the repository and submit a pull request for any enhancements or bug fixes.

License

This project is licensed under the MIT License - see the LICENSE file for details.

About

React-based frontend scaffolding

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •  

Languages