0.2.2 โ€ข Published 4 years ago

react-chrome-extension-cli v0.2.2

Weekly downloads
1
License
MIT
Repository
-
Last release
4 years ago

React Chrome Extension CLI

The CLI next Chrome Extension. ๐Ÿš€

Quick Overview

npm install -g react-chrome-extension-cli
react-chrome-extension-cli my-extension
cd my-extension
npm run watch

Then follow these instructions to see your extension: 1. Open chrome://extensions 2. Check the Developer mode checkbox 3. Click on the Load unpacked extension button 4. Select the folder my-extension/build

When you're ready to publish to Chrome Web Store, create a minified bundle with npm run build and then zip the build folder.

Get Started Immediately

You donโ€™t need to install or configure Webpack. Webpack comes in preconfigured, so that you can focus on the code.

Just create a project, and youโ€™re good to go.

Creating an Extension

Installation

npm install -g react-chrome-extension-cli

Usage

react-chrome-extension-cli <project-name>

Example:

react- chrome-extension-cli my-react-extension

It will create a directory called my-extension inside the current folder.

my-extension
โ”œโ”€โ”€ README.md
โ”œโ”€โ”€ node_modules
โ”œโ”€โ”€ package.json
โ”œโ”€โ”€ .gitignore
โ”œโ”€โ”€ config                    // Webpack with minimal configurations
โ”‚   โ”œโ”€โ”€ paths.js
โ”‚   โ”œโ”€โ”€ webpack.common.js
โ”‚   โ””โ”€โ”€ webpack.config.js
โ”œโ”€โ”€ public
โ”‚   โ”œโ”€โ”€ icons
โ”‚   โ”‚   โ”œโ”€โ”€ logo.png
โ”‚   โ”œโ”€โ”€ *.html                // HTML files will vary depending on extension type
โ”‚   โ””โ”€โ”€ manifest.json
โ””โ”€โ”€ src
    โ”œโ”€โ”€ *.css                 // CSS files will vary depending on extension type
    โ””โ”€โ”€ *.js                  // JS files will vary depending on extension type

Once the installation is done, you can open your project folder:

cd my-extension

Inside the newly created project, you can run some built-in commands:

npm run watch

ไธ€ๅฎš่ฆ่ฐƒๆ•ดไธบๅผ€ๅ‘่€…ๆจกๅผ ๅฝ“ไฝฟ็”จ npm run build ๆ‰“ๅŒ…ๅฎŒๆฏ•๏ผŒๅฏไปฅๅŠ ่ฝฝๅˆฐ chrome ๆต่งˆๅ™จไธญ

  1. ๆ‰“ๅผ€ chrome://extensions
  2. ็กฎไฟๆ‰“ๅผ€ไบ†ๅผ€ๅ‘่€…ๆจกๅผ
  3. ็‚นๅ‡ป Load unpacked extension ๆŒ‰้’ฎ
  4. ้€‰ไธญ my-extension/build ็›ฎๅฝ•

npm run build

Builds the app for production to the build folder. Zip the build folder and your app is ready to be published on Chrome Web Store.