npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

gsharpi

v2.0.0

Published

Automatic package installer for for react + vite app

Downloads

51

Readme


🎯 gsharpi : The Ultimate Automatic Package Installer ( React + vite )

gsharpi-plugin is a Vite plugin that revolutionizes your workflow by automatically detecting and installing missing npm packages. Say goodbye to the tedious task of manually managing your dependencies—let gsharp-plugin handle it for you, in real-time, while you code!

🚀 Key Features

  • Automatic Package Detection & Installation: No need to worry about missing dependencies anymore. The plugin auto-installs them when detected in your project files.
  • Supports All Package Types:
    • Standard packages (e.g., axios, react)
    • Scoped packages (e.g., @mui/icons-material)
    • Sub-modules (e.g., lodash/fp)
  • Compatible with Both ES6 and CommonJS: Works with both import and require statements.
  • Real-Time Monitoring: Instantly detects missing packages when changes are made to JavaScript or TypeScript files.

📥 Installation

To get started with gsharp-plugin, follow these steps:

  1. Install Dependencies:

    npm install
  2. Integrate Plugin in your vite.config.js:

    
    
     import { defineConfig } from 'vite'
     import react from '@vitejs/plugin-react-swc'
     import { gsharpi } from 'gsharpi'
    
     export default defineConfig({
       plugins: [react(), gsharpi()],
     })
    
    
    
  3. Run Your Vite Server:

    npm run dev

The plugin will now watch your files and automatically install any missing npm packages it detects!

🛠️ Usage

Once set up, gsharp-plugin works behind the scenes. Here's an example:

Example Code

import React from 'react';
import axios from 'axios';
import AddShoppingCartIcon from '@mui/icons-material/AddShoppingCart';
import _ from 'lodash/fp';

Upon saving your file, the plugin will automatically install:

  • react
  • axios
  • @mui/icons-material
  • lodash

Folder Structure

Ensure your project structure looks like this:

project-root/
├── src/
│   ├── App.js or App.jsx
│   ├── other files
├── package.json
├── vite.config.js
└── node_modules/

📂 How It Works

  • File Watching: Uses chokidar to monitor changes in your src/ folder.
  • Import Detection: Scans files with regex for import and require statements.
  • Automatic Installation: Installs missing dependencies using npm install automatically.

🔧 Commands

  • npm run dev: Starts the Vite development server and automatically watches for missing packages.
  • npm install <package-name>: Manually install a package if needed.

📋 Requirements

  • Node.js: v14 or later
  • npm: v6 or later
  • Vite: v5 or later

📈 Future Enhancements

We have some exciting plans for gsharp-plugin:

  • 🔄 Support for pnpm and yarn package managers.
  • 📂 Ability to monitor additional directories.
  • 🛠️ Enhanced error handling and reporting for failed installations.

💡 Why gsharp-plugin?

Whether you're an experienced developer or just starting out, gsharp-plugin is designed to save you time by automating mundane tasks, keeping you focused on writing great code.

📜 License

This project is licensed under the Apache-2.0 License.


💬 Stay in Touch

We’d love to hear from you! Feel free to contribute, ask questions, or suggest improvements!


With gsharp-plugin, automating package installations becomes a seamless part of your workflow. Enjoy coding while we handle the rest! 🎉


This enhanced README has a clean and appealing structure, highlights key features, and provides a good balance of technical information and visual appeal. Feel free to customize it further to match your project!

💬 Author

MR GAURI SHANKAR KHADGA

❤️ KEEP CODING ❤️