1.0.3 • Published 4 years ago
chrome-extension-react-typescript-boilerplate v1.0.3
Coinbase Wallet extension
Getting started
make init- Dev env auto refresh on change:
yarn run start - Build :
yarn run build:walletlink(just need to do this once and whenever walletlink changes)yarn run build:devyarn build:prodyarn start: to start dev and watch changes
To load local extension into browser:
- File a request at go/securityops for an exception to load unpacked extensions into chrome
- While that request is being processed, Install and run Brave browser
- navigate to brave://extensions
- Turn on Developer mode
- hit "Load unpacked" button, then select folder: wallet-extension/dist
Testing
Runs on Jest with React Testing Library
yarn test
I18N
Uses the react-intl library.
/i18n contains the translation property files, the English property file can be generated from the code via i18n:extract and translated files in other languages would be included here as well.
The property files are compiled via i18n:compile into JSON files in /src/i18n. These are the files that are actually read by react-intl and need to be bundled in the extension package.
yarn i18n:extract- Extracts alli18n.formatMessageas a new{root}/i18n/en.jsonfile that other translations are based off of.- These files should be translated and named after their appropriate locale translations.
yarn i18n:compile- Compiles translation files from{root}/i18n/en.jsonintosrc/i18n.- These files are what is imported and read by the
react-intllibrary.
Error reporting
- Tool used: Bugsnag
- Usage: this function can be used anywhere in the app:
import { reportError } from './init/reportError
reportError(ErrorData)- ErrorData type:
export type ErrorData = {
error: Error;
errorInfo?: React.ErrorInfo;
metadata?: Record<string, string | number | boolean | string[]>;
context?: string;
severity?: 'info' | 'warning' | 'error';
};- In dev env, it will be console.log and not appear in bugsnag dashboard
Generating and uploading production source maps to Bugsnag
Update the
appVersioninwebpack.sourcemaps.jsas needed.yarn build:sourcemapsThis will automatically generate Source Maps to the
/distfolder and upload them to Bugsnag
1.0.3
4 years ago