Boilerplate to create a chrome extension with TypeScript and React.
- Write code with TypeScript.
- Simple React example of Chrome Extension.
- Unit tests using Jest & Enzyme & Sinon.JS.
- E2E tests using Puppeteer.
- Lint using TSLint & tslint-react.
- Format using Prettier.
- Clone the repository.
git clone https://github.com/kobanyan/ts-react-chrome-extension-boilerplate
- Remove
.git
directory. - Run
yarn install
. - Change the package information in
package.json
, i.e. name, description, etc. - Change the package information in
resources/manifest.json
, i.e. name, description, etc. - Run
yarn dev
. - Load your extension on Chrome from
build/lib
.
- Run
yarn test
.
Unit test file's name must be src/**/__tests__/**/*.test.ts?(x)
.
- Run
yarn e2e
.
E2E test file's name must be src/**/__tests__/**/*.spec.ts
.
- Put your private key file in
pem
directory. If the key file does not exist, the file will be generated. - Run
yarn prod
. - Your extension file (
.crx
) will be generated indist
directory.
- build/lib
JavaScript files transpiled from TypeScript files insrc
and resource files copied fromresources
. - dist
Chrome extension file. ([extension-name].crx
) - pem
Private key file. - resources
Resource files, i.e.manifest.json
,message.json
, icon images, etc. - scripts
Build script files. - src
Source files. - webpack
Webpack configuration files.
MIT
This boilerplate is inspired by React Chrome Extension Boilerplate.