Research
Security News
Quasar RAT Disguised as an npm Package for Detecting Vulnerabilities in Ethereum Smart Contracts
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
create-browser-extension-cli
Advanced tools
A cli tool to create browser extensions. Create a boilerplate project with common codebase and HMR for Chrome and firefox browsers.
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.
To install the CLI globally, run:
npm install -g create-browser-extension-cli
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).
create-browser-extension my-extension
This will generate a project in the my-extension
folder.
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
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 🦊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
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.
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.
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.
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! 💪
This project is licensed under the MIT License. See the LICENSE file for more details.
Happy coding! 🚀🎉
FAQs
A cli tool to create browser extensions. Create a boilerplate project with common codebase and HMR for Chrome and firefox browsers.
We found that create-browser-extension-cli demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
Security News
Research
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.