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

create-browser-extension-cli

v1.0.2

Published

A cli tool to create browser extensions. Create a boilerplate project with common codebase and HMR for Chrome and firefox browsers.

Downloads

5

Readme

🚀 create-browser-extension-cli

A simple CLI tool to quickly scaffold boilerplate for Chrome and Firefox extensions, similar to create-react-app. Get a head start with an un-opinionated project structure and prebuilt templates for cross-browser support.

✨ Features

  • ⚡ Generate boilerplate code for Chrome and Firefox extensions
  • 🔄 Hot Module Replacement (HMR) for Chrome extensions, ensuring smooth development
  • 🖥️ Single codebase for multiple browsers
  • 📦 Preconfigured Webpack setup for both development and production environments
  • 🛠️ Extendable and flexible project structure

📥 Installation

To install the CLI globally, run:

npm install -g create-browser-extension-cli

🛠️ Usage

To create a new browser extension project, run the following command:

create-browser-extension <project-name>

You will be prompted to choose the browsers you wish to support (Chrome, Firefox, or both).

Example

create-browser-extension my-extension

This will generate a project in the my-extension folder.

🗂️ Project Structure

Once generated, your project will have the following structure:

<project-name>/
  ├── config/
  │   ├── manifest-chrome.json       # Chrome-specific manifest file
  │   └── manifest-firefox.json      # Firefox-specific manifest file
  ├── src/
  │   ├── background.js              # Background script for the extension
  │   └── popup/
  │       └── popup.js               # Popup script
  ├── webpack/
  │   ├── webpack.common.js          # Shared Webpack configuration
  │   ├── webpack.dev.js             # Development-specific Webpack configuration
  │   └── webpack.prod.js            # Production-specific Webpack configuration
  ├── package.json
  └── README.md                      # Project documentation

📜 Available Scripts

The following scripts are preconfigured in the generated package.json:

  • dev:chrome: Starts the development server with HMR for Chrome 🔄
  • build:chrome: Builds the extension for Chrome 🏗️
  • build:firefox: Builds the extension for Firefox 🦊

Running Scripts

To run the available scripts, navigate to your project directory and use npm run followed by the script name. For example, to start the development server for Chrome:

cd my-extension
npm run dev:chrome

🛠️ Development

During development, you can use the following command to start the development server with Hot Module Replacement (HMR) for Chrome:

npm run dev:chrome

This uses the configuration from webpack/webpack.dev.js to enable rapid development by automatically reloading code changes without manually refreshing the extension.

🏗️ Building

To create production-ready builds, use the following commands:

  • Build for Chrome:

    npm run build:chrome
  • Build for Firefox:

    npm run build:firefox

These commands will use the configuration from webpack/webpack.prod.js to create optimized builds for the respective browsers.

🌐 Browser Compatibility

The CLI supports both Chrome and Firefox, and the generated project structure allows you to share a common codebase for both browsers. You can still customize specific features by modifying the respective manifest-chrome.json and manifest-firefox.json files.

🤝 Contributing

Contributions are welcome! If you'd like to improve this CLI or fix any issues, feel free to submit a pull request or open an issue. Let's build together! 💪

📄 License

This project is licensed under the MIT License. See the LICENSE file for more details.


Happy coding! 🚀🎉