react-chrome-extension-boilerplate

Boilerplate for Chrome Extension React.js project

  • 所有者: jhen0409/react-chrome-extension-boilerplate
  • 平台:
  • 許可證: MIT License
  • 分類:
  • 主題:
  • 喜歡:
    0
      比較:

Github星跟蹤圖

React Chrome Extension Boilerplate

Build Status
Build status: Windows
NPM version
Dependency Status
devDependency Status

Boilerplate for Chrome Extension React.js project.

Features

Examples

The example is edited from Redux TodoMVC example.

Popup

The todos state will be saved to chrome.storage.local.

Window

Window

The context menu is created by chrome/extension/background/contextMenus.js.

Inject page

The inject script is being run by chrome/extension/background/inject.js. A simple example will be inject bottom of page(https://github.com/*) if you visit.

If you are receiving the error message Failed to load resource: net::ERR_INSECURE_RESPONSE, you need to allow invalid certificates for resources loaded from localhost. You can do this by visiting the following URL: chrome://flags/#allow-insecure-localhost and enabling Allow invalid certificates for resources loaded from localhost.

Installation

# clone it
$ git clone https://github.com/jhen0409/react-chrome-extension-boilerplate.git

# Install dependencies
$ npm install

Development

  • Run script
# build files to './dev'
# start webpack development server
$ npm run dev
  • If you're developing Inject page, please allow https://localhost:3000 connections. (Because injectpage injected GitHub (https) pages, so webpack server procotol must be https.)
  • Load unpacked extensions with ./dev folder.

React/Redux hot reload

This boilerplate uses Webpack and react-transform, and use Redux. You can hot reload by editing related files of Popup & Window & Inject page.

Using Redux DevTools Extension

You can use redux-devtools-extension on development mode.

Build

# build files to './build'
$ npm run build

Compress

# compress build folder to {manifest.name}.zip and crx
$ npm run build
$ npm run compress -- [options]

Options

If you want to build crx file (auto update), please provide options, and add update.xml file url in [manifest.json](https://developer.chrome.com/extensions/autoupdate#update_url manifest.json).

  • --app-id: your extension id (can be get it when you first release extension)
  • --key: your private key path (default: './key.pem')
    you can use npm run compress-keygen to generate private key ./key.pem
  • --codebase: your crx file url

See autoupdate guide for more information.

Test

# lint
$ npm run lint
# test/app
$ npm test
$ npm test -- --watch  # watch files
# test/e2e
$ npm run build
$ npm run test-e2e

LICENSE

MIT

主要指標

概覽
名稱與所有者jhen0409/react-chrome-extension-boilerplate
主編程語言JavaScript
編程語言JavaScript (語言數: 3)
平台
許可證MIT License
所有者活动
創建於2015-07-23 02:47:06
推送於2020-03-20 17:50:19
最后一次提交2018-02-03 17:21:54
發布數17
最新版本名稱v0.9.0 (發布於 )
第一版名稱v0.0.1 (發布於 )
用户参与
星數2.1k
關注者數46
派生數389
提交數246
已啟用問題?
問題數73
打開的問題數39
拉請求數28
打開的拉請求數3
關閉的拉請求數2
项目设置
已啟用Wiki?
已存檔?
是復刻?
已鎖定?
是鏡像?
是私有?